通过ID获取消息:Discord.js [英] Get Message By ID: Discord.js

查看:102
本文介绍了通过ID获取消息:Discord.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为一个不和谐的机器人制作一个报告系统,我希望玩家通过id报告一条特定的消息,以便主持人可以确定该消息是否令人反感.我正在努力寻找一种从给定ID获取消息文本的方法.有没有办法做到这一点?

I am doing a report system for a discord bot and I want the player to report a specific message by the id so that the moderators can decide if it is offensive or not. I am struggling to find a way to get the message's text from the given id. Is there a possible way of doing this?

推荐答案

您可以通过

msg.channel.fetchMessage();

文档位于此处.如果您希望能够按ID从任何渠道检索消息,则可以遍历所有渠道并捕获任何错误.

The documentation is here. If you want to be able to retrieve a message from any channel by id, you can loop through all channels and catch any errors.

这篇关于通过ID获取消息:Discord.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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