discord-jda / JDA

Java wrapper for the popular chat & VOIP service: Discord https://discord.com
Apache License 2.0
4.33k stars 735 forks source link

sendMessage in a specific channel #561

Closed ThibautCuchet closed 6 years ago

ThibautCuchet commented 6 years ago

Hi, I would like to send a message in a specific channel where nobody send message I try to use jda.getGuildById(id).getTextChannelById(id).sendMessage(message).queue() but I have a NullPointerException.

Can you help me ?

natanbc commented 6 years ago

either the bot is not in the guild or the channel doesn't exist

MinnDevelopment commented 6 years ago

Please read the issue template.

Almighty-Alpaca commented 6 years ago

There are only 2 possible things that can be null: The guild or the channel. That means that either that the bot isn't in the guild/the channel doesn't exist or that one of your IDs is invalid.

ThibautCuchet commented 6 years ago

I take the id in discord so I think id is right

MinnDevelopment commented 6 years ago

Join the discord server for help: invite

kantenkugel commented 6 years ago

@Almighty-Alpaca OR... the jda object