From 61f3f8c83679d4cbab24bd7ee256432556cb4bf6 Mon Sep 17 00:00:00 2001 From: Antares Date: Wed, 26 Feb 2020 10:07:57 +0800 Subject: [PATCH 1/2] add dnspython --- requires.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requires.txt b/requires.txt index aac167a..840f0a5 100644 --- a/requires.txt +++ b/requires.txt @@ -17,4 +17,5 @@ redis jieba aiohttp aiofiles -ujson \ No newline at end of file +ujson +dnspython \ No newline at end of file -- Gitee From 3ee392dda3b0a33946cc20ada0346cee24390f9e Mon Sep 17 00:00:00 2001 From: Antares Date: Wed, 26 Feb 2020 10:08:06 +0800 Subject: [PATCH 2/2] fix bug --- plugins_new/music_163/plugin.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins_new/music_163/plugin.py b/plugins_new/music_163/plugin.py index 1d72a2a..50ea45b 100644 --- a/plugins_new/music_163/plugin.py +++ b/plugins_new/music_163/plugin.py @@ -29,7 +29,6 @@ class Music163Plugin(Plugin): "password": self.config.PASSWORD }) as resp: result = await resp.json() - self.bot.logger.debug(f"Login response: {result}") return result["code"] == 200 elif self.config.LOGIN_MODE == "email": async with self.aioclient.get(f"{self.config.API_URL}/login", params={ @@ -37,7 +36,6 @@ class Music163Plugin(Plugin): "password": self.config.PASSWORD }) as resp: result = await resp.json() - self.bot.logger.debug(f"Login response: {result}") return result["code"] == 200 else: return False @@ -47,7 +45,6 @@ class Music163Plugin(Plugin): return True async with self.aioclient.get(f"{self.config.API_URL}/login/refresh") as resp: result = await resp.json() - self.bot.logger.debug(f"") return result["code"] == 200 async def check_music_available(self, music_id: int) -> bool: @@ -75,8 +72,10 @@ class Music163Plugin(Plugin): return result["result"]["songs"] async def command_music(self, plugin, args: List[str], raw_string: str, context, evt: GroupMessageEvent): - # while not args[-1]: - # del args[-1] + if len(args) == 0: + await self.bot.client_async.send(context, "输入不合法") + return + raw = False link = False if args[-1] == "raw": @@ -86,9 +85,13 @@ class Music163Plugin(Plugin): link = True del args[-1] + if len(args) == 0: + await self.bot.client_async.send(context, "输入不合法") + return + if not await self.check_login_status(): if not await self.login(): - await self.bot.client_async.send(context, "网易云账号登陆失败!") + await self.bot.client_async.send(context, "网易云账号登陆失败, 请检查账号密码!") elif not await self.check_login_status(): await self.bot.client_async.send(context, "网易云账号登陆失败!") -- Gitee