<legend id='oBj5m'><style id='oBj5m'><dir id='oBj5m'><q id='oBj5m'></q></dir></style></legend>
    • <bdo id='oBj5m'></bdo><ul id='oBj5m'></ul>
    1. <tfoot id='oBj5m'></tfoot>

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

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

        guild.members 无法正常工作 discord.py

        时间:2023-09-09

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

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

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

                  本文介绍了guild.members 无法正常工作 discord.py的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试使用 discord.py

                  我的代码是:

                  @client.command()
                  async def members(ctx):
                      
                      members = ctx.guild.members
                  
                      for member in members:
                  
                          await ctx.send(member.name)
                  
                      await ctx.send("done")
                  

                  但问题是它只发送机器人的名称.如果您弄清楚代码中的问题是什么,那么您能帮帮我吗,我想要所有成员的名字.

                  But the problem is it's sending the name of the bot only. If you figure out what's the problem in the code then can you pls help me, I want the name of all members.

                  推荐答案

                  我给你一个简单的答案,让你很好理解.

                  i'll give you a brief answer, so that you can understand very well.

                  在某种程度上,意图与权限相同

                  intents are as same as permissions, in a way

                  那么它们有什么用?如果您想在服务器中发生某些事件,则需要意图.有些可以仅通过脚本启用,有些意图如 presencemembers需要进入 discord 开发者门户并手动启用 + 在脚本中启用

                  so what is their use? intents are required if you wanna get certain events happening in server. some can be enabled just by the script, and some intents like presence and members require going to discord developer portal and manually enabling + enabling in script

                  所以您只需打开脚本并转到顶部,添加以下行:

                  so you just open your script and go to top, add these lines:

                  from discord.ext import commands
                  intents = discord.Intents(messages=True, members=True)
                  client = commands.Bot(command_prefix=commands.when_mentioned_or('prefix_here'), intents=intents)
                  

                  它正在使用命令,但您也可以将它与 discord.client 方法一起使用,这可以通过..

                  it is using commands, but you can also use this with the discord.client method too, which can be done by..

                  import discord
                  
                  intents = discord.Intents.all()
                  client = discord.Client(intents=intents)
                  

                  现在您尝试使用这些运行您的脚本:)

                  now you try to run your script with these :)

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

                  上一篇:FORBIDDEN(状态码:403)无法向该用户发送消息 下一篇:Discord.py:想要将 message.content 读取为小写,.lower

                  相关文章

                  最新文章

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

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

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