【发布时间】:2019-10-02 19:34:31
【问题描述】:
我正在尝试做一个消息镜像(获取一个频道的消息并通过 webhook 将其发送到另一个频道)。我如何发送 webhook 消息来复制用户发送的消息(相同的名称、相同的头像、相同的消息内容和附件)?
我知道有一个文档 (https://discordpy.readthedocs.io/en/latest/api.html#discord.Webhook),但我只是不明白它应该如何获取发送消息的用户的个人资料图片和昵称,然后在 webhook 上使用它们
这是我正在努力解决的代码
@client.event
async def on_message(message):
fchannel = client.get_channel(fromchannel)
tchannel = client.get_channel(tochannel)
if message.channel == fchannel:
attach = message.attachments
print ("Found message to forward: "+ message.content)
if attach:
for attachment in attach:
#need code to send the message and image throught the webhook
else:
#need code to send the message throught the webhook
【问题讨论】:
标签: python discord.py