From 1040b600d69c34f481727a0ce3da84c207708436 Mon Sep 17 00:00:00 2001 From: Richard Chien Date: Wed, 11 Jan 2017 14:16:51 +0800 Subject: [PATCH] Fix bug --- apiclient.py | 8 ++++---- command.py | 2 +- filters/split_at_xiaokai_50.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apiclient.py b/apiclient.py index 10ecd01c..18f7e2a1 100644 --- a/apiclient.py +++ b/apiclient.py @@ -73,16 +73,16 @@ class ApiClient: pass return None - def get_group_info(self, via): - url = self._api_url(via) + def get_group_info(self, ctx_msg: dict): + url = self._api_url(ctx_msg.get('via')) if url: try: return requests.get(url + '/get_group_info') except requests.exceptions.ConnectionError: return None - def get_user_info(self, via): - url = self._api_url(via) + def get_user_info(self, ctx_msg: dict): + url = self._api_url(ctx_msg.get('via')) if url: try: return requests.get(url + '/get_user_info') diff --git a/command.py b/command.py index df391e29..0ff050ed 100644 --- a/command.py +++ b/command.py @@ -174,7 +174,7 @@ class CommandRegistry: allowed_roles = allowed_roles.intersection({'owner'}) groups = list(filter( 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]: # This is strange, not likely happens diff --git a/filters/split_at_xiaokai_50.py b/filters/split_at_xiaokai_50.py index 6e5e83fc..d9a28b81 100644 --- a/filters/split_at_xiaokai_50.py +++ b/filters/split_at_xiaokai_50.py @@ -16,10 +16,10 @@ def _split_at_xiaokai(ctx_msg): return False at_me = '@' + my_group_nick 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: return False - my_nick = user_info.get('nick') + my_nick = user_info.get('name') if not my_nick: return False at_me = '@' + my_nick