所以...我想编写一个代码,以便它将消息发送到特定频道
我想要这样它在聊天#logs
和#mod-log
中发送此消息
此处提供代码:
channel = discord.utils.get(user.server.channels, name=['logs', 'mod-log'])
embed = discord.Embed(name="MEMBER_WARNED", description="------------------------------------------------------", color=0xffaa00)
embed.set_author(name="MEMBER_WARNED:\nMember Warned")
embed.add_field(name="Warned by: ", value="{}".format(author.mention), inline=False)
client = bot
await client.send_message(channel, embed=embed)
答案 0 :(得分:0)
您必须向每个频道发送一条单独的消息:
channels = [channel for channel in user.server.channels if channel.name in ['logs', 'mod-log']]
embed = discord.Embed(name="MEMBER_WARNED", description="------------------------------------------------------", color=0xffaa00)
embed.set_author(name="MEMBER_WARNED:\nMember Warned")
embed.add_field(name="Warned by: ", value="{}".format(author.mention), inline=False)
for channel in channels:
await bot.send_message(channel, embed=embed)