【发布时间】:2021-03-05 23:42:09
【问题描述】:
我正在执行设置命令。一切正常,但命令垃圾邮件而不是发送一次
@kara.command()
async def setup(ctx):
guild = ctx.guild
await ctx.message.delete()
await guild.create_role(name=silenced, permissions = discord.Permissions(send_messages=False), reason=f"Invoked by {ctx.author}")
role = discord.utils.get(guild.roles, name = "Silenced")
for chan in guild.channels:
await chan.set_permissions(silenced, send_messages=False)
setup=discord.Embed(title="Kara's setup", color=c.teal(), url=rick_roll, description="If the setup goes wrong make sure I have the correct permissions!")
setup.add_field(name="Silenced Role", value="Setting up my own muted role...")
msg = await ctx.send(embed=setup)
setup2=discord.Embed(title="Kara's setup", color=c.teal(), url=rick_roll, description="If the setup goes wrong make sure I have the correct permissions!")
setup2.add_field(name="Silenced Role", value="Setting up my own muted role...")
setup2.add_field(name="Coming Soon...", value="Currently this is all to the setup soo... yea")
msg = await ctx.send(embed=setup)
await asyncio.sleep(3.4)
await msg.edit(embed=setup2)
它只是将我尝试将发送移到 for 之外的设置发送垃圾邮件,但没有任何帮助。
【问题讨论】:
-
检查是否有更多的实例在运行。如果是这样,请关闭它们。也是齿轮内的代码吗?提供详细信息
-
这是垃圾邮件,因为您在 for 循环中添加了
await ctx.send(embed=setup)。这就是你想要的 -
如何删除并发送一次
-
它在一个齿轮之外
标签: python python-3.x discord discord.py