我正在做一个设置命令。一切正常,但命令会垃圾邮件而不是发送一次
@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,但它没有工作任何帮助
您应该在
await msg.edit(embed=setup2)
下添加一个break
编辑:另一个原因可能是
on_message
事件未命中await bot.process_commands(message)
。请注意,这应该与async def on_message(msg):
的缩进匹配。只需确保在活动结束时添加相关问题 更多 >
编程相关推荐