-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathartefactos.py
48 lines (41 loc) · 1.17 KB
/
artefactos.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
host = "127.0.0.2"
port = 55_551
import re
with open("artefactos.json","r") as f:
artefactos = f.read()
artefactos = eval(artefactos)
kaomojis = {
":smile": ":)",
":angry": ">:(",
":combito": "Q('- 'Q)",
":larva": "(:o)OOOooo",
":arrow":"|----->",
}
def replace_kaomojis(message, emojis=kaomojis):
for key, value in emojis.items():
message = message.replace(key, value)
return message
def id_to_name(items:list):
items = list(map(str, items))
for i in range(len(items)):
try:
items[i] = artefactos[items[i]]
except:
pass
items = ", ".join(items)
items = list(items)
for i in range(len(items)):
if items[-i] == ",":
items[-i] = " y"
break
return "".join(items)
def get_inventory(hash:dict, nickname:str):
message = "Tu inventario es:\n"
l = hash[nickname]["inventario"]
for i in l:
message+= f"{artefactos[str(i)]}\n"
return message
def id_to_list(texto):
numeros_encontrados = re.findall(r'\d+', texto)
numeros = [int(numero) for numero in numeros_encontrados]
return numeros