Skip to content

Commit 7c97d3d

Browse files
committed
Template v2.2
Edited features: - Fixed the purge command - Made the error embeds actually red...
1 parent d84df59 commit 7c97d3d

File tree

4 files changed

+36
-14
lines changed

4 files changed

+36
-14
lines changed

UPDATES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Updates List
22
Here is the list of all the updates that I made on this template.
33

4+
### Version 2.2
5+
* Fixed the purge command
6+
* Made the error embeds actually red...
7+
48
### Version 2.1
59
* Made the help command dynamic
610
* Added a small description to all commands

bot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Description:
44
This is a template to create your own discord bot in python.
55
6-
Version: 2.1
6+
Version: 2.2
77
"""
88

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

@@ -119,7 +119,7 @@ async def on_command_error(context, error):
119119
embed = discord.Embed(
120120
title="Error!",
121121
description="This command is on a %.2fs cooldown" % error.retry_after,
122-
color=0x00FF00
122+
color=0xFF0000
123123
)
124124
await context.send(embed=embed)
125125
raise error

cogs/moderation.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async def kick(self, context, member: discord.Member, *args):
1919
embed = discord.Embed(
2020
title="Error!",
2121
description="User has Admin permissions.",
22-
color=0x00FF00
22+
color=0xFF0000
2323
)
2424
await context.send(embed=embed)
2525
else:
@@ -52,7 +52,7 @@ async def kick(self, context, member: discord.Member, *args):
5252
embed = discord.Embed(
5353
title="Error!",
5454
description="You don't have the permission to use this command.",
55-
color=0x00FF00
55+
color=0xFF0000
5656
)
5757
await context.send(embed=embed)
5858

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

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

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

@@ -165,6 +165,24 @@ async def purge(self, context, number):
165165
Delete a number of messages.
166166
"""
167167
if context.message.author.guild_permissions.administrator:
168+
try:
169+
number = int(number)
170+
except:
171+
embed = discord.Embed(
172+
title="Error!",
173+
description=f"`{number}` is not a valid number.",
174+
color=0xFF0000
175+
)
176+
await context.send(embed=embed)
177+
return
178+
if number < 1:
179+
embed = discord.Embed(
180+
title="Error!",
181+
description=f"`{number}` is not a valid number.",
182+
color=0xFF0000
183+
)
184+
await context.send(embed=embed)
185+
return
168186
purged_messages = await context.message.channel.purge(limit=number)
169187
embed = discord.Embed(
170188
title="Chat Cleared!",
@@ -176,7 +194,7 @@ async def purge(self, context, number):
176194
embed = discord.Embed(
177195
title="Error!",
178196
description="You don't have the permission to use this command.",
179-
color=0x00FF00
197+
color=0xFF0000
180198
)
181199
await context.send(embed=embed)
182200

cogs/owner.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async def shutdown(self, context):
2626
embed = discord.Embed(
2727
title="Error!",
2828
description="You don't have the permission to use this command.",
29-
color=0x00FF00
29+
color=0xFF0000
3030
)
3131
await context.send(embed=embed)
3232

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

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

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

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

0 commit comments

Comments
 (0)