Reputation: 65
I am trying to make a discord bot using JDA (Java Discord API). I’m just wondering how I would delete a text or voice channel using a command? I have a onMessageRecieved listener that works looking for the command, but when I can’t seem to delete the channel using it.
I’ve tried to get the channel by ID and delete it with ‘.delete()’ but with no results.
e.getGuild().getChannelByID(e.getChannel().getID()).delete();
Upvotes: 0
Views: 2569
Reputation: 1578
The method you are using returns an instance of RestAction. In order to execute action, you have to call one of the execution methods queue()/complete()/submit().
e.getGuild().getChannelByID(e.getChannel().getID()).delete().reason(reason).queue();
Upvotes: 0