Coverage for cmds/database.py: 38%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""
2database.py
4contains sync()
5"""
7from database import get, write
8from error import AuthorisationError
10async def dwrite(message, *args):
11 """
12 write()
14 writes string to file if user is admin
15 """
17 # get admins from database
18 admins = get("admins")
20 # check for priviledges
21 if str(message.author.id) in admins:
23 # write
24 write(*(args[0].split('.')), string=' '.join(args[1:]))
26 return "Data written"
28 raise AuthorisationError