fixed ping and moderation

This commit is contained in:
rzmk 2021-05-18 20:54:14 -04:00
parent d1011f3430
commit 4cddba1004
4 changed files with 20 additions and 11 deletions

View file

@ -10,9 +10,21 @@ class ModerationCog(commands.Cog):
@commands.command()
@commands.has_permissions(kick_members = True)
async def kick(self, ctx, member : discord.Member, *, reason="No reason provided."):
await ctx.send(member.mention + " has been kicked.")
await member.send("You have been kicked from the server because: " + reason)
await member.kick(reason=reason)
try:
await member.kick(reason=reason)
await ctx.send(member.mention + " has been kicked.")
except:
await ctx.send(f"Unable to kick {member.mention}.\nIs {member.mention} at the same role level or higher than {self.client.user.name}?")
@commands.command()
@commands.has_permissions(ban_members = True)
async def ban(self, ctx, member : discord.Member, *, reason="No reason provided."):
try:
await member.ban(reason=reason)
await ctx.send(member.mention + " has been banned.")
except:
await ctx.send(f"Unable to ban {member.mention}.\nIs {member.mention} at the same role level or higher than {self.client.user.name}?")
def setup(client):
client.add_cog(ModerationCog(client))