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

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

      1. <tfoot id='T9qld'></tfoot>

        Mass DM 机器人工作正常,现在它不会发送消息

        时间:2023-09-11
          <tbody id='Ae6lb'></tbody>
          • <bdo id='Ae6lb'></bdo><ul id='Ae6lb'></ul>

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

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

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

                  <tfoot id='Ae6lb'></tfoot>
                • 本文介绍了Mass DM 机器人工作正常,现在它不会发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  几个月前,我和一个叫 Diggy 的人(来自这个社区)为我和一些朋友在 BlackDesert Online 上运行的公会编写了一个 MassDM 机器人.它工作得很好,直到 10 月 28 日停止发送 DM.一开始它只是将 DM 发送给一些具有指定角色的成员(105 个中的 3 个)

                  i coded a MassDM bot with a guy called Diggy (from this community) few months ago, for a guild that I and some friends run on BlackDesert Online. It was working just fine till October 28th when stopped sending the DMs. At the begining it just sent the DM to some members that had the specified role (3 out of 105)

                  现在我更新了 dicord.py,它不会将消息发送给任何人(有时只发送给其中一个,或者两个...有点随机)...

                  and now that I updated dicord.py, it sends the message to no one (and sometimes to just one of them, or two... is kinda random)...

                  discord 服务器中有 105 个用户,角色为Miembros"...

                  There are 105 users in that discord server with the role "Miembros"...

                  这里是代码...

                  bot = commands.Bot(command_prefix="+", case_insensitive=True)
                  bot.remove_command("help")
                   
                  @commands.has_permissions(administrator=True)
                  @bot.command()
                  async def announce(ctx, role: discord.Role, *, msg):
                      if ctx.channel.id == 708458959991865354:
                          members = [m for m in ctx.guild.members if role in m.roles]
                          count = 0
                          for m in members:
                              try:
                                  await m.send(msg)
                                  await ctx.send(f":white_check_mark: Mensaje enviado a {m}")
                                  count += 1
                              except:
                                  await ctx.send(f":x: No se pudo enviar el mensaje a {m}!")
                          await ctx.send(f"Hecho! {count} miembro{'' if count == 1 else 's'} notificados de un total de {len(members)}")
                      else:
                          await ctx.send("Este comando no esta permitido en este canal.")
                  
                  bot.run("...")
                  

                  一直在阅读文档并试图了解如何解决它,但我想我对 python 的了解很差.感谢您的帮助.

                  Been reading the documentation and trying to understand how to solve it, but I guess my knowledge in python is pretty poor. Thanks for the help.

                  推荐答案

                  我不确定,但您的问题可能是因为 Intents.在新版本的 discord.py(1.5.x) 中,有一些关于 Intents 的更新.Intents 类似于权限,你必须定义它来获取频道、成员和一些事件等.你必须在定义 bot = discord.Bot(prefix='') 之前定义它.p>

                  I'm not sure but your problem is probably because of Intents. In the new version of discord.py(1.5.x), there're some updates about Intents. Intents are similar to permissions, you have to define it to get channels, members and some events etc. You have to define it before defining the bot = discord.Bot(prefix='').

                  import discord
                  
                  intents = discord.Intents().all()
                  bot = discord.Bot(prefix='', intents=intents)
                  

                  如果你想获取更多关于 Intents 的信息,可以查看 API 参考.

                  If you want to get more information about Intents, you can look at the API References.

                  这篇关于Mass DM 机器人工作正常,现在它不会发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Discord.py on_member_join 不起作用,没有错误消息 下一篇:on_member_join 和删除不起作用.如何让它发挥作用

                  相关文章

                  最新文章

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

                    <tfoot id='HjmBg'></tfoot>

                    • <bdo id='HjmBg'></bdo><ul id='HjmBg'></ul>
                    1. <small id='HjmBg'></small><noframes id='HjmBg'>