Merged projects with plugins and modules

This commit is contained in:
2024-07-22 01:18:00 +03:00
parent 1fd065f4c2
commit 8ace51c840
59 changed files with 1669 additions and 73 deletions

View File

@@ -0,0 +1,35 @@
using Discord.WebSocket;
using DiscordBotCore;
using DiscordBotCore.Interfaces;
using DiscordBotCore.Others;
namespace MusicPlayer.Events;
public class OnVoiceRemoved: DBEvent
{
public string Name => "Event: OnVoiceRemoved";
public string Description => "Called when bot leaves a voice channel";
public bool RequireOtherThread => false;
public void Start(DiscordSocketClient client)
{
client.UserVoiceStateUpdated += async (user, oldState, newState) =>
{
if (user.Id == client.CurrentUser.Id && newState.VoiceChannel == null)
{
Variables._MusicPlayer?.MusicQueue.Clear();
Variables._MusicPlayer?.Skip();
Variables._MusicPlayer?.Stop();
await Variables.audioClient!.StopAsync();
Variables.audioClient = null;
Variables._MusicPlayer = null;
Application.CurrentApplication.Logger.Log("Bot left voice channel.", this, LogType.Info);
}
};
}
}