mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
GetServerInfo, GetServerList and GetServerStatus done
This commit is contained in:
parent
d526a3f457
commit
824daed0d1
27 changed files with 484 additions and 91 deletions
|
|
@ -5,9 +5,9 @@ using Discord.Net.Providers.WS4Net;
|
|||
using Discord.WebSocket;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ServerManagerTool.Discord.Delegates;
|
||||
using ServerManagerTool.Discord.Interfaces;
|
||||
using ServerManagerTool.Discord.Services;
|
||||
using ServerManagerTool.DiscordBot.Delegates;
|
||||
using ServerManagerTool.DiscordBot.Interfaces;
|
||||
using ServerManagerTool.DiscordBot.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
|
@ -15,7 +15,7 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServerManagerTool.Discord
|
||||
namespace ServerManagerTool.DiscordBot
|
||||
{
|
||||
public sealed class ServerManagerBot : IServerManagerBot
|
||||
{
|
||||
|
|
@ -30,7 +30,7 @@ namespace ServerManagerTool.Discord
|
|||
set;
|
||||
}
|
||||
|
||||
public async Task StartAsync(string discordToken, string commandPrefix, string dataDirectory, HandleCommandDelegate handleCommandCallback, CancellationToken token)
|
||||
public async Task StartAsync(string discordToken, string commandPrefix, string dataDirectory, HandleCommandDelegate handleCommandCallback, HandleTranslationDelegate handleTranslationCallback, CancellationToken token)
|
||||
{
|
||||
if (Started)
|
||||
{
|
||||
|
|
@ -38,7 +38,7 @@ namespace ServerManagerTool.Discord
|
|||
}
|
||||
Started = true;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(commandPrefix) || string.IsNullOrWhiteSpace(discordToken) || handleCommandCallback is null)
|
||||
if (string.IsNullOrWhiteSpace(commandPrefix) || string.IsNullOrWhiteSpace(discordToken) || handleTranslationCallback is null || handleCommandCallback is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -55,8 +55,8 @@ namespace ServerManagerTool.Discord
|
|||
|
||||
var settings = new Dictionary<string, string>
|
||||
{
|
||||
{ "DiscordSettings:Prefix", commandPrefix },
|
||||
{ "DiscordSettings:Token", discordToken },
|
||||
{ "DiscordSettings:Prefix", commandPrefix },
|
||||
{ "ServerManager:DataDirectory", dataDirectory }
|
||||
};
|
||||
|
||||
|
|
@ -106,7 +106,8 @@ namespace ServerManagerTool.Discord
|
|||
.AddSingleton<ShutdownService>()
|
||||
.AddSingleton<Random>()
|
||||
.AddSingleton(config)
|
||||
.AddSingleton(handleCommandCallback);
|
||||
.AddSingleton(handleCommandCallback)
|
||||
.AddSingleton(handleTranslationCallback);
|
||||
|
||||
// Create the service provider
|
||||
using (var provider = services.BuildServiceProvider())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue