I have my own Discord BOT based on JDA. I need to send a text message to the specific channel. I know how to send the message as onEvent response, but in my situation I do n
Ok I think I know what you mean. You don't need to have an event to get an ID of a channel and send a message. The only thing you need to do is to instantiate the JDA, call awaitReady(), from the instance you can get all channels (MessageChannels, TextChannels, VoiceChannels, either by calling
So 1. Instantiate JDA
JDABuilder builder;
JDA jda = builder.build();
jda.awaitReady();
Get Channel
List channels = jda.getTextChannelsByName("general", true);
for(TextChannel ch : channels)
{
sendMessage(ch, "message");
}
Send message
static void sendMessage(TextChannel ch, String msg)
{
ch.sendMessage(msg).queue();
}
Hope it helps.