Confirmation of the ban/kick is sent everytime and if the modlogs channel exists within the cache, an embed is sent to the modlogs channel too

pull/8/head
sgoudham 4 years ago
parent 4d95a04668
commit 57c6bdd906

@ -21,13 +21,6 @@ async def ban_members(message, targets, reason):
""" """
# Get the channel of the modlog within the guild
modlog = get_modlog_for_guild(str(message.guild.id))
if modlog is None:
channel = message.channel
else:
channel = message.guild.get_channel(int(modlog))
# With every member, ban them and send an embed confirming the ban # With every member, ban them and send an embed confirming the ban
# The embed will either be sent to the current channel or the modlogs channel # The embed will either be sent to the current channel or the modlogs channel
for target in targets: for target in targets:
@ -35,6 +28,17 @@ async def ban_members(message, targets, reason):
and not target.guild_permissions.administrator): and not target.guild_permissions.administrator):
await target.ban(reason=reason) await target.ban(reason=reason)
await message.delete()
embed = Embed(description="✅ **{}** Was Banned! ✅".format(target))
await message.channel.send(embed=embed)
# Get the channel of the modlog within the guild
modlog = get_modlog_for_guild(str(message.guild.id))
if modlog is None:
pass
else:
channel = message.guild.get_channel(int(modlog))
embed = Embed(title="Member Banned", embed = Embed(title="Member Banned",
colour=enso_embedmod_colours, colour=enso_embedmod_colours,
timestamp=datetime.datetime.utcnow()) timestamp=datetime.datetime.utcnow())
@ -66,13 +70,6 @@ async def kick_members(message, targets, reason):
""" """
# Get the channel of the modlog within the guild
modlog = get_modlog_for_guild(str(message.guild.id))
if modlog is None:
channel = message.channel
else:
channel = message.guild.get_channel(int(modlog))
# With every member, kick them and send an embed confirming the kick # With every member, kick them and send an embed confirming the kick
# The embed will either be sent to the current channel or the modlogs channel # The embed will either be sent to the current channel or the modlogs channel
for target in targets: for target in targets:
@ -80,6 +77,17 @@ async def kick_members(message, targets, reason):
and not target.guild_permissions.administrator): and not target.guild_permissions.administrator):
await target.kick(reason=reason) await target.kick(reason=reason)
await message.delete()
embed = Embed(description="✅ **{}** Was Kicked! ✅".format(target))
await message.channel.send(embed=embed)
# Get the channel of the modlog within the guild
modlog = get_modlog_for_guild(str(message.guild.id))
if modlog is None:
pass
else:
channel = message.guild.get_channel(int(modlog))
embed = Embed(title="Member Kicked", embed = Embed(title="Member Kicked",
colour=enso_embedmod_colours, colour=enso_embedmod_colours,
timestamp=datetime.datetime.utcnow()) timestamp=datetime.datetime.utcnow())

Loading…
Cancel
Save