-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
68 lines (59 loc) · 1.71 KB
/
utils.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
import random
#answers for magic 8-ball
eightball = [
"It is certain", #positve answers
"Without a doubt",
"You may rely on it",
"Yes definitely",
"It is decidedly so",
"As I see it, yes",
"Most likely",
"Yes",
"Outlook good",
"Signs point to yes",
"Reply hazy try again", #nutral answers
"Better not tell you now",
"Ask again later",
"Cannot predict now",
"Concentrate and ask again",
"Don’t count on it", #negative answers
"Outlook not so good",
"My sources say no",
"Very doubtful",
"My reply is no"
]
#this function chooses a random answer for the 'eightball' list
def eightball_answer():
answer = random.choice(eightball)
return answer
#returns 1 if the command contain more than one word(the command itself) else returns 0
def check_commandlength(message):
count = 0
for word in message:
count+=1
if count>1:
return 1
else:
return 0
#checks if the message from the user contains the phrase 'choices' and returns its position
#parameters - list(list of the words of the message/command split using ' ')
def poll_option(message):
count = 0
for word in message :
count = count + 1
if word == '-':
return count
return count
#id's of different colour reactions 'colour square'
#got the id's from emojipedia
poll_reactions = [
'🟦', #blue
'🟥', #red
'🟨', #yellow
'🟩', #green
'🟪', #purple
'🟧', #orange
'🟫', #brown
'⬛', #black
'⬜' #white
]