mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-12-18 09:25:46 +08:00
Fix bug
This commit is contained in:
parent
9c794334c1
commit
1040b600d6
@ -73,16 +73,16 @@ class ApiClient:
|
|||||||
pass
|
pass
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_group_info(self, via):
|
def get_group_info(self, ctx_msg: dict):
|
||||||
url = self._api_url(via)
|
url = self._api_url(ctx_msg.get('via'))
|
||||||
if url:
|
if url:
|
||||||
try:
|
try:
|
||||||
return requests.get(url + '/get_group_info')
|
return requests.get(url + '/get_group_info')
|
||||||
except requests.exceptions.ConnectionError:
|
except requests.exceptions.ConnectionError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_user_info(self, via):
|
def get_user_info(self, ctx_msg: dict):
|
||||||
url = self._api_url(via)
|
url = self._api_url(ctx_msg.get('via'))
|
||||||
if url:
|
if url:
|
||||||
try:
|
try:
|
||||||
return requests.get(url + '/get_user_info')
|
return requests.get(url + '/get_user_info')
|
||||||
|
@ -174,7 +174,7 @@ class CommandRegistry:
|
|||||||
allowed_roles = allowed_roles.intersection({'owner'})
|
allowed_roles = allowed_roles.intersection({'owner'})
|
||||||
groups = list(filter(
|
groups = list(filter(
|
||||||
lambda g: g.get('group_uid') == ctx_msg.get('group_uid'),
|
lambda g: g.get('group_uid') == ctx_msg.get('group_uid'),
|
||||||
api.get_group_info(via='qq').json()
|
api.get_group_info(ctx_msg).json()
|
||||||
))
|
))
|
||||||
if len(groups) <= 0 or 'member' not in groups[0]:
|
if len(groups) <= 0 or 'member' not in groups[0]:
|
||||||
# This is strange, not likely happens
|
# This is strange, not likely happens
|
||||||
|
@ -16,10 +16,10 @@ def _split_at_xiaokai(ctx_msg):
|
|||||||
return False
|
return False
|
||||||
at_me = '@' + my_group_nick
|
at_me = '@' + my_group_nick
|
||||||
if not text.startswith(at_me):
|
if not text.startswith(at_me):
|
||||||
user_info = api.get_user_info().json()
|
user_info = api.get_user_info(ctx_msg).json()
|
||||||
if not user_info:
|
if not user_info:
|
||||||
return False
|
return False
|
||||||
my_nick = user_info.get('nick')
|
my_nick = user_info.get('name')
|
||||||
if not my_nick:
|
if not my_nick:
|
||||||
return False
|
return False
|
||||||
at_me = '@' + my_nick
|
at_me = '@' + my_nick
|
||||||
|
Loading…
Reference in New Issue
Block a user