-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtutoring.py
78 lines (72 loc) · 2.85 KB
/
tutoring.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import discord
from util import is_url_image
from constants import emojiThumbsUp
async def add_110_role(member):
role = discord.utils.get(member.guild.roles, id=809577623126409240)
print(role)
await member.add_roles(role)
async def add_182_role(member):
role = discord.utils.get(member.guild.roles, id=809577657398198322)
print(role)
await member.add_roles(role)
async def add_122_role(member):
role = discord.utils.get(member.guild.roles, id=809577695586549793)
print(role)
await member.add_roles(role)
async def add_282_role(member):
role = discord.utils.get(member.guild.roles, id=809577733020581898)
print(role)
await member.add_roles(role)
async def add_160_role(member):
role = discord.utils.get(member.guild.roles, id=809577851292090368)
print(role)
await member.add_roles(role)
async def add_student_role(member):
role = discord.utils.get(member.guild.roles, id=805898946434170900)
print(role)
await member.add_roles(role)
async def add_108_role(member):
role = discord.utils.get(member.guild.roles, id=809577813354872883)
print(role)
await member.add_roles(role)
async def tutoring_server(message):
await add_student_role(message.author)
themsg = message.content.lower()
if "tutor" in themsg and ("today" in themsg or "right now" in themsg or "now" in themsg or "online" in themsg) and "?" in themsg:
with open(str(message.guild.id)+"_Schedule", "r") as content_file:
link = content_file.read()
await message.channel.send(str(link))
if themsg.startswith("-join"):
join = int(message.content[5:])
if join == 110:
await add_110_role(message.author)
await message.add_reaction(emojiThumbsUp)
elif join == 108:
await add_108_role(message.author)
await message.add_reaction(emojiThumbsUp)
elif join == 182:
await add_182_role(message.author)
await message.add_reaction(emojiThumbsUp)
elif join == 282:
await add_282_role(message.author)
await message.add_reaction(emojiThumbsUp)
elif join == 160:
await add_160_role(message.author)
await message.add_reaction(emojiThumbsUp)
elif join == 122:
await add_122_role(message.author)
await message.add_reaction(emojiThumbsUp)
if themsg.startswith("-setschedule"):
urls = themsg.split()
print(urls[1])
if is_url_image(urls[1]):
try:
f = open(str(message.guild.id)+"_Schedule", "w")
f.write(str(urls[1]))
f.close()
await message.add_reaction(emojiThumbsUp)
except:
await message.channel.send("unable to save link")
else:
print('error')
await message.channel.send("Error")