Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. [Command("leave"), Description("Leave the current channel")]
  2.         public async Task Leave(CommandContext ctx)
  3.         {
  4.             Console.WriteLine("Bot left voice channel");
  5.             var vnext = ctx.Client.GetVoiceNextClient();
  6.  
  7.             if (vnext == null)
  8.             {
  9.                 // not enabled
  10.                 await ctx.RespondAsync("VNext is not enabled or configured.");
  11.                
  12.             }
  13.  
  14.             // check whether we are connected
  15.             var vnc = vnext.GetConnection(ctx.Guild);
  16.             if (vnc == null)
  17.             {
  18.                 // not connected
  19.                 await ctx.RespondAsync("Not connected in this guild.");
  20.             }
  21.  
  22.             // disconnect
  23.             vnc.Disconnect();
  24.             await ctx.RespondAsync("Disconnected");
  25.  
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement