This commit is contained in:
2022-12-09 14:46:10 +02:00
parent 5bb13aa4a6
commit 0527d43dd2
12 changed files with 258 additions and 226 deletions

View File

@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using PluginManager;
using PluginManager.Interfaces;
using PluginManager.Others;
using DiscordLibCommands = Discord.Commands;
using DiscordLib = Discord;
using OperatingSystem = PluginManager.Others.OperatingSystem;
namespace DiscordBot.Discord.Commands;
@@ -40,7 +42,7 @@ internal class Restart : DBCommand
public async void ExecuteServer(DiscordLibCommands.SocketCommandContext context)
{
var args = Functions.GetArguments(context.Message);
var OS = Functions.GetOperatingSystem();
var OS = Functions.GetOperatingSystem();
if (args.Count == 0)
{
switch (OS)
@@ -79,7 +81,7 @@ internal class Restart : DBCommand
switch (OS)
{
case OperatingSystem.WINDOWS:
Functions.WriteLogFile("Restarting the bot with the following arguments: \"" + cmd + "\"");
Logger.WriteLogFile("Restarting the bot with the following arguments: \"" + cmd + "\"");
Process.Start("./DiscordBot.exe", cmd);
break;
case OperatingSystem.LINUX:

View File

@@ -5,7 +5,7 @@ using Discord;
using Discord.Commands;
using Discord.WebSocket;
using static PluginManager.Others.Functions;
using PluginManager;
namespace DiscordBot.Discord.Core;
@@ -98,7 +98,7 @@ internal class Boot
private async Task Client_LoggedOut()
{
WriteLogFile("Successfully Logged Out");
Logger.WriteLine("Successfully Logged Out");
await Log(new LogMessage(LogSeverity.Info, "Boot", "Successfully logged out from discord !"));
/* var cmds = await client.GetGlobalApplicationCommandsAsync();
@@ -117,7 +117,7 @@ internal class Boot
private Task LoggedIn()
{
Console.Title = "CONNECTED";
WriteLogFile("The bot has been logged in at " + DateTime.Now.ToShortDateString() + " (" +
Logger.WriteLine("The bot has been logged in at " + DateTime.Now.ToShortDateString() + " (" +
DateTime.Now.ToShortTimeString() + ")"
);
return Task.CompletedTask;
@@ -129,7 +129,7 @@ internal class Boot
{
case LogSeverity.Error:
case LogSeverity.Critical:
WriteErrFile(message.Message);
Logger.WriteErrFile(message.Message);
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("[ERROR] " + message.Message);
@@ -139,7 +139,7 @@ internal class Boot
case LogSeverity.Info:
case LogSeverity.Debug:
WriteLogFile(message.Message);
Logger.WriteLogFile(message.Message);
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("[INFO] " + message.Message);

View File

@@ -7,9 +7,10 @@ using Discord.Commands;
using Discord.WebSocket;
using PluginManager.Loaders;
using PluginManager.Others;
using PluginManager.Others.Permissions;
using static PluginManager.Logger;
namespace DiscordBot.Discord.Core;
internal class CommandHandler