Ljzd-PRO / nonebot-plugin-mystool

QQ聊天、频道机器人插件 | 米游社工具-每日米游币任务、游戏签到、商品兑换、免抓包登录、原神崩铁便笺提醒
https://pypi.org/project/nonebot-plugin-mystool
MIT License
412 stars 51 forks source link

微博兑换多账号 #296

Closed duki-web closed 5 months ago

duki-web commented 5 months ago

微博兑换多账号,要怎么编辑dataV2.json

Ljzd-PRO commented 5 months ago

@Joseandluue

dontdot commented 5 months ago

还没适配多账号支持

duki-web commented 5 months ago

还没适配多账号支持

weibo_cookie有哪些必要参数,我抓到都是SUB=;SUBP=; weibo_params是aid、from、gsid、s这几个必要参数就行,还是要加其他的

dontdot commented 5 months ago

还没适配多账号支持

weibo_cookie有哪些必要参数,我抓到都是SUB=;SUBP=; weibo_params是aid、from、gsid、s这几个必要参数就行,还是要加其他的

有这几个就行了,后续签到函数也是必要这些参数的

duki-web commented 5 months ago

还没适配多账号支持

weibo_cookie有哪些必要参数,我抓到都是SUB=;SUBP=;weibo_params是aid、from、gsid、s这几个必要参数就行,还是要加其他的

有这几个就行了,后续签到函数也是必要这些参数的

05-14 09:15:47 [INFO] nonebot_plugin_mystool | 开始获取微博兑换码ticket_id 05-14 09:15:49 [INFO] nonebot_plugin_mystool | 原神超话当前没有兑换码 05-14 09:15:51 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=746) running complete 05-14 09:15:51 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=746) failed. Traceback (most recent call last): File "", line 17, in File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/init.py", line 335, in run get_driver().run(*args, **kwargs) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/drivers/none.py", line 56, in run loop.run_until_complete(self._serve()) .................................................. File "/root/makl/.venv/lib/python3.11/site-packages/httpx/_client.py", line 399, in _merge_cookies merged_cookies.update(cookies) File "/root/makl/.venv/lib/python3.11/site-packages/httpx/_models.py", line 1140, in update self.jar.set_cookie(cookie) File "/usr/lib/python3.11/http/cookiejar.py", line 1672, in set_cookie if cookie.domain not in c: c[cookie.domain] = {} AttributeError: 'str' object has no attribute 'domain' 05-14 09:15:51 [DEBUG] nonebot | Stop event propagation 05-14 09:15:51 [DEBUG] nonebot | Checking for matchers completed 这种报错是正常的吧?

dontdot commented 5 months ago

AttributeError: 'str' object has no attribute 'domain'

AttributeError: 'str' object has no attribute 'domain' 请求的cookie出错了,cookie不应该是str,看下你cookie里参数是用什么串联的

duki-web commented 5 months ago

AttributeError: 'str' object has no attribute 'domain'

AttributeError: 'str' object has no attribute 'domain' 请求的cookie出错了,cookie不应该是str,看下你cookie里参数是用什么串联的

05-14 09:13:35 [DEBUG] nonebot | Running handler Dependent(call=weibo_schedule) 05-14 09:13:35 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=746) running complete 05-14 09:13:35 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=746) failed. Traceback (most recent call last): File "", line 17, in File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/init.py", line 335, in run get_driver().run(*args, *kwargs) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/drivers/none.py", line 56, in run loop.run_until_complete(self._serve()) File "/usr/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete self.run_forever() File "/usr/lib/python3.11/asyncio/base_events.py", line 607, in run_forever self._run_once() File "/usr/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once handle._run() File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, self._args) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/message.py", line 476, in check_and_run_matcher await _run_matcher(

File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/message.py", line 428, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run await handler( File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/dependencies/init.py", line 94, in call return await cast(Callable[..., Awaitable[R]], self.call)(**values) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot_plugin_mystool/command/plan.py", line 756, in weibo_schedule await weibo_code_check(user=user, user_ids=[user_id], matcher=matcher) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot_plugin_mystool/command/plan.py", line 663, in weibo_code_check weibo = WeiboCode(user) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot_plugin_mystool/api/weibo.py", line 46, in init self.cookie = cookie_to_dict(account.weibo_cookie) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot_plugin_mystool/api/weibo.py", line 13, in cookie_to_dict cookie = dict([line.strip().split('=', 1) for line in cookie.split(';')]) 这是之前的cookie有=和 ; 我删了用空格分开SUP和SUBP就AttributeError: 'str' object has no attribute 'domain'

