-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspeedrun.py
40 lines (28 loc) · 1.37 KB
/
speedrun.py
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
import discord
from discord.ext import commands
class speedrun(commands.Cog):
"""SimpleCog"""
def __init__(self, bot):
self.bot = bot
@commands.command(name='admin')
@commands.has_role("Owner")
async def only_me(self, ctx):
"""A simple command which only responds to the owner of the bot."""
await ctx.send(f'Hello {ctx.author.mention}. This command can only be used by you!!')
@commands.command(name="delete")
async def delete(self, ctx):
await ctx.send('No...')
@commands.Cog.listener()
async def on_member_ban(self, guild, user):
"""Event Listener which is called when a user is banned from the guild.
For this example I will keep things simple and just print some info.
Notice how because we are in a cog class we do not need to use @bot.event
For more information:
http://discordpy.readthedocs.io/en/rewrite/api.html#discord.on_member_ban
Check above for a list of events.
"""
print(f'sadly, {user.name}-{user.id} was banned from {guild.name}-{guild.id} for unknown reasons...')
# The setup fucntion below is neccesarry. Remember we give bot.add_cog() the name of the class in this case SimpleCog.
# When we load the cog, we use the name of the file.
def setup(bot):
bot.add_cog(speedrun(bot))