从 fetchMessage 中删除用户反应?- 不和谐 JS [英] Remove a users reaction from fetchMessage? - Discord JS

查看:22
本文介绍了从 fetchMessage 中删除用户反应?- 不和谐 JS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于 Discord.js 的问题.如何从消息中删除特定用户的反应?

I have a question for Discord.js. How would I remove a specific user's reaction from a message?

我已尝试使用此代码:

// Now known as 'messages.fetch'.
message.channel.fetchMessage(MessageID).then(m => {
   m.reactions.remove(UserID);
});

但它根本不会消除用户的反应.我做错了吗?

But it doesn't remove the user's reaction at all. Am I doing something wrong?

任何帮助将不胜感激.

推荐答案

由于这个问题引起了很多关注,我决定发布对我有用的方法

Since this question is getting a lot of attraction, I decided to post what worked for me

移除特定用户的特定反应

// Channel = the channel object of the message's original channel
// MessageID = ID of the message, if hard coding, put around quotations eg: "1234"

const msg = await channel.messages.fetch(MessageID);

msg.reactions.resolve("REACTION EMOJI, 
REACTION OBJECT OR REACTION ID").users.remove("ID OR OBJECT OF USER TO REMOVE");

注意:如果使用旧版本的 discord.js,只需将 channel.messages.fetch 替换为 channel.fetchMessage

这篇关于从 fetchMessage 中删除用户反应?- 不和谐 JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