如何在不要求发件人的情况下发送消息

时间:2020-09-06 02:56:16

标签: javascript node.js discord discord.js

如何在不对发件人执行ping操作的情况下发送消息?我有:

msg.reply(':smirk_cat:');

发送@sender, :smirk_cat:的人, 但是我想要的只是:smirk cat:

3 个答案:

答案 0 :(得分:1)

相反,您可以执行msg.channel.send(YOUR_MESSAGE)

您的情况应该是msg.channel.send(':smirk_cat:')

答案 1 :(得分:1)

使用

msg.channel.send(<message>)

msg.reply()函数通过ping用户然后在相同消息中ping后发送消息来答复用户。有关更多信息,请在此处阅读其官方文档:

要简单地回答您的问题,请改用此方法:

msg.channel.send(':smirk_cat:');

答案 2 :(得分:1)

您应该使用:

message.channel.send()

channelmessage对象的属性;它引用了发送消息的TextChannel。从那里开始,我们使用TextChannel.send()方法,该方法会将消息发送到被调用的通道。因此,message.channel.send()只会向发送原始消息的频道发送一条消息。

example


您还可以使用此功能将消息发送到其他特定渠道!

// get a channel by it's id, then send a message to it
message.client.channels.cache.get('<Channel ID>').send();

// get a channel by its name (or any other property), then send a message to it
message.client.channels.cache.find(channel => channel.name === 'general').send();