Reputation: 21
My bot is not able to send embeds or regular text messages, the code executes but nothing is sent in the discord channel. I followed the setup from the JDA wiki and I have no idea what I am doing wrong.
Bot login code
bot = JDABuilder.createDefault(token)
.addEventListeners(new MessageListener())
.disableIntents(
GatewayIntent.GUILD_PRESENCES,
GatewayIntent.DIRECT_MESSAGE_TYPING,
GatewayIntent.GUILD_PRESENCES,
GatewayIntent.GUILD_VOICE_STATES,
GatewayIntent.DIRECT_MESSAGE_REACTIONS,
GatewayIntent.GUILD_MESSAGE_TYPING)
.disableCache(CacheFlag.VOICE_STATE, CacheFlag.ONLINE_STATUS, CacheFlag.ACTIVITY)
.build();
bot.awaitReady();
System.out.println("Loaded bot");
My event code
public class MessageListener extends ListenerAdapter {
@Override
public void onGuildMessageReceived(GuildMessageReceivedEvent event) {
Message message = event.getMessage();
if(message.getAuthor().isBot())
return;
System.out.println("message");
message.getChannel().sendMessageEmbeds(new EmbedBuilder()
.setTitle("test")
.addField("test", "test", true)
.setColor(Config.EMBED_COLOR).build());
}
}
The system.out is called whenever a message is sent and I have tried replacing the embed with a plain text message but it didn't work either.
The bot has administrator permissions in the server it is in.
The bot is shown as online in the member list and the console output indicates a successful login
[main] INFO JDA - Login Successful!
[JDA MainWS-ReadThread] INFO WebSocketClient - Connected to WebSocket
[JDA MainWS-ReadThread] INFO JDA - Finished Loading!
Upvotes: 1
Views: 793