-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathroll.py
More file actions
23 lines (20 loc) · 814 Bytes
/
roll.py
File metadata and controls
23 lines (20 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import random
def roll(nmsg):
#Dismember Message and Roll the dices
try:
msg = nmsg.strip().lower()
if msg[0] == "/":
space = msg.find(" ")
dados = msg[space:].strip().split('d')
rolls = []
soma = 0
for c in range(0, int(dados[0]), 1):
r = random.randint(1, int(dados[1]))
rolls.append(r)
soma += r
inicial = msg[msg.find(" "):].strip()
# retunr f"[BOT] Result of {inicial}: {soma} // {rolls}"
return f"[BOT] Resultado de {inicial}: {soma} // {rolls}"
except:
# return "Command Error! Try Again. Roll Examples: /roll 3d6, /r 2d10, /role 5d10"
return "Erro no Comando! faça corretamente. Exemplos: /roll 3d6, /r 2d10, /role 5d10 "