-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.py
More file actions
47 lines (41 loc) · 1.64 KB
/
Copy pathadmin.py
File metadata and controls
47 lines (41 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import discord
from discord.ext import commands
from time import sleep
from secrets import choice
class Admin():
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True)
@commands.has_permissions(kick_members=True)
async def kick(self, ctx, user: discord.Member):
"""Kicks defined member.
A command that will kick inputted member.
"""
await self.bot.kick(user)
@commands.command(pass_context=True)
@commands.has_permissions(kick_members=True)
async def randomkick(self, ctx):
"""Kicks a random member.
A command that will kick some random person.
"""
members = ctx.message.server.members
member = choice(list(members))
await self.bot.say('{} just got randomly kicked!'.format(member.mention))
await self.bot.kick(member)
@commands.command(pass_context=True)
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, user: discord.Member):
"""Blasts defined member into oblivion.
Beam Me Up, Scotty.
"""
await self.bot.ban(user)
@commands.command(pass_context=True)
@commands.has_permissions(manage_messages=True)
async def purge(self, ctx, amount: int):
"""*purge <amount>
A command that will purge a specified amount of messages from a text channel.
"""
deleted = await self.bot.purge_from(ctx.message.channel, limit=amount)
await self.bot.say('Deleted {} message(s)'.format(len(deleted)))
def setup(bot):
bot.add_cog(Admin(bot))