-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
80 lines (60 loc) · 1.46 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
import os
import discord
import requests
import json
import random
from replit import db
my_secret = os.environ['COIN']
client = discord.Client()
queryWords= [
"question",
"explore",
"lookup",
"find",
"what",
"need",
"suggestion",
"suggestions",
"help",
"wonder",
"curious",
"where",
"when"
]
queryDict = {
"question": "questions",
"help": "help me"
}
queryStarterConvo = [
"I know a solution...",
"I may have a suggestion...",
"I can help you with that!",
"I'm a helper, I can look that up for you!",
"Do you need help?",
"Can I look that up fory you?",
"I can show you pictures of that place.",
"Let me enlighten you."
]
def get_quote():
response = requests.get("https://zenquotes.io/api/random")
json_data = json.loads(response.text)
quote = json_data[0]['q'] + " - " + json_data[0]['a']
return(quote)
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
msg = message.content
if msg.startswith("$hello"):
await message.channel.send("hello!")
if msg.startswith("$bye"):
await message.channel.send("goodbye")
if msg.startswith("$quote"):
quote= get_quote()
await message.channel.send(quote)
if any(word in msg for word in queryWords):
await message.channel.send(random.choice(queryStarterConvo))
client.run(os.getenv('COIN'))