Rifat Azad commited on
Commit
0893492
·
1 Parent(s): 676a005

update command purge

Browse files
Files changed (1) hide show
  1. pydvpl_bot.py +6 -5
pydvpl_bot.py CHANGED
@@ -35,7 +35,7 @@ load_dotenv()
35
  # DEFINES ------------------------------------------------------ START
36
 
37
 
38
- BOT_VERSION = '1.3.2'
39
 
40
  AUTHORIZED_USER_ID = os.getenv('AUTHORIZED_ID')
41
 
@@ -1135,6 +1135,11 @@ async def timeout(ctx, member: discord.Member, duration: int, *, reason=None):
1135
  @bot.command()
1136
  async def purge(ctx, amount: int):
1137
 
 
 
 
 
 
1138
  # Check if the author is owner of the guild to use this command
1139
  if ctx.author.guild_permissions.manage_roles or ctx.author == ctx.guild.owner:
1140
 
@@ -1142,10 +1147,6 @@ async def purge(ctx, amount: int):
1142
 
1143
  msg = await ctx.reply(f"Purging `{amount}` messages...")
1144
 
1145
- if isinstance(ctx.channel, discord.DMChannel):
1146
- await ctx.send("Purging is not supported in direct messages.")
1147
- return
1148
-
1149
  try:
1150
  # Use the before parameter to only purge messages before the command is invoked
1151
  await ctx.channel.purge(limit=amount, before=ctx.message)
 
35
  # DEFINES ------------------------------------------------------ START
36
 
37
 
38
+ BOT_VERSION = '1.3.3'
39
 
40
  AUTHORIZED_USER_ID = os.getenv('AUTHORIZED_ID')
41
 
 
1135
  @bot.command()
1136
  async def purge(ctx, amount: int):
1137
 
1138
+ if isinstance(ctx.channel, discord.DMChannel):
1139
+ msg = await ctx.reply(f"Purging `{amount}` messages...")
1140
+ await msg.edit(content="Purging is not supported in direct messages.")
1141
+ return
1142
+
1143
  # Check if the author is owner of the guild to use this command
1144
  if ctx.author.guild_permissions.manage_roles or ctx.author == ctx.guild.owner:
1145
 
 
1147
 
1148
  msg = await ctx.reply(f"Purging `{amount}` messages...")
1149
 
 
 
 
 
1150
  try:
1151
  # Use the before parameter to only purge messages before the command is invoked
1152
  await ctx.channel.purge(limit=amount, before=ctx.message)