-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathresponses.py
68 lines (63 loc) · 3.33 KB
/
responses.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
from rolls import roll, roll_bonus_penalty
import sys
list_of_dices = list(range(1, 100))
dices = [2, 4, 6, 8, 10, 12, 16, 20, 100, 1000]
def handle_response(msg, author) -> str:
msg = msg.lower()
#Welcome
hello = ["czesc", "cześć", "czesć", "cześc", "hej", "dzien dobry", "dzień dobry", "dziendob", "yo", "witaj", "witam", "dobry"]
for hi in hello:
if msg.startswith(hi):
return "W imieniu dyrekicji bardzo serdecznie chciałbym powitać Cię na serwerze Władcy Kości"
#Dices
if msg[-1] in "kp":
if msg[-2] in "kp" and msg[-3].isdigit(): #dobule bonus/fault dice
if msg[0].isdigit() and (msg[1] == "k") and msg[2:-2].isdigit():
amount_of_rolls = int(msg[0])
dice = int(msg[2:-2])
roll_response = roll_bonus_penalty(author, amount_of_rolls, dice, msg[-1], True)
return roll_response
elif msg[0].isdigit() and msg[1].isdigit() and (msg[2] == "k") and msg[3:-2].isdigit():
amount_of_rolls = int(msg[0] + msg[1])
dice = int(msg[3:-2])
roll_response = roll_bonus_penalty(author, amount_of_rolls, dice, msg[-1], True)
return roll_response
elif msg[-2].isdigit(): #normal funciton one bonus of fault dice
if msg[0].isdigit() and (msg[1] == "k") and msg[2:-1].isdigit():
amount_of_rolls = int(msg[0])
dice = int(msg[2:-1])
roll_response = roll_bonus_penalty(author, amount_of_rolls, dice, msg[-1], False)
return roll_response
elif msg[0].isdigit() and msg[1].isdigit() and (msg[2] == "k") and msg[3:-1].isdigit():
amount_of_rolls = int(msg[0] + msg[1])
dice = int(msg[3:-1])
roll_response = roll_bonus_penalty(author, amount_of_rolls, dice, msg[-1], False)
return roll_response
else:
pass #normal roll
if msg[0].isdigit() and (msg[1] == "k") and msg[2:].isdigit():
amount_of_rolls = int(msg[0])
dice = int(msg[2:])
roll_response = roll(author, amount_of_rolls, dice)
return roll_response
elif msg[0].isdigit() and msg[1].isdigit() and (msg[2] == "k") and msg[3:].isdigit():
amount_of_rolls = int(msg[0]+msg[1])
dice = int(msg[3:])
roll_response = roll(author, amount_of_rolls, dice)
return roll_response
#Rest
elif msg == "help":
return "Aby uzyskać wynik wynik na k100, proszę o użycie funkcji roll"
elif msg == "promotion":
return "Moje najszczersze gratulacje z okazji awansu! Mam nadzieję że spełnisz się w swojej nowej roli, trzymam kciuki i życzę powodzenia!"
elif msg == "negative":
return "Dzień Dobry, Chciałym poinformować, że jesteś osobą która nie jest milie widziana na tym kanale, wobec tego administracja kanału uprasza o nie podejmowanie kolejnych prób dołączenia. Z góry dziękuję, życzę miłego dnia."
elif msg == "welcome":
return f"{author} witamy na serwerze 'Władcy Kości'!"
else:
pass #do rest
def handle_name_response(name_msg) -> str:
if name_msg == "<@1055576642254286938> znikaj":
sys.exit()
else:
return "Proszę o wybaczanie, aczkolwiek mój zasób usług którę oferuje jest bardzo ograniczony, Przepraszam"