Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Command("leave"), Description("Leave the current channel")]
- public async Task Leave(CommandContext ctx)
- {
- Console.WriteLine("Bot left voice channel");
- var vnext = ctx.Client.GetVoiceNextClient();
- if (vnext == null)
- {
- // not enabled
- await ctx.RespondAsync("VNext is not enabled or configured.");
- }
- // check whether we are connected
- var vnc = vnext.GetConnection(ctx.Guild);
- if (vnc == null)
- {
- // not connected
- await ctx.RespondAsync("Not connected in this guild.");
- }
- // disconnect
- vnc.Disconnect();
- await ctx.RespondAsync("Disconnected");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement