-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
106 lines (86 loc) · 3.13 KB
/
main.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import discord
import os
import requests
import json
import random
from replit import db
from keep_alive import keep_alive
client = discord.Client()
stink_words = ["stink", "stinky", "smelly", "smells", "smell", "stench", "odor"]
stinky_responses = [
"tbh dominic smells so bad omfg :rofl:",
"fenske literally smells so good the definition of stink is not fenske if u look it up",
"omg peee-yew!!! :nauseated_face: dom smells SOOOOOO bad!"
]
starter_sass = [
"u stink kek",
"ur nan"
]
# fetches and returns a random GIF using the GIPHY API
def get_gif():
params = dict(key=os.getenv('GIFAPI'), tag='party')
response = requests.get("http://api.giphy.com/v1/gifs/random", params=params)
json_data = json.loads(response.text)
return(json_data['data']['url'])
# adds current message to 'sass' database if not already in there
def update_sass(user_sass):
if "sass" in db.keys():
sass = db["sass"]
sass.append(user_sass)
db["sass"] = sass
else:
db["sass"] = [user_sass]
# deletes the 'sass' message at the specified index
def delete_sass(index):
sass = db["sass"]
if len(sass) > index:
del sass[index]
db["sass"] = sass
# just lets us know we're logged in and ready to go
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
# reads messages from the current server and executes the corresponding function based on the contents of the message
@client.event
async def on_message(message):
msg = message.content
if message.author == client.user:
return
if any(word in msg for word in stink_words) or msg.startswith('!stink'):
if message.author == "DoM#9534":
await message.channel.send("shut up dom")
else:
await message.channel.send(random.choice(stinky_responses))
if msg.startswith('!fensketime'):
gif_url = get_gif()
await message.channel.send(gif_url)
options = starter_sass
if "sass" in db.keys():
options = options + db["sass"]
if msg.startswith('!sassme'):
await message.channel.send(random.choice(options))
if msg.startswith('!showsass'):
if "sass" in db.keys():
for (i, item) in enumerate(db["sass"], start=0):
await message.channel.send(f"{i}: {item}")
else:
await message.channel.send("No sass to display. Add some with '!addsass'")
if msg.startswith('!addsass'):
new_sass = msg.split("!addsass ",1)[1]
update_sass(new_sass)
await message.channel.send("Sass added.")
if msg.startswith("!rmsass"):
if "sass" in db.keys():
sass_index = int(msg.split("!rmsass ", 1)[1])
delete_sass(sass_index)
await message.channel.send("Sass removed.")
else:
await message.channel.send("No sass to remove. Add some with '!addsass'")
if msg.startswith("!help"):
await message.channel.send("!sassme - get some sass")
await message.channel.send("!addsass <message> - upload some sass")
await message.channel.send("!showsass - shows the current sass list")
await message.channel.send("!rmsass <index> - remove sass using the list index from !showsass")
await message.channel.send("!fensketime - you already know bb")
keep_alive()
client.run(os.getenv('TOKEN'))