-
Notifications
You must be signed in to change notification settings - Fork 0
/
json_test.py
30 lines (28 loc) · 1.17 KB
/
json_test.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
from regex import F
import src.JsonDB as JsonDB
dic=JsonDB.read_json(filename='./src/jsonfile/database.json')
dic['command'].update({'gametag':'print ตอนนี้กำลังเล่น>> {game_name} << to user end'})
JsonDB.write_json(filename='./src/jsonfile/database.json',data= dic)
def command_read_database(Input_command,user_name):
if Input_command in dic['command']:
commandp=dic['command'][Input_command]
command= commandp.split()
command_str=""
for v in command:
try:
if v == 'print':
command_str+=f'ctx.send(\' '
elif v=='to':
command_str+=f' @'
elif v=='user':
command_str+=f'{"{"}{user_name}{"}"}'
elif v=='{game_name}':
command_str+='{game_name}'
elif v=='end':
command_str+='\')'
else:
command_str+=f' {v}'
except Exception as e:
command_str=f'ctx.send({e})'
return command_str
print(command_read_database('discord','rabbitz'))