user6831941
user6831941

Reputation:

Deleting channels with Discord.NET

I found out how I can create channels using discord.net via await.

Context.Guild.CreateTextChannelAsync(names[0],RequestOptions.Default);

But I couldn't find a way to also delete that channel. So how would I go about doing that?

Upvotes: 0

Views: 1868

Answers (3)

Thebotgame
Thebotgame

Reputation: 91

Hey that should work try that

 SocketGuildChannel socketGuildChannel = channel;
 socketGuildChannel.DeleteAsync();

By the way if you have SocketMessage you can do that will like so

 SocketMessage arg
 if(arg.Channel is SocketGuildChannel){
     SocketGuildChannel channel = arg.Channel as SocketGuildChannel;
     channel.DeleteAsync();
 }

Upvotes: 1

chrisstar123
chrisstar123

Reputation: 77

If you have the SocketTextChannel object you can do channel.DeleteAsync()

Upvotes: 1

jdmdevdotnet
jdmdevdotnet

Reputation: 1

channel.Delete();

Should do the trick https://github.com/RogueException/Discord.Net/issues/426

Seems like it was an issue, but no longer.

Upvotes: 1

Related Questions