不和谐频道切换

时间:2017-07-15 16:22:13

标签: discord

所以我有你的平均Discordie node.js代码,但我不知道如何在其他渠道发送消息。

这个想法是,当用户请求某些内容时,它会进入一个名为requests的频道。

var Discordie = require("discordie");
var Events = Discordie.Events;

var client = new Discordie();

client.connect({ token: "" });

client.Dispatcher.on(Events.GATEWAY_READY, e => {
  console.log("Connected as: " + client.User.username);
});

client.Dispatcher.on(Events.MESSAGE_CREATE, e => {
  if (e.message.content == "request")
    //make this send in a request channel.
   e.message.channel.sendMessage("pong");
});

1 个答案:

答案 0 :(得分:0)

var Discordie = require("discordie");
var Events = Discordie.Events;

var client = new Discordie();

client.connect({ token: "" });

client.Dispatcher.on(Events.GATEWAY_READY, e => {
  console.log("Connected as: " + client.User.username);
});

client.Dispatcher.on(Events.MESSAGE_CREATE, e => {
  if (e.message.content == "request")
   var channels = e.message.channel.guild.textChannels;
   var channel = null;
   for(int i = 0; i < channels.length; i++) {
       channel = channels[i];
       if(channel.name == "YOUR CHANNEL NAME") 
          break;
   }
   channel.sendMessage("pong");
});