English 中文(简体)
Discord.js bot to send message to a different channel on same server
原标题:

I am trying to have get my Discord bot send a message to another channel when when there is more than one item in the response, write a message to another channel (on the same server). This code is within an async function and returns the first item of the response.

Currently, this code is sending to the channel where the command originated. When I attempt things I ve found to send to another channel I get errors such as fetch not being found or cache not being found. What am I missing to get this to work?

if(response.length > 1)
{
  let returnMessage =  Items found: " + response.length;

  for(let i = 0; i < response.length; i++)
  {
    let responseString = response[i].toString();
    returnMessage += "
" + responseString.substring(responseString.indexOf( / , 10));
  }

  // send message to another channel here
  message.channel.send("test message"); // this sends the message to the current channel.
}
问题回答

暂无回答




相关问题
How can I make my bot works in multiple servers?

I know that this question has been asked for discord.py, but couldn t find a discord.js one Currently I m working on a small Discord Bot, and I would like to make it with possible that it can be used ...

Discord.js not recognizing file path as directory

I am trying to learn how to use the / command system in Discord.js, however, following the Discord.js guide results in the following error: Error: ENOTDIR: not a directory, scandir This is with the ...

Discord bot responds multiple times for one event

I want my bot to respond once to a command such as .on. However, it responds multiple times per input: The code is: client.on( message , message =>{ if(message.content === .on ){ ...

热门标签