dontdot commented 5 months ago

cookie得通过cookie_to_dict由str转成dict,cookie格式得要xxx=aaa;xxx=bbb;这样

dontdot commented 5 months ago

cookie从网页上扒的值是什么样子就什么样子,不用改

duki-web commented 5 months ago

cookie从网页上扒的值是什么样子就什么样子,不用改

05-14 11:34:02 [INFO] nonebot_plugin_mystool | 开始获取微博兑换码ticket_id 05-14 11:34:05 [INFO] nonebot_plugin_mystool | 原神超话当前没有兑换码 05-14 11:34:12 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=746) running complete 05-14 11:34:12 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=746) failed. Traceback (most recent call last): File "", line 17, in File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/init.py", line 335, in run get_driver().run(*args, kwargs) ............................................................. self._extract_guild_image(message=message), File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/adapters/qq/bot.py", line 307, in _extract_guild_image kwargs["image"] = image[-1].data["url"] KeyError: 'url' 05-14 11:34:12 [DEBUG] nonebot | Stop event propagation 05-14 11:34:12 [DEBUG] nonebot | Checking for matchers completed 应该这种报错是正常的吧?

dontdot commented 5 months ago

有报错就不正常,你用的版本是什么,最新的stable吗

dontdot commented 5 months ago

星穹铁道的检查直接报错了都

dontdot commented 5 months ago

get_code_list(self):里 https://github.com/Ljzd-PRO/nonebot-plugin-mystool/blob/fa4b7aa0ba06519d2f0c2873d22c1b30464c3f71/src/nonebot_plugin_mystool/api/weibo.py#L102 这下面加一行logger.debug(ticket_id)看下输出什么

duki-web commented 5 months ago

05-14 12:08:39 [DEBUG] nonebot | Running handler Dependent(call=weibo_schedule) 05-14 12:08:39 [INFO] nonebot_plugin_mystool | 开始获取微博兑换码ticket_id 05-14 12:08:42 [INFO] nonebot_plugin_mystool | 原神超话当前没有兑换码 05-14 12:08:44 [DEBUG] nonebot_plugin_mystool | {'崩铁': {'id': ['3091', '3092', '3093'], 'img': 'http://n.sinaimg.cn/default/8c2ed5e0/20240506/bengtiefakaicon2.png'}} 05-14 12:08:50 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=746) running complete 05-14 12:08:50 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=746) failed. Traceback (most recent call last): File "", line 17, in File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/init.py", line 335, in run get_driver().run(*args, *kwargs) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/drivers/none.py", line 56, in run loop.run_until_complete(self._serve()) File "/usr/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete self.run_forever() File "/usr/lib/python3.11/asyncio/base_events.py", line 607, in run_forever self._run_once() File "/usr/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once handle._run() File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, self._args) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/message.py", line 476, in check_and_run_matcher await _run_matcher(

File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/message.py", line 428, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run await handler( File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/dependencies/init.py", line 94, in call return await cast(Callable[..., Awaitable[R]], self.call)(values) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot_plugin_mystool/command/plan.py", line 756, in weibo_schedule await weibo_code_check(user=user, user_ids=[user_id], matcher=matcher) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot_plugin_mystool/command/plan.py", line 678, in weibo_code_check await matcher.send(messages) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 566, in send return await bot.send(event=event, message=_message, kwargs) File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/adapters/qq/bot.py", line 483, in send return await self.send_to_dms( File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/adapters/qq/bot.py", line 354, in send_to_dms **self._extract_guild_image(message=message), File "/root/makl/.venv/lib/python3.11/site-packages/nonebot/adapters/qq/bot.py", line 307, in _extract_guild_image kwargs["image"] = image[-1].data["url"] KeyError: 'url' 05-14 12:08:50 [DEBUG] nonebot | Stop event propagation 05-14 12:08:50 [DEBUG] nonebot | Checking for matchers completed

duki-web commented 5 months ago

服务器是德国ip

dontdot commented 5 months ago

