DBCommand interface update & all other plugins were updated

This commit is contained in:
2022-09-03 16:28:03 +03:00
parent 68a83b052a
commit f7e6b0a398
35 changed files with 234 additions and 273 deletions

View File

@@ -1,6 +1,8 @@
using System.Collections.Generic;
using Discord.Commands;
using Discord.WebSocket;
using PluginManager.Interfaces;
namespace MusicCommands;
@@ -15,13 +17,9 @@ internal class Leave : DBCommand
public string Usage => "leave";
public bool canUseDM => false;
public bool canUseServer => true;
public bool requireAdmin => false;
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
public async void ExecuteServer(SocketCommandContext context)
{
if (Data.audioClient is not null && Data.voiceChannel is not null)
{

View File

@@ -1,6 +1,8 @@
using System.Collections.Generic;
using Discord.Commands;
using Discord.WebSocket;
using PluginManager.Interfaces;
namespace MusicCommands;
@@ -15,13 +17,9 @@ internal class Pause : DBCommand
public string Usage => "pause";
public bool canUseDM => false;
public bool canUseServer => true;
public bool requireAdmin => false;
public void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
public void ExecuteServer(SocketCommandContext context)
{
Data.MusicPlayer.isPaused = !Data.MusicPlayer.isPaused;
}

View File

@@ -2,10 +2,12 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using Discord;
using Discord.Audio;
using Discord.Commands;
using Discord.WebSocket;
using PluginManager.Interfaces;
using PluginManager.Others;
@@ -21,17 +23,13 @@ internal class Play : DBCommand
public string Usage => "play [name/url]";
public bool canUseDM => false;
public bool canUseServer => true;
public bool requireAdmin => false;
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
public async void ExecuteServer(SocketCommandContext context)
{
Directory.CreateDirectory("Music");
var path = "./Music/";
string[] splitted = message.Content.Split(' ');
var path = "./Music/";
string[] splitted = context.Message.Content.Split(' ');
if (splitted.Length < 2)
return;
do

View File

@@ -3,8 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Discord.Commands;
using Discord.WebSocket;
using PluginManager.Interfaces;
namespace MusicCommands
@@ -19,24 +21,20 @@ namespace MusicCommands
public string Usage => "skip";
public bool canUseDM => false;
public bool canUseServer => true;
public bool requireAdmin => false;
public void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
public async void ExecuteServer(SocketCommandContext context)
{
var loadedSong = Data.MusicPlayer.NowPlaying;
if (loadedSong is null || Data.MusicPlayer.isPlaying == false)
{
message.Channel.SendMessageAsync("There is no music playing");
await context.Message.Channel.SendMessageAsync("There is no music playing");
return;
}
Data.MusicPlayer.isPlaying = false;
message.Channel.SendMessageAsync($"You have skipped {loadedSong.Name}");
await context.Message.Channel.SendMessageAsync($"You have skipped {loadedSong.Name}");
}
}
}

View File

@@ -3,28 +3,26 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Discord.Commands;
using Discord.WebSocket;
using PluginManager.Interfaces;
namespace MusicCommands
{
public class queue : DBCommand
{
public string Command => "queue";
public string Command => "queue";
public List<string> Aliases => new() { "q" };
public string Description => "check queue";
public string Usage => "queue";
public bool canUseDM => false;
public bool canUseServer => true;
public bool requireAdmin => false;
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
public async void ExecuteServer(SocketCommandContext context)
{
await context.Channel.SendMessageAsync($"You have {Data.Playlist.Count} items in queue");
}