diff --git a/.gitignore b/.gitignore index 24e417a..7240761 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .env -env \ No newline at end of file +env +__pycache__ \ No newline at end of file diff --git a/bot.py b/bot.py index 7108f28..792c6bf 100644 --- a/bot.py +++ b/bot.py @@ -7,10 +7,7 @@ client = commands.Bot(command_prefix= 'd!') @client.event async def on_ready(): - print(f'{client.user.name} is ready.') - # print(f'Bot is in {len(client.guilds)} guilds.') - # print(f'Guilds have {len(client.users)} members.') - await client.change_presence(activity=discord.Streaming(name="Click the link!", url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")) + print(f'{client.user.name} is online.') @client.command() async def load(ctx, extension): diff --git a/cogs/moderationCog.py b/cogs/moderationCog.py index 2027ca7..28f370e 100644 --- a/cogs/moderationCog.py +++ b/cogs/moderationCog.py @@ -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)) \ No newline at end of file diff --git a/cogs/pingCog.py b/cogs/pingCog.py index 40f3d28..2c6b071 100644 --- a/cogs/pingCog.py +++ b/cogs/pingCog.py @@ -9,8 +9,7 @@ class PingCog(commands.Cog): # Commands @commands.command(aliases=['latency']) async def ping(self, ctx): - # await ctx.send(f'Pong! {client.latency}ms') - await ctx.send('Pong!') - + await ctx.send(f'Pong! {round(self.client.latency * 1000)}ms') + def setup(client): client.add_cog(PingCog(client)) \ No newline at end of file