其他功能你能正常在qq接收消息吗,还是只有微博功能不行,我感觉是图片的处理那里有问题 https://github.com/Ljzd-PRO/nonebot-plugin-mystool/blob/fa4b7aa0ba06519d2f0c2873d22c1b30464c3f71/src/nonebot_plugin_mystool/command/plan.py#L674-L675 你把674注释掉,675改成messages = msg再试试,还是不行可能就是适配器的问题

duki-web commented 5 months ago

其他功能你能正常在qq接收消息吗,还是只有微博功能不行,我感觉是图片的处理那里有问题

https://github.com/Ljzd-PRO/nonebot-plugin-mystool/blob/fa4b7aa0ba06519d2f0c2873d22c1b30464c3f71/src/nonebot_plugin_mystool/command/plan.py#L674-L675

你把674注释掉,675改成messages = msg再试试,还是不行可能就是适配器的问题

capture_20240514225140715 capture_20240514225334599 感觉还有点问题。

dontdot commented 5 months ago

我看终端是没有报错了,qq也是能收到消息推送了吧,那就是图片的处理出问题了,不知道是不是get_file这一步这里,你可以尝试用国内的电脑进行尝试看看img还会不会报错

duki-web commented 5 months ago

我看终端是没有报错了,qq也是能收到消息推送了吧,那就是图片的处理出问题了,不知道是不是get_file这一步这里,你可以尝试用国内的电脑进行尝试看看img还会不会报错

