<small id='3rfBq'></small><noframes id='3rfBq'>

      <bdo id='3rfBq'></bdo><ul id='3rfBq'></ul>

    1. <legend id='3rfBq'><style id='3rfBq'><dir id='3rfBq'><q id='3rfBq'></q></dir></style></legend>

      <i id='3rfBq'><tr id='3rfBq'><dt id='3rfBq'><q id='3rfBq'><span id='3rfBq'><b id='3rfBq'><form id='3rfBq'><ins id='3rfBq'></ins><ul id='3rfBq'></ul><sub id='3rfBq'></sub></form><legend id='3rfBq'></legend><bdo id='3rfBq'><pre id='3rfBq'><center id='3rfBq'></center></pre></bdo></b><th id='3rfBq'></th></span></q></dt></tr></i><div id='3rfBq'><tfoot id='3rfBq'></tfoot><dl id='3rfBq'><fieldset id='3rfBq'></fieldset></dl></div>

    2. <tfoot id='3rfBq'></tfoot>

      Discord.py 缺少必需的参数

      时间:2023-09-09

      1. <tfoot id='k6Zyt'></tfoot>
      2. <i id='k6Zyt'><tr id='k6Zyt'><dt id='k6Zyt'><q id='k6Zyt'><span id='k6Zyt'><b id='k6Zyt'><form id='k6Zyt'><ins id='k6Zyt'></ins><ul id='k6Zyt'></ul><sub id='k6Zyt'></sub></form><legend id='k6Zyt'></legend><bdo id='k6Zyt'><pre id='k6Zyt'><center id='k6Zyt'></center></pre></bdo></b><th id='k6Zyt'></th></span></q></dt></tr></i><div id='k6Zyt'><tfoot id='k6Zyt'></tfoot><dl id='k6Zyt'><fieldset id='k6Zyt'></fieldset></dl></div>
            • <bdo id='k6Zyt'></bdo><ul id='k6Zyt'></ul>

                <legend id='k6Zyt'><style id='k6Zyt'><dir id='k6Zyt'><q id='k6Zyt'></q></dir></style></legend>

                <small id='k6Zyt'></small><noframes id='k6Zyt'>

                  <tbody id='k6Zyt'></tbody>
                本文介绍了Discord.py 缺少必需的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我有一个重写版本 discord.py.如果消息有内容,则不会发生错误.我需要如果消息没有内容,则不会发生错误.

                I have a rewrite version discord.py.If message have content, error does not happened.I need that error does not happened if message have not content.

                我的代码:

                    @client.command(pass_context = True)
                    def async search(ctx,message):
                    ...
                    some code 
                    ...
                         if members_count < voice_channel.user_limit:
                                        message.content += ' '
                                        print(message.content)
                
                                        invite = await channel.create_invite(max_age=0)
                                        avatar = user.avatar_url
                                        if message == '':
                                            message_for_emb = 'u200b'
                                        elif message != '':
                                            message_for_emb = ':white_small_square: {}'.format(message)
                                        if user.default_avatar_url == avatar:
                                            avatar = 'https://i.imgur.com/XjeDXnB.png'
                                        embed = discord.Embed(description=members, colour=discord.Embed.Empty)
                                        embed.set_author(name='В поисках +{} в {}  {}'.format((voice_channel.user_limit - members_count),
                                                                                          voice_channel.category.name,voice_channel.name), icon_url=avatar)
                                        embed.add_field(name=message_for_emb,
                                                        value='Зайти: {} :white_check_mark:'.format(invite.url), inline=False)
                                        await channel.send(embed=embed)
                

                完整的追溯:

                Ignoring exception in command search:
                Traceback (most recent call last):
                  File "C:UsersДаниилPycharmProjectsdiscordbotvenvlibsite-packagesdiscordextcommandsot.py", line 886, in invoke
                    yield from ctx.command.invoke(ctx)
                  File "C:UsersДаниилPycharmProjectsdiscordbotvenvlibsite-packagesdiscordextcommandscore.py", line 491, in invoke
                    yield from self.prepare(ctx)
                  File "C:UsersДаниилPycharmProjectsdiscordbotvenvlibsite-packagesdiscordextcommandscore.py", line 455, in prepare
                    yield from self._parse_arguments(ctx)
                  File "C:UsersДаниилPycharmProjectsdiscordbotvenvlibsite-packagesdiscordextcommandscore.py", line 369, in _parse_arguments
                    transformed = yield from self.transform(ctx, param)
                  File "C:UsersДаниилPycharmProjectsdiscordbotvenvlibsite-packagesdiscordextcommandscore.py", line 249, in transform
                    raise MissingRequiredArgument(param)
                discord.ext.commands.errors.MissingRequiredArgument: message is a required argument that is missing.
                

                推荐答案

                命令解析参数的方式意味着定义

                The way commands parse arguments means that defining

                async def search(ctx, message):
                

                意味着 search 需要一个词 message 作为命令调用的一部分.如果您想捕获消息的其余部分,则可以使用仅关键字参数语法:

                means that search requires a word message as part of the command invocation. If you instead want to capture the remainder of the message, you can use the keyword-only argument syntax:

                async def search(ctx, *, message)
                

                此功能记录在此处.

                这篇关于Discord.py 缺少必需的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:discord.py - 命令引发异常:OpusNotLoaded 下一篇:获取所有成员 discord.py

                相关文章

                最新文章

                1. <legend id='JOfGd'><style id='JOfGd'><dir id='JOfGd'><q id='JOfGd'></q></dir></style></legend>

                    <bdo id='JOfGd'></bdo><ul id='JOfGd'></ul>
                  <i id='JOfGd'><tr id='JOfGd'><dt id='JOfGd'><q id='JOfGd'><span id='JOfGd'><b id='JOfGd'><form id='JOfGd'><ins id='JOfGd'></ins><ul id='JOfGd'></ul><sub id='JOfGd'></sub></form><legend id='JOfGd'></legend><bdo id='JOfGd'><pre id='JOfGd'><center id='JOfGd'></center></pre></bdo></b><th id='JOfGd'></th></span></q></dt></tr></i><div id='JOfGd'><tfoot id='JOfGd'></tfoot><dl id='JOfGd'><fieldset id='JOfGd'></fieldset></dl></div>
                2. <small id='JOfGd'></small><noframes id='JOfGd'>

                  <tfoot id='JOfGd'></tfoot>