JDA: Unknown Channel error by sending messages to deleted channels with no way to check if deleted or not beforehand

General Troubleshooting

  • I have checked for similar issues.
  • I have updated to the latest JDA version.
  • I have checked the branches or the maintainers’ PRs for upcoming bug fixes.

Bug Report

When queueing a message using TextChannel.sendMessage("").queue(); I get an Unknown Channel Error thrown even though i checked for write permissions to the channel. Meaning I get True returned from TextChannel.hasPermission(…); when applied on a deleted text channel.

Is there maybe a way to check if a text channel has been deleted or not? I couldn’t find any way myself.

Expected Behavior

I store text channel id’s in a database to post messages at certain intervals. Before sending a message I check for write permissions in order to make sure my bot is able to post in the text channel.

Code Example or Reproduction Steps

String channelID = "abcdefg" //Id of a previously deleted channel here JDA.getTextChannelById(channelID).sendMessage("").queue();

Code for JDABuilder or DefaultShardManagerBuilder Used

DefaultShardManagerBuilder builder = new DefaultShardManagerBuilder(); String token = "XXXXX"; builder.setShardsTotal(10); builder.setToken(token); builder.addEventListeners(new Main()); shardManager = builder.build();

Exception or Error

image

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 32 (18 by maintainers)

Most upvoted comments

Closing, since this seems to be resolved now. If you have any reproducible bugs to report, feel free to open a new issue with the reproduction steps.

Is this what you’re trying to do?

Then it was updated. But yeah, that should be the same.

I’ll post a stacktrace when i get to it, was changing some other stuff so gotta get that sorted out first