-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBYUBot.py
60 lines (32 loc) · 1.11 KB
/
BYUBot.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import discord
from discord.ext import commands
import asyncio
DISCORD_KEY = ''
ROLE_CHANNEL_ID = 399963477302575105;
bot = commands.Bot(command_prefix='.')
@bot.event
async def on_ready():
print(discord.__version__)
print('------')
print('Logged in as:')
print(bot.user.name)
print(bot.user.id)
print('------')
@bot.command()
async def iam(ctx, role:discord.Role):
if (ctx.channel.id == ROLE_CHANNEL_ID):
if (role not in ctx.author.roles):
if (role.name != "mod" or role.name != "TA"):
await ctx.author.add_roles(role)
await ctx.send(ctx.author.mention + ' you have been given the ' + role.name + ' role.')
else:
await ctx.send(ctx.author.mention + ' you already have the ' + role.name + ' role.')
@bot.command()
async def iamnot(ctx, role:discord.Role):
if (ctx.channel.id == ROLE_CHANNEL_ID):
if (role not in ctx.author.roles):
await ctx.send(ctx.author.mention + ' you do not have the ' + role.name + ' role.')
else:
await ctx.author.remove_roles(role)
await ctx.send(ctx.author.mention + ' you have been removed from the ' + role.name + ' role.')
bot.run(DISCORD_KEY)