Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

禁言用户新增的参数,添加默认数值,以方便旧版本适配 #859

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

TZFC
Copy link
Contributor

@TZFC TZFC commented Nov 30, 2024

添加默认数值-1,这样其它使用这个函数的项目不用修改代码。-1为永久禁言,与之前效果相同

@TZFC
Copy link
Contributor Author

TZFC commented Dec 2, 2024

另外:在解封用户的函数里添加了visit_id参数。没有这个会导致解封失败 #571
添加这个参数后可以解封成功:https://colab.research.google.com/drive/1IVvuwtkoTujJ9NcP8Z_i1ge7yFgWsLZf?usp=sharing
怪了,从colab操作,不加这个参数也行。但是从本地操作就不行,报错:

result = sync(room.unban_user(20052482))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/env/lib/python3.11/site-packages/bilibili_api/utils/sync.py", line 33, in sync
    return loop.run_until_complete(coroutine)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/ubuntu/env/lib/python3.11/site-packages/bilibili_api/live.py", line 460, in unban_user
    return await Api(**api, credential=self.credential).update_data(**data).result
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/env/lib/python3.11/site-packages/bilibili_api/utils/network.py", line 170, in result
    self.__result = await self.request()
                    ^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/env/lib/python3.11/site-packages/bilibili_api/utils/network.py", line 70, in inner
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/env/lib/python3.11/site-packages/bilibili_api/utils/network.py", line 331, in request
    raise ResponseCodeException(code, msg, resp_data)
bilibili_api.exceptions.ResponseCodeException.ResponseCodeException: 接口返回错误代码:1,信息:参数错误。
{'code': 1, 'msg': '参数错误', 'message': '参数错误', 'data': []}

区别是报错的是16.1.1版本,用现在的dev分支就没这个问题了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant