简体   繁体   English

如何通过消息 ID 编辑另一个频道内的消息?

[英]How do I edit a message inside of another channel by message ID?

I'm trying to edit a message that's in another channel that the bot can see, when you use the command from another channel.当您使用来自另一个频道的命令时,我正在尝试编辑机器人可以看到的另一个频道中的消息。

I tried using this method but it didn't work.我尝试使用此方法,但没有用。 What's the new method since this one is probably outdated?新方法是什么,因为这个方法可能已经过时了?

client.channels.cache.get('Channel ID').fetchMessage('Message ID').edit(embed);

.fetchMessages() is now .messages.fetch() and it returns a promise: .fetchMessages()现在是.messages.fetch()并且它返回一个 promise:

  client.channels.cache
    .get('Channel ID')
    .messages.fetch('Message ID')
    .then((msg) => msg.edit(embed));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM