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)
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)...
There are 105 users in that discord server with the role "Miembros"...
Here is the code...
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("...")
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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…