<tfoot id='KjuPo'></tfoot>

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

<legend id='KjuPo'><style id='KjuPo'><dir id='KjuPo'><q id='KjuPo'></q></dir></style></legend>
    • <bdo id='KjuPo'></bdo><ul id='KjuPo'></ul>

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

        Discord.py(重写)on_member_update 无法正常工作

        时间:2023-10-10

          <tbody id='zOSHe'></tbody>

          <bdo id='zOSHe'></bdo><ul id='zOSHe'></ul>
        • <small id='zOSHe'></small><noframes id='zOSHe'>

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

                1. <legend id='zOSHe'><style id='zOSHe'><dir id='zOSHe'><q id='zOSHe'></q></dir></style></legend>
                2. <tfoot id='zOSHe'></tfoot>
                  本文介绍了Discord.py(重写)on_member_update 无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我对 discord.py 包的 on_member_update 函数有疑问.我的问题是 on_member_update 函数仅在机器人本身更新(如角色更新)时触发,而不是在其他用户更新时触发(它应该如何工作).这是我的代码的细分:

                  I have a question about the on_member_update function of the discord.py package. My Issue is that the on_member_update function only triggers when the bot itself is updated (like a role update) and not when an other user is updated (how it's supposed to work). Here is a breakdown of my Code:

                  import discord
                  from discord.ext import commands
                  import sys
                  
                  
                  TOKEN = 'myToken'
                  BOT_PREFIX = '!'
                  
                  
                  
                  Intents = discord.Intents()
                  Intents.members = True
                  Intents.presences = True
                  
                  bot = commands.Bot(command_prefix=BOT_PREFIX, Intents = Intents)
                  
                  @bot.event
                  async def on_ready():
                      print("Logged in as: " + bot.user.name + "
                  ")
                  
                  @bot.event
                  async def on_member_update(before, after):
                      if str(before.status) == "online":
                          if str(after.status) == "offline":
                              print("{} has gone {}.".format(after.name,after.status))
                      else:
                          print("lol")
                  
                  @bot.command(pass_context=True)
                  async def stop(ctx):
                      await ctx.author.send("bot stopped")
                      sys.exit(0)
                  
                  bot.run(TOKEN)
                  

                  希望您知道如何让它发挥作用.感谢您的帮助!

                  Hope you have an idea how to make it work. Thank you for your help!

                  推荐答案

                  您应该从开发者门户为您的机器人启用存在意图,如下图所示.

                  You should enable the presences intents for your bot from the developers portal like in the image below.

                  discord 开发者门户

                  https://i.stack.imgur.com/cAn8m.png

                  这篇关于Discord.py(重写)on_member_update 无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Discord.py 在 vc 中获取用户分钟数 下一篇:Discord.py - 使用特定消息回复 DM

                  相关文章

                  最新文章

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

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

                      <tfoot id='mNwLW'></tfoot>