05-15 11:43:41 [DEBUG] nonebot | Checking for matchers in priority 1... 05-15 11:43:41 [DEBUG] nonebot | Checking for matchers in priority 4... 05-15 11:43:41 [DEBUG] nonebot | Checking for matchers in priority 5... 05-15 11:43:41 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=746) 05-15 11:43:41 [DEBUG] nonebot | Running Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=746) 05-15 11:43:41 [DEBUG] nonebot | Running handler Dependent(call=weibo_schedule) 05-15 11:43:41 [INFO] nonebot_plugin_mystool | 开始获取微博兑换码ticket_id 05-15 11:43:43 [DEBUG] nonebot | QQ | Bot 102111520 calling API get_channels 05-15 11:43:46 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=746) running complete 05-15 11:43:46 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=746) failed. Traceback (most recent call last): File "/root/amki/.venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exceptions yield File "/root/amki/.venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 373, in handle_async_request resp = await self._pool.handle_async_request(req) File "/root/amki/.venv/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 216, in handle_async_request raise exc from None File "/root/amki/.venv/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 196, in handle_async_request response = await connection.handle_async_request( File "/root/amki/.venv/lib/python3.11/site-packages/httpcore/_async/connection.py", line 99, in handle_async_request raise exc File "/root/amki/.venv/lib/python3.11/site-packages/httpcore/_async/connection.py", line 76, in handle_async_request stream = await self._connect(request) File "/root/amki/.venv/lib/python3.11/site-packages/httpcore/_async/connection.py", line 122, in _connect stream = await self._network_backend.connect_tcp(**kwargs) File "/root/amki/.venv/lib/python3.11/site-packages/httpcore/_backends/auto.py", line 30, in connect_tcp return await self._backend.connect_tcp( File "/root/amki/.venv/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 114, in connect_tcp with map_exceptions(exc_map): File "/usr/lib/python3.11/contextlib.py", line 155, in exit self.gen.throw(typ, value, traceback) File "/root/amki/.venv/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ConnectTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "", line 17, in File "/root/amki/.venv/lib/python3.11/site-packages/nonebot/init.py", line 335, in run get_driver().run(*args, *kwargs) File "/root/amki/.venv/lib/python3.11/site-packages/nonebot/drivers/none.py", line 56, in run loop.run_until_complete(self._serve()) File "/usr/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete self.run_forever() File "/usr/lib/python3.11/asyncio/base_events.py", line 607, in run_forever self._run_once() File "/usr/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once handle._run() File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, self._args) File "/root/amki/.venv/lib/python3.11/site-packages/nonebot/message.py", line 476, in check_and_run_matcher await _run_matcher(

File "/root/amki/.venv/lib/python3.11/site-packages/nonebot/message.py", line 428, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "/root/amki/.venv/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "/root/amki/.venv/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run await handler( File "/root/amki/.venv/lib/python3.11/site-packages/nonebot/dependencies/init.py", line 94, in call return await cast(Callable[..., Awaitable[R]], self.call)(**values) File "/root/amki/.venv/lib/python3.11/site-packages/nonebot_plugin_mystool/command/plan.py", line 756, in weibo_schedule await weibo_code_check(user=user, user_ids=[user_id], matcher=matcher) File "/root/amki/.venv/lib/python3.11/site-packages/nonebot_plugin_mystool/command/plan.py", line 664, in weibo_code_check result = await weibo.get_code_list() File "/root/amki/.venv/lib/python3.11/site-packages/nonebot_plugin_mystool/api/weibo.py", line 102, in get_code_list ticket_id = await self.get_ticket_id # 有活动则返回一个dict,没活动则返回一个str File "/root/amki/.venv/lib/python3.11/site-packages/nonebot_plugin_mystool/api/weibo.py", line 63, in get_ticket_id response = await client.get(url) File "/root/amki/.venv/lib/python3.11/site-packages/httpx/_client.py", line 1801, in get return await self.request( File "/root/amki/.venv/lib/python3.11/site-packages/httpx/_client.py", line 1574, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) File "/root/amki/.venv/lib/python3.11/site-packages/httpx/_client.py", line 1661, in send response = await self._send_handling_auth( File "/root/amki/.venv/lib/python3.11/site-packages/httpx/_client.py", line 1689, in _send_handling_auth response = await self._send_handling_redirects( File "/root/amki/.venv/lib/python3.11/site-packages/httpx/_client.py", line 1726, in _send_handling_redirects response = await self._send_single_request(request) File "/root/amki/.venv/lib/python3.11/site-packages/httpx/_client.py", line 1763, in _send_single_request response = await transport.handle_async_request(request) File "/root/amki/.venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 372, in handle_async_request with map_httpcore_exceptions(): File "/usr/lib/python3.11/contextlib.py", line 155, in exit self.gen.throw(typ, value, traceback) File "/root/amki/.venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectTimeout 05-15 11:43:46 [DEBUG] nonebot | Stop event propagation 05-15 11:43:46 [DEBUG] nonebot | Checking for matchers completed 大佬,国内本地电脑,报错连接超时

dontdot commented 5 months ago

https://m.weibo.cn/api/container/getIndex?containerid={container_id}_-_activity_list国内电脑能用浏览器成功访问这个链接吗,{container_id}随便替换成文件里提供的一个,不然就是电脑本地网络问题

duki-web commented 5 months ago

https://m.weibo.cn/api/container/getIndex?containerid={container_id}_-_activity_list国内电脑能用浏览器成功访问这个链接吗,{container_id}随便替换成文件里提供的一个,不然就是电脑本地网络问题

浏览器访问的, { "ok": 0, "msg": "这里还没有内容", "data": { "cards": [] } }

本地ping的 root@4fi:~# ping m.weibo.cn PING weibo.com (111.13.225.83) 56(84) bytes of data. 64 bytes from 111.13.225.83 (111.13.225.83): icmp_seq=1 ttl=53 time=52.1 ms 64 bytes from 111.13.225.83 (111.13.225.83): icmp_seq=2 ttl=53 time=45.4 ms 又跑了一遍
raise mapped_exc(message) from exc httpx.ConnectTimeout 但是我挂代理就不会,好奇怪

dontdot commented 5 months ago

requests.get请求呢

duki-web commented 5 months ago

用requests请求是可以的,但是要怎么改呢?

dontdot commented 5 months ago

https://github.com/Ljzd-PRO/nonebot-plugin-mystool/blob/fa4b7aa0ba06519d2f0c2873d22c1b30464c3f71/src/nonebot_plugin_mystool/api/weibo.py#L62-L64 三行改成下面这样,另外需要import jsonimport requests

response = requests.get(url)
responses = json.loads(response.text)

但是用requeses请求不算很好,不支持异步的

duki-web commented 5 months ago

https://github.com/Ljzd-PRO/nonebot-plugin-mystool/blob/fa4b7aa0ba06519d2f0c2873d22c1b30464c3f71/src/nonebot_plugin_mystool/api/weibo.py#L62-L64

三行改成下面这样,另外需要 和import json``import requests

response = requests.get(url)
responses = json.loads(response.text)

但是用requeses请求不算很好,不支持异步的

对啊,之前我改了很多次都报错。 现在好了,给每个 requests.get 调用创建一个 executor 任务,并使用 asyncio.gather 来等待所有任务完成。这样,就可以在异步函数中使用 requests 而不会阻塞整个应用程序。使用 ThreadPoolExecutor 来异步执行 requests 的同步调用。添加了 get_code_list 和 get_code 两个新的异步方法。get_code_list 方法使用 get_ticket_id 方法获取的 ticket_id 数据,并为每个 id 调用 get_code 方法来获取兑换码。get_code 方法则负责实际获取单个兑换码的逻辑。 这是输出日志 05-17 16:29:59 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=745) 05-17 16:29:59 [DEBUG] nonebot | Running Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=745) 05-17 16:29:59 [DEBUG] nonebot | Running handler Dependent(call=weibo_schedule) 05-17 16:29:59 [INFO] nonebot_plugin_mystool | 开始获取兑换码列表 05-17 16:29:59 [INFO] nonebot_plugin_mystool | 开始获取微博兑换码ticket_id 05-17 16:30:05 [INFO] nonebot_plugin_mystool | 原神超话当前没有兑换码 05-17 16:30:05 [INFO] nonebot_plugin_mystool | 崩铁超话当前没有兑换码 05-17 16:30:05 [DEBUG] nonebot | QQ | Bot 1xxxxxxxx0 calling API post_dms_messages 05-17 16:30:11 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=745) running complete 05-17 16:30:11 [DEBUG] nonebot | Stop event propagation 05-17 16:30:11 [DEBUG] nonebot | Checking for matchers complete

