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

      <tfoot id='FLmep'></tfoot>

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

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

        Python - 在用户加入时发送消息

        时间:2023-10-11

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

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

              <tfoot id='hFAas'></tfoot>
                • <bdo id='hFAas'></bdo><ul id='hFAas'></ul>
                  本文介绍了Python - 在用户加入时发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  所以,我正在尝试使用最新版本的 Discord.Py 和 Python 3.6.4 来检测用户何时加入,它会向他们发送一条欢迎他们的消息.我的代码如下:

                  So, I am trying in the latest version of Discord.Py and Python 3.6.4 to detect when a user joins, it will send a message to them welcoming them. My code is as follows:

                  @client.event
                  async def on_member_join(member):
                      await client.send_message(member,"Welcome!")
                  

                  这段代码似乎不起作用,我已经查看了其他人是如何做到的,但是代码已经过时了,在 API 上也找不到关于我将如何做到这一点的任何内容.任何帮助表示赞赏!

                  This code doesn't seem to work, I have looked up already on how others did it but the code is outdated, couldn't find anything on the API either on how I would do this. Any help is appreciated!

                  主要好的,所以代码工作正常,但我收到 403 权限错误.Bot 以 FULL PERMISSIONS 重新邀请,并且在服务器中具有 FULL PERMISSIONS.所以我不知道为什么会这样.机器人可以随时随地发送消息,但不是专门在 on_memer_join(member) 下发送消息...为什么?

                  MAJOR Okay, so the code works fine but I'm getting a 403 Permissions Error. The Bot was re-invited with FULL PERMISSIONS and in server has FULL PERMISSIONS. So I have no idea why this is happening. The bot can send messages anytime anywhere but not specifically under the on_memer_join(member) ... why?

                  推荐答案

                  Discord.py的重写版本,需要开启Intents

                  For the Rewritten version of Discord.py, You need to enable Intents

                  
                  intents = discord.Intents.all()
                  client = Bot.commands(command_prefix = '', intents = intents)
                  
                  async def on_member_join(member):
                      await member.send('Welcome!')
                  

                  您还必须在机器人应用程序中启用意图.抱歉,这是一个迟到的评论.

                  You must enable intents in your bot application as well. Sorry this is a late comment.

                  这篇关于Python - 在用户加入时发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Discord.py 狙击命令 下一篇:在 Django 中运行 Discord 机器人

                  相关文章

                  最新文章

                  <legend id='3ggpE'><style id='3ggpE'><dir id='3ggpE'><q id='3ggpE'></q></dir></style></legend><tfoot id='3ggpE'></tfoot>

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