尽管我可以弄清楚如何将自己的消息发送到另一个 channel ,但我无法弄清楚如何将机器人上的嵌入消息从一个 channel 发送到另一个 channel :
@bot.command(pass_context=True)
async def tf1(ctx):
embed=discord.Embed(title="Test", description="1", color=0x5bcdee)
embed.set_footer(text="Test2")
await bot.say(discord.Object(id='456277299189383168'), embed=embed)
这似乎不起作用,每当我发送它时,我都会收到此<discord.object.Object object at 0x03B66BD0>
,然后收到嵌入的消息。
另一方面,当我尝试复制消息而不是嵌入消息时,此有效,以下是复制消息的代码:
@bot.command(pass_context=True)
async def obisowner(ctx, *, mesg):
await bot.send_message(discord.Object(id='456277299189383168'), "{}".format(mesg))
最佳答案
bot.say()
采用第一个位置参数 message
,发送消息并嵌入到命令上下文的 channel (即,命令上下文的 channel )命令消息被机器人接收)。
由于您想将消息发送到不同的 channel ,请改用 bot.send_message()
:
await bot.send_message(discord.Object(id='456277299189383168'), embed=embed)
关于python - Discord 机器人将嵌入消息发送到另一个 channel ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50863957/