Jda: sendMessage method in channel not sending message (although JDA reports no errors)

Created on 10 Mar 2017  路  2Comments  路  Source: DV8FromTheWorld/JDA

I'm trying to use the sendMessage(String s) method in the TextChannel interface to send a text message in a channel using

public void sendMessage(TextChannel channel, String s) { channel.sendMessage(s); }

Whenever I run to run this method on a random text channel, the call to channel.sendMessage sucesfully returns a RestAction object and the bot continues as normal. However, no text message is displayed in the channel. The bot has permissions and everything, but nothing pops up.

I'm not sure if this is related, but when using intellij's debug mode, I saw running the sendMessage method in the TextChannel interface gave this NPE
image

Any help would be appreciated, thanks!

Most helpful comment

add a .queue(); for non-blocking or .complete() to return the Message object.

Look into JDAs RestActions for more information.

All 2 comments

add a .queue(); for non-blocking or .complete() to return the Message object.

Look into JDAs RestActions for more information.

add a .queue(); for non-blocking or .complete() to return the Message object.

Thanks! Using .complete() worked

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StijnSimons picture StijnSimons  路  3Comments

Drischdaan picture Drischdaan  路  4Comments

andrei1058 picture andrei1058  路  6Comments

YukioKeno picture YukioKeno  路  6Comments

Mas281 picture Mas281  路  3Comments