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

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

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

          <bdo id='jVpNy'></bdo><ul id='jVpNy'></ul>

      1. Discord.py member.server_default_channel 中的参数无效

        时间:2023-10-11
            <tbody id='IxUhw'></tbody>
            <bdo id='IxUhw'></bdo><ul id='IxUhw'></ul>

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

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

                  本文介绍了Discord.py member.server_default_channel 中的参数无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我当前的代码是

                  @client.event
                  async def on_member_join(member):
                      serverchannel = member.server.default_channel
                      msg = "Wuss poppin', {0}. Welcome to {1}".format(member.mention, member.server.name)
                      await client.send_message(member.server.default_channel, msg)`
                  
                  @client.event
                  async def on_member_remove(member):
                      serverchannel = member.server.default_channel
                      msg = "Well. Cya, {0}!".format(member.mention)
                      await client.send_message(serverchannel, msg)
                  

                  以及其他必要的行(如 import discord 等)和其他命令.

                  As well as the other necessary lines (like import discord etc.) and other commands.

                  当成员加入或离开时,我收到此错误:

                  When a member joins or leaves, I get this error:

                  Ignoring exception in on_member_join
                  Traceback (most recent call last):
                    File "C:UsersWillLAppDataLocalProgramsPythonPython36libsite-packagesdiscordclient.py", line 307, in _run_event
                      yield from getattr(self, event)(*args, **kwargs)
                    File "C:/Users/WillL/Desktop/MemzBot-master/index.py", line 102, in on_member_join
                      await client.send_message(member.server.default_channel, msg)
                    File "C:UsersWillLAppDataLocalProgramsPythonPython36libsite-packagesdiscordclient.py", line 1145, in send_message
                      channel_id, guild_id = yield from self._resolve_destination(destination)
                    File "C:UsersWillLAppDataLocalProgramsPythonPython36libsite-packagesdiscordclient.py", line 289, in _resolve_destination
                      raise InvalidArgument(fmt.format(destination))
                  discord.errors.InvalidArgument: Destination must be Channel, PrivateChannel, User, or Object. Received NoneType
                  

                  我不明白为什么,我错过了什么?

                  I don't understand why, what am I missing?

                  推荐答案

                  默认频道不再存在.这意味着两件事:

                  1. server.default_channel 可能返回 NoneType.
                  2. 尝试向 server 发送消息可能会引发 discord.NotFound.
                  1. server.default_channel may return a NoneType.
                  2. Trying to send a message to server may raise discord.NotFound.

                  这些情况将发生在 8 月 3 日之后创建的任何服务器上,或者任何已删除其默认"频道的服务器上.

                  These cases will happen on any servers created after August 3rd, or any servers who have deleted their "default" channel.

                  您需要自己选择一个频道,或者要求服务器为欢迎消息设置一个频道.您仍然可以尝试发送到服务器,但请确保您有一个失败的后备选项.

                  You need to either choose a channel yourself, or ask the server to set a channel for the welcome message. You can still attempt to send to the server, but make sure you have a fall back option if it fails.

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

                  上一篇:Discord.py - 如何使用此人的 ID 向某人发送私人消息 下一篇:如果消息被编辑,反发誓系统不起作用

                  相关文章

                  最新文章

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

                    • <bdo id='ED25n'></bdo><ul id='ED25n'></ul>

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

                    <tfoot id='ED25n'></tfoot>

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