Redesigned the DiscordBotCore by splitting it into multiple projects. Created a WebUI and preparing to remove the DiscordBot application

This commit is contained in:
2025-04-04 22:07:30 +03:00
parent 62ba5ec63d
commit a4afb28f36
2290 changed files with 76694 additions and 17052 deletions

View File

@@ -1,9 +1,8 @@
using Discord;
using DiscordBotCore;
using DiscordBotCore.Interfaces;
using DiscordBotCore.Online;
using DiscordBotCore.Others;
using Discord;
using DiscordBotCore.Networking;
using DiscordBotCore.PluginCore.Helpers.Execution.DbCommand;
using DiscordBotCore.PluginCore.Interfaces;
namespace MusicPlayer.Commands;
@@ -20,7 +19,7 @@ public class AddMelody: IDbCommand
public string Usage => "add_melody [title],[description?],[aliases],[byteSize]";
public bool RequireAdmin => false;
public async void ExecuteServer(DbCommandExecutingArguments args)
public async void ExecuteServer(IDbCommandExecutingArgument args)
{
var arguments = string.Join(" ", args.Arguments);
string[] split = arguments.Split(',');
@@ -68,19 +67,19 @@ public class AddMelody: IDbCommand
IProgress<float> downloadProgress = new Progress<float>();
var melodiesDirectory = Path.Combine(args.PluginBaseDirectory.FullName, "Music/Melodies");
var fileLocation = Path.Combine(melodiesDirectory, $"{title}.mp3");
Directory.CreateDirectory(melodiesDirectory);
FileDownloader downloader = new FileDownloader(file.Url, fileLocation);
await downloader.DownloadFile(downloadProgress.Report);
var location = Application.GetResourceFullPath($"Music/Melodies/{title}.mp3");
Directory.CreateDirectory(Application.GetResourceFullPath("Music/Melodies"));
await ServerCom.DownloadFileAsync(file.Url, location, downloadProgress);
Console.WriteLine($"Done. Saved at {location}");
args.Logger.Log($"Melody downloaded. Saved at {fileLocation}", this);
await msg.ModifyAsync(a => a.Content = "Done");
var info = MusicInfoExtensions.CreateMusicInfo(title, location, description ?? "Unknown", aliases.ToList(), bsize);
var info = MusicInfoExtensions.CreateMusicInfo(title, fileLocation, description ?? "Unknown", aliases.ToList(), bsize);
Variables._MusicDatabase?.Add(title, info);
Variables._MusicDatabase.Add(title, info);
var builder = new EmbedBuilder();
builder.Title = "A new music was successfully added !";

View File

@@ -7,6 +7,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\DiscordBotCore.PluginCore\DiscordBotCore.PluginCore.csproj" />
<ProjectReference Include="..\..\DiscordBotCore\DiscordBotCore.csproj" />
</ItemGroup>

View File

@@ -25,11 +25,8 @@ public class Play: IDbSlashCommand
}
};
public async void ExecuteServer(SocketSlashCommand context)
{
if(Variables._MusicDatabase is null)
{
await context.RespondAsync("Music Database is not loaded !");

View File

@@ -4,8 +4,8 @@ namespace MusicPlayer;
public class Variables
{
public static MusicDatabase? _MusicDatabase;
public static MusicPlayer? _MusicPlayer;
public static Dictionary<string, MusicInfo> _MusicDatabase;
public static MusicPlayer _MusicPlayer;
public static IAudioClient? audioClient;
public static IAudioClient audioClient;
}