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

8 statements  

1""" 

2database.py 

3 

4contains sync() 

5""" 

6 

7from database import get, write 

8from error import AuthorisationError 

9 

10async def dwrite(message, *args): 

11 """ 

12 write() 

13 

14 writes string to file if user is admin 

15 """ 

16 

17 # get admins from database 

18 admins = get("admins") 

19 

20 # check for priviledges 

21 if str(message.author.id) in admins: 

22 

23 # write 

24 write(*(args[0].split('.')), string=' '.join(args[1:])) 

25 

26 return "Data written" 

27 

28 raise AuthorisationError