1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-11-01 21:02:38 +00:00

Merge branch 'dev'

This commit is contained in:
Myned 2017-10-17 02:45:28 -04:00
commit 30e207d990

View file

@ -56,7 +56,7 @@ class Administration:
if when is None: if when is None:
for channel in channels: for channel in channels:
async for message in channel.history(limit=None): async for message in channel.history(limit=None):
if message.author.id == user: if message.author.id == int(user):
history.append(message) history.append(message)
# history.extend(await channel.history(limit=None).flatten()) # history.extend(await channel.history(limit=None).flatten())
await ch_sent.edit(content='🗄 **Cached** `{}/{}` **channels.**'.format(channels.index(channel) + 1, len(channels))) await ch_sent.edit(content='🗄 **Cached** `{}/{}` **channels.**'.format(channels.index(channel) + 1, len(channels)))
@ -84,14 +84,16 @@ class Administration:
await cont_sent.delete() await cont_sent.delete()
del_sent = await ctx.send('🗑 **Deleting messages...**') del_sent = await ctx.send('🗑 **Deleting messages...**')
await del_sent.pin() await del_sent.pin()
c = 0
for message in history: for message in history:
with suppress(err.NotFound): with suppress(err.NotFound):
await message.delete() await message.delete()
c += 1
await del_sent.edit(content='🗑 **Deleted** `{}/{}` **messages.**'.format(history.index(message) + 1, len(history))) await del_sent.edit(content='🗑 **Deleted** `{}/{}` **messages.**'.format(history.index(message) + 1, len(history)))
await asyncio.sleep(self.RATE_LIMIT) await asyncio.sleep(self.RATE_LIMIT)
await del_sent.unpin() await del_sent.unpin()
await ctx.send('🗑 `{}` **of** <@{}>**\'s messages deleted from** {}**.**'.format(len(history), user, ctx.guild.name)) await ctx.send('🗑 `{}` **of** <@{}>**\'s messages left in** {}**.**'.format(len(history) - c, user, ctx.guild.name))
await ctx.message.add_reaction('') await ctx.message.add_reaction('')
except exc.CheckFail: except exc.CheckFail: