【问题标题】:Discord.js : Move message to bottom of Text-ChannelDiscord.js:将消息移动到文本通道的底部
【发布时间】:2021-10-14 11:07:34
【问题描述】:

我想将特定消息(由 ID 标识)移动到它所在的文本通道的底部。就好像它是新发布的一样。 (这将由命令触发)

固定不是一种解决方案,因为它不会像人们想象的那样将消息固定到聊天的底部。它只是将它添加到固定消息列表中,只有通过单击固定图标才能看到,除非被告知,否则几乎没有人这样做。

转发消息不是解决方案,因为它下面有很多用户反应,应该保留。我还没有找到将所有反应从一条消息转移到另一条消息的方法,并且查看 Discord.js 文档,我认为这是不可能的。你甚至不能以用户的身份进行虚假反应,更不用说一次添加多个反应了。

然而,简单地将消息移动到文本通道的底部是可能的,尽管我也找不到它的方法。但也许我只是忽略了一些东西。

有没有可能,如果有,怎么做?

【问题讨论】:

  • discord api 不允许你这样做,discord 也不允许人们这样做。

标签: javascript node.js discord discord.js


【解决方案1】:

看到你需要什么唯一可能的解决方案是我在下面提出的解决方案,因为不和谐不允许你按照字面意思做你想做的事情。

类似这样的东西,但被机器人回答了:


使用不和谐回复:https://www.npmjs.com/package/discord-reply
const discord = require('discord.js');
require('discord-reply'); //⚠️ IMPORTANT: put this before your discord.Client()
const client = new discord.Client();

client.on('ready', () => {
  console.log(client.user.tag)
});

client.on('message', async message => {
  if (message.content.startsWith('!reply')) {
    message.lineReply('Hey'); //Line (Inline) Reply with mention

    message.lineReplyNoMention(`My name is ${client.user.username}`); //Line (Inline) Reply without mention
  }
});

client.login('TOKEN');

关于命令处理程序

/**
 * No need to define it
 * */
module.exports = {
  name: 'reply',
  category: 'Test',
  run: (client, message, args) => {
    message.lineReply('This is reply with @mention');
  }
}

致谢:discord.js | Reply to Message (Actual Reply with Reply Decoration

【讨论】:

  • Discord.js v13 已经发布并在库中实现了回复。该模块已弃用。
  • 不必要的/已弃用的模块,但好主意。回复消息可能是解决我问题的最佳方法。这是我的赞成票。
  • 你也可以勾选它是否解决了你的问题!
猜你喜欢
  • 2018-06-22
  • 2011-10-14
  • 1970-01-01
  • 2023-03-22
  • 2021-10-20
  • 2021-05-04
  • 1970-01-01
  • 2021-02-11
  • 2013-03-13
相关资源
最近更新 更多