谢谢大佬提供修改思路,等待大佬做好多账号适配。

duki-web commented 4 months ago

06-01 13:55:01 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=665) running complete 06-01 13:55:01 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=665) failed. Traceback (most recent call last): File "", line 17, in File "/root/niku/.venv/lib/python3.9/site-packages/nonebot/init.py", line 335, in run get_driver().run(*args, *kwargs) File "/root/niku/.venv/lib/python3.9/site-packages/nonebot/drivers/none.py", line 56, in run loop.run_until_complete(self._serve()) File "/usr/lib/python3.9/asyncio/base_events.py", line 629, in run_until_complete self.run_forever() File "/usr/lib/python3.9/asyncio/base_events.py", line 596, in run_forever self._run_once() File "/usr/lib/python3.9/asyncio/base_events.py", line 1890, in _run_once handle._run() File "/usr/lib/python3.9/asyncio/events.py", line 80, in _run self._context.run(self._callback, self._args) File "/root/niku/.venv/lib/python3.9/site-packages/nonebot/message.py", line 476, in check_and_run_matcher await _run_matcher(

File "/root/niku/.venv/lib/python3.9/site-packages/nonebot/message.py", line 428, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "/root/niku/.venv/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "/root/niku/.venv/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run await handler( File "/root/niku/.venv/lib/python3.9/site-packages/nonebot/dependencies/init.py", line 94, in call return await cast(Callable[..., Awaitable[R]], self.call)(**values) File "/root/niku/.venv/lib/python3.9/site-packages/nonebot_plugin_mystool/command/plan.py", line 672, in weibo_sign await weibo_sign_check(user=user, user_ids=[user_id], matcher=matcher) File "/root/niku/.venv/lib/python3.9/site-packages/nonebot_plugin_mystool/command/plan.py", line 682, in weibo_sign_check msg = await WeiboSign.sign(user_data) File "/root/niku/.venv/lib/python3.9/site-packages/nonebot_plugin_mystool/api/weibo.py", line 234, in sign param_d = Tool.cookie_to_dict(wb_userdata['params']) File "/root/niku/.venv/lib/python3.9/site-packages/nonebot_plugin_mystool/api/weibo.py", line 17, in cookie_to_dict cookie = dict([line.strip().split('=', 1) for line in cookie.split(';')]) ValueError: dictionary update sequence element #4 has length 1; 2 is required

更新版本后,大佬这又是啥情况?

dontdot commented 4 months ago

重新设置一下,要适配多账号改了参数格式

duki-web commented 4 months ago

重新设置一下,要适配多账号改了参数格式

就是按照机器人的参数格式添加的,weibo_cookie都是SUB=;SUBP=,weibo_params是aid、from、gsid、s用 ; 隔开,末尾没有 ; 。运行 /wb签到 就这样报错了

dontdot commented 4 months ago

data.json截图看看,记得打码

duki-web commented 4 months ago

data.json截图看看,记得打码

06-01 19:08:23 [INFO] nonebot_plugin_mystool | 开始获取微博兑换码ticket_id 06-01 19:08:28 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=652) running complete 06-01 19:08:28 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_mystool.command.plan, lineno=652) failed. Traceback (most recent call last): File "/root/niku/.venv/lib/python3.9/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exceptions yield File "/root/niku/.venv/lib/python3.9/site-packages/httpx/_transports/default.py", line 373, in handle_async_request resp = await self._pool.handle_async_request(req) File "/root/niku/.venv/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 216, in handle_async_request raise exc from None File "/root/niku/.venv/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 196, in handle_async_request response = await connection.handle_async_request( File "/root/niku/.venv/lib/python3.9/site-packages/httpcore/_async/connection.py", line 99, in handle_async_request raise exc File "/root/niku/.venv/lib/python3.9/site-packages/httpcore/_async/connection.py", line 76, in handle_async_request stream = await self._connect(request) File "/root/niku/.venv/lib/python3.9/site-packages/httpcore/_async/connection.py", line 122, in _connect stream = await self._network_backend.connect_tcp(*kwargs) File "/root/niku/.venv/lib/python3.9/site-packages/httpcore/_backends/auto.py", line 30, in connect_tcp return await self._backend.connect_tcp( File "/root/niku/.venv/lib/python3.9/site-packages/httpcore/_backends/anyio.py", line 123, in connect_tcp stream._raw_socket.setsockopt(option) # type: ignore[attr-defined] # pragma: no cover File "/usr/lib/python3.9/contextlib.py", line 135, in exit self.gen.throw(type, value, traceback) File "/root/niku/.venv/lib/python3.9/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ConnectTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/root/niku/.venv/lib/python3.9/site-packages/nonebot/message.py", line 476, in check_and_run_matcher await _run_matcher(

File "/root/niku/.venv/lib/python3.9/site-packages/nonebot/message.py", line 428, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "/root/niku/.venv/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "/root/niku/.venv/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run await handler( File "/root/niku/.venv/lib/python3.9/site-packages/nonebot/dependencies/init.py", line 94, in call return await cast(Callable[..., Awaitable[R]], self.call)(**values) File "/root/niku/.venv/lib/python3.9/site-packages/nonebot_plugin_mystool/command/plan.py", line 662, in weibo_code await weibo_code_check(user=user, user_ids=[user_id], matcher=matcher) File "/root/niku/.venv/lib/python3.9/site-packages/nonebot_plugin_mystool/command/plan.py", line 703, in weibo_code_check result = await weibo.get_code_list() File "/root/niku/.venv/lib/python3.9/site-packages/nonebot_plugin_mystool/api/weibo.py", line 110, in get_code_list ticket_id = await self.get_ticket_id # 有活动则返回一个dict,没活动则返回一个str File "/root/niku/.venv/lib/python3.9/site-packages/nonebot_plugin_mystool/api/weibo.py", line 71, in get_ticket_id response = await client.get(url) File "/root/niku/.venv/lib/python3.9/site-packages/httpx/_client.py", line 1801, in get return await self.request( File "/root/niku/.venv/lib/python3.9/site-packages/httpx/_client.py", line 1574, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) File "/root/niku/.venv/lib/python3.9/site-packages/httpx/_client.py", line 1661, in send response = await self._send_handling_auth( File "/root/niku/.venv/lib/python3.9/site-packages/httpx/_client.py", line 1689, in _send_handling_auth response = await self._send_handling_redirects( File "/root/niku/.venv/lib/python3.9/site-packages/httpx/_client.py", line 1726, in _send_handling_redirects response = await self._send_single_request(request) File "/root/niku/.venv/lib/python3.9/site-packages/httpx/_client.py", line 1763, in _send_single_request response = await transport.handle_async_request(request) File "/root/niku/.venv/lib/python3.9/site-packages/httpx/_transports/default.py", line 373, in handle_async_request resp = await self._pool.handle_async_request(req) File "/usr/lib/python3.9/contextlib.py", line 135, in exit self.gen.throw(type, value, traceback) File "/root/niku/.venv/lib/python3.9/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectTimeout

重新跑了下, 就又这样报错了。。。。。。。。。

dontdot commented 4 months ago

网络问题不知道怎么解决