【发布时间】:2021-04-16 12:50:45
【问题描述】:
#MassDM Command
@bot.command()
async def massdm(ctx, msg):
await ctx.message.delete()
show_cursor()
wipeinput = input(Fore.RED+"Are you sure you want to mass dm? (WARNING: This happens really fast so it will probably flag your account)(y or n): ")
hide_cursor()
if wipeinput == "y" or wipeinput == "Y":
for user in ctx.guild.members:
if user != bot.user:
try:
channel = await user.create_dm()
await channel.send(msg)
print(Fore.GREEN + f'Sent to user "{user.name}"')
except:
print(Fore.YELLOW + f'Failed to DM user "{user.name}"')
pass
print(Fore.GREEN+"Finished")
当我运行它时,它只是说“完成”并且没有做任何事情。当我删除尝试/除了它没有错误?我认为我已经设置了所有正确的意图
【问题讨论】:
-
它只有在你拥有它看起来像的服务器时才有效,可以修复吗?
-
我认为这可能是 Intent 的问题,您启用了哪些 Intent?
-
intents = discord.Intents().all()
标签: python discord discord.py dm