HibiKier/nonebot_plugin_gamedraw

Bug: sample() got an unexpected keyword argument 'counts'

abrahum opened this issue · 1 comments

使用中报错:

> File "/usr/local/lib/python3.8/dist-packages/nonebot/message.py", line 154, in _run_matcher
    await matcher.run(bot, event, state)
          │       │   │    │      └ {'_prefix': {'raw_command': None, 'command': None}, '_suffix': {'raw_command': None, 'command': None}, '_matched': '赛马娘10抽', ...
          │       │   │    └ PrivateMessageEvent(time=1621578618, self_id=917767625, post_type='message', sub_type='friend', user_id=307887491, message_ty...
          │       │   └ <nonebot.adapters.cqhttp.bot.Bot object at 0x7f75e8838bb0>
          │       └ <function Matcher.run at 0x7f75f336d280>
          └ <Matcher from nonebot_plugin_gamedraw, type=message, priority=5, temp=False>

  File "/usr/local/lib/python3.8/dist-packages/nonebot/matcher.py", line 544, in run
    await handler(self, bot, event, state_)
          │       │     │    │      └ {'_prefix': {'raw_command': None, 'command': None}, '_suffix': {'raw_command': None, 'command': None}, '_matched': '赛马娘10抽', ...
          │       │     │    └ PrivateMessageEvent(time=1621578618, self_id=917767625, post_type='message', sub_type='friend', user_id=307887491, message_ty...
          │       │     └ <nonebot.adapters.cqhttp.bot.Bot object at 0x7f75e8838bb0>
          │       └ <Matcher from nonebot_plugin_gamedraw, type=message, priority=5, temp=False>
          └ <Handler _(bot: <class 'nonebot.adapters.cqhttp.bot.Bot'>, event: <class 'nonebot.adapters.cqhttp.event.MessageEvent'>, state...

  File "/usr/local/lib/python3.8/dist-packages/nonebot/handler.py", line 81, in __call__
    await self.func(
          │    └ <function _ at 0x7f75ec327d30>
          └ <Handler _(bot: <class 'nonebot.adapters.cqhttp.bot.Bot'>, event: <class 'nonebot.adapters.cqhttp.event.MessageEvent'>, state...

  File "/usr/local/lib/python3.8/dist-packages/nonebot_plugin_gamedraw/__init__.py", line 121, in _
    await pretty.send(await pretty_draw(num, pool_name), at_sender=True)
          │      │          │           │    └ 'horse'
          │      │          │           └ 10
          │      │          └ <function pretty_draw at 0x7f75ec3270d0>
          │      └ <classmethod object at 0x7f75f33d6700>
          └ <Matcher from nonebot_plugin_gamedraw, type=message, priority=5, temp=False>

  File "/usr/local/lib/python3.8/dist-packages/nonebot_plugin_gamedraw/pretty_handle.py", line 28, in pretty_draw
    obj_list, obj_dict, three_list, star_list, three_olist = _format_card_information(count, pool_name)
                                                             │                        │      └ 'horse'
                                                             │                        └ 10
                                                             └ <function _format_card_information at 0x7f75ec327550>

  File "/usr/local/lib/python3.8/dist-packages/nonebot_plugin_gamedraw/pretty_handle.py", line 90, in _format_card_information
    obj, code = _get_pretty_card(pool_name)
                │                └ 'horse'
                └ <function _get_pretty_card at 0x7f75ec3274c0>

  File "/usr/local/lib/python3.8/dist-packages/nonebot_plugin_gamedraw/pretty_handle.py", line 74, in _get_pretty_card
    star = random.sample([3, 2, 1],
           │      └ <bound method Random.sample of <random.Random object at 0x22555a0>>
           └ <module 'random' from '/usr/lib/python3.8/random.py'>

TypeError: sample() got an unexpected keyword argument 'counts'

Ubuntu 20.04
Python 3.8.5
Nonebot 2.0.0a13.post1

错误原因:需要python 3.9 以上

修复:已经重构向下兼容的方法,对包进行升级即可