mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-02-20 09:38:23 +08:00
Make superuser qq as a environment var
This commit is contained in:
parent
addcf40c13
commit
7c5d7630ea
@ -1,5 +1,6 @@
|
|||||||
import functools
|
import functools
|
||||||
import re
|
import re
|
||||||
|
import os
|
||||||
|
|
||||||
from apiclient import client as api
|
from apiclient import client as api
|
||||||
from little_shit import SkipException, get_command_name_separators
|
from little_shit import SkipException, get_command_name_separators
|
||||||
@ -155,7 +156,7 @@ class CommandRegistry:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if func.superuser_only:
|
if func.superuser_only:
|
||||||
check(str(ctx_msg.get('sender_qq')) == '1002647525')
|
check(str(ctx_msg.get('sender_qq')) == os.environ.get('SUPER_USER_QQ'))
|
||||||
if ctx_msg.get('type') == 'group_message':
|
if ctx_msg.get('type') == 'group_message':
|
||||||
allowed_roles = {'owner', 'admin', 'member'}
|
allowed_roles = {'owner', 'admin', 'member'}
|
||||||
if func.group_admin_only:
|
if func.group_admin_only:
|
||||||
@ -178,7 +179,7 @@ class CommandRegistry:
|
|||||||
# This is strange, not likely happens
|
# This is strange, not likely happens
|
||||||
raise SkipException
|
raise SkipException
|
||||||
except SkipException:
|
except SkipException:
|
||||||
if not str(ctx_msg.get('sender_qq')) == '1002647525':
|
if not str(ctx_msg.get('sender_qq')) == os.environ.get('SUPER_USER_QQ'):
|
||||||
# Not allowed
|
# Not allowed
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user