Skip to content

Commit

Permalink
Template v2.2
Browse files Browse the repository at this point in the history
Edited features:
- Fixed the purge command
- Made the error embeds actually red...
  • Loading branch information
kkrypt0nn committed Feb 26, 2021
1 parent d84df59 commit 7c97d3d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 14 deletions.
4 changes: 4 additions & 0 deletions UPDATES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Updates List
Here is the list of all the updates that I made on this template.

### Version 2.2
* Fixed the purge command
* Made the error embeds actually red...

### Version 2.1
* Made the help command dynamic
* Added a small description to all commands
Expand Down
6 changes: 3 additions & 3 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Description:
This is a template to create your own discord bot in python.
Version: 2.1
Version: 2.2
"""

import discord, asyncio, os, platform, sys
Expand Down Expand Up @@ -100,7 +100,7 @@ async def on_message(message):
embed = discord.Embed(
title="You're blacklisted!",
description="Ask the owner to remove you from the list if you think it's not normal.",
color=0x00FF00
color=0xFF0000
)
await context.send(embed=embed)

Expand All @@ -119,7 +119,7 @@ async def on_command_error(context, error):
embed = discord.Embed(
title="Error!",
description="This command is on a %.2fs cooldown" % error.retry_after,
color=0x00FF00
color=0xFF0000
)
await context.send(embed=embed)
raise error
Expand Down
30 changes: 24 additions & 6 deletions cogs/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def kick(self, context, member: discord.Member, *args):
embed = discord.Embed(
title="Error!",
description="User has Admin permissions.",
color=0x00FF00
color=0xFF0000
)
await context.send(embed=embed)
else:
Expand Down Expand Up @@ -52,7 +52,7 @@ async def kick(self, context, member: discord.Member, *args):
embed = discord.Embed(
title="Error!",
description="You don't have the permission to use this command.",
color=0x00FF00
color=0xFF0000
)
await context.send(embed=embed)

Expand Down Expand Up @@ -83,7 +83,7 @@ async def nick(self, context, member: discord.Member, *, name: str):
embed = discord.Embed(
title="Error!",
description="You don't have the permission to use this command.",
color=0x00FF00
color=0xFF0000
)
await context.send(embed=embed)

Expand Down Expand Up @@ -126,7 +126,7 @@ async def ban(self, context, member: discord.Member, *args):
embed = discord.Embed(
title="Error!",
description="You don't have the permission to use this command.",
color=0x00FF00
color=0xFF0000
)
await context.send(embed=embed)

Expand Down Expand Up @@ -155,7 +155,7 @@ async def warn(self, context, member: discord.Member, *args):
embed = discord.Embed(
title="Error!",
description="You don't have the permission to use this command.",
color=0x00FF00
color=0xFF0000
)
await context.send(embed=embed)

Expand All @@ -165,6 +165,24 @@ async def purge(self, context, number):
Delete a number of messages.
"""
if context.message.author.guild_permissions.administrator:
try:
number = int(number)
except:
embed = discord.Embed(
title="Error!",
description=f"`{number}` is not a valid number.",
color=0xFF0000
)
await context.send(embed=embed)
return
if number < 1:
embed = discord.Embed(
title="Error!",
description=f"`{number}` is not a valid number.",
color=0xFF0000
)
await context.send(embed=embed)
return
purged_messages = await context.message.channel.purge(limit=number)
embed = discord.Embed(
title="Chat Cleared!",
Expand All @@ -176,7 +194,7 @@ async def purge(self, context, number):
embed = discord.Embed(
title="Error!",
description="You don't have the permission to use this command.",
color=0x00FF00
color=0xFF0000
)
await context.send(embed=embed)

Expand Down
10 changes: 5 additions & 5 deletions cogs/owner.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def shutdown(self, context):
embed = discord.Embed(
title="Error!",
description="You don't have the permission to use this command.",
color=0x00FF00
color=0xFF0000
)
await context.send(embed=embed)

Expand All @@ -41,7 +41,7 @@ async def say(self, context, *, args):
embed = discord.Embed(
title="Error!",
description="You don't have the permission to use this command.",
color=0x00FF00
color=0xFF0000
)
await context.send(embed=embed)

Expand All @@ -60,7 +60,7 @@ async def embed(self, context, *, args):
embed = discord.Embed(
title="Error!",
description="You don't have the permission to use this command.",
color=0x00FF00
color=0xFF0000
)
await context.send(embed=embed)

Expand Down Expand Up @@ -106,7 +106,7 @@ async def blacklist_add(self, context, member: discord.Member):
embed = discord.Embed(
title="Error!",
description="You don't have the permission to use this command.",
color=0x00FF00
color=0xFF0000
)
await context.send(embed=embed)

Expand Down Expand Up @@ -139,7 +139,7 @@ async def blacklist_remove(self, context, member: discord.Member):
embed = discord.Embed(
title="Error!",
description="You don't have the permission to use this command.",
color=0x00FF00
color=0xFF0000
)
await context.send(embed=embed)

Expand Down

0 comments on commit 7c97d3d

Please sign in to comment.