1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-24 22:27:28 +00:00

Added prune all user command

This commit is contained in:
Myned 2017-10-04 16:29:13 -04:00
parent dd284701ee
commit 0ee61c8084

View file

@ -0,0 +1,29 @@
import asyncio
import discord
import traceback
import discord
from discord.ext import commands
from misc import checks
from misc import exceptions as exc
class Administration:
def __init__(self, bot):
self.bot = bot
@commands.command(name='prunealluser')
@commands.is_owner()
async def prune_all_user(self, ctx, uid):
channels = ctx.message.guild.channels
member = ctx.message.guild.get_member(uid)
history = {}
c = 0
for channel in channels:
history[channel.id] = await channel.history().flatten()
print('Added: ' + channel.id)
for channel, messages in history.items():
for message in messages:
if message.author is member:
await message.delete()
c += 1
await ctx.send('✅ `' + c + '` **messages deleted from the server.**')