- NadekoBot class renamed to Bot

- Implemented grpc based coordinator. Supports restarting, killing single or all shards, as well as getting current shard statuses. (Adaptation of the one used by the public bot)
- Coord is setup via coord.yml file
- Methods from SelfService which deal with shard/bot restart etc have been moved to ICoordinator (with GrpcRemoteCoordinator being the default implementation atm)
- Vastly simplified NadekoBot/Program.cs
This commit is contained in:
Kwoth
2021-06-19 13:13:54 +02:00
parent d8c7cdc7f4
commit c86bf6f300
58 changed files with 1212 additions and 635 deletions

View File

@@ -58,7 +58,7 @@ namespace NadekoBot.Modules.Utility
.AddField(fb => fb.WithName(GetText("region")).WithValue(guild.VoiceRegionId.ToString()).WithIsInline(true))
.AddField(fb => fb.WithName(GetText("roles")).WithValue((guild.Roles.Count - 1).ToString()).WithIsInline(true))
.AddField(fb => fb.WithName(GetText("features")).WithValue(features).WithIsInline(true))
.WithColor(NadekoBot.OkColor);
.WithColor(Bot.OkColor);
if (Uri.IsWellFormedUriString(guild.IconUrl, UriKind.Absolute))
embed.WithThumbnailUrl(guild.IconUrl);
if (guild.Emotes.Any())
@@ -89,7 +89,7 @@ namespace NadekoBot.Modules.Utility
.AddField(fb => fb.WithName(GetText("id")).WithValue(ch.Id.ToString()).WithIsInline(true))
.AddField(fb => fb.WithName(GetText("created_at")).WithValue($"{createdAt:dd.MM.yyyy HH:mm}").WithIsInline(true))
.AddField(fb => fb.WithName(GetText("users")).WithValue(usercount.ToString()).WithIsInline(true))
.WithColor(NadekoBot.OkColor);
.WithColor(Bot.OkColor);
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
}
@@ -112,7 +112,7 @@ namespace NadekoBot.Modules.Utility
.AddField(fb => fb.WithName(GetText("joined_server")).WithValue($"{user.JoinedAt?.ToString("dd.MM.yyyy HH:mm") ?? "?"}").WithIsInline(true))
.AddField(fb => fb.WithName(GetText("joined_discord")).WithValue($"{user.CreatedAt:dd.MM.yyyy HH:mm}").WithIsInline(true))
.AddField(fb => fb.WithName(GetText("roles")).WithValue($"**({user.RoleIds.Count - 1})** - {string.Join("\n", user.GetRoles().Take(10).Where(r => r.Id != r.Guild.EveryoneRole.Id).Select(r => r.Name)).SanitizeMentions(true)}").WithIsInline(true))
.WithColor(NadekoBot.OkColor);
.WithColor(Bot.OkColor);
var av = user.RealAvatarUrl();
if (av != null && av.IsAbsoluteUri)

View File

@@ -23,7 +23,7 @@ namespace NadekoBot.Modules.Utility.Services
private readonly DiscordSocketClient _client;
private readonly ConcurrentDictionary<ulong, StreamRoleSettings> guildSettings;
public StreamRoleService(DiscordSocketClient client, DbService db, NadekoBot bot)
public StreamRoleService(DiscordSocketClient client, DbService db, Bot bot)
{
_db = db;
_client = client;

View File

@@ -18,7 +18,7 @@ namespace NadekoBot.Modules.Utility.Services
private readonly CommandHandler _ch;
private readonly HelpService _hs;
public VerboseErrorsService(NadekoBot bot, DbService db, CommandHandler ch, HelpService hs)
public VerboseErrorsService(Bot bot, DbService db, CommandHandler ch, HelpService hs)
{
_db = db;
_ch = ch;

View File

@@ -16,6 +16,7 @@ using System.Threading;
using System.Threading.Tasks;
using NadekoBot.Common.Replacements;
using NadekoBot.Core.Common;
using NadekoBot.Services;
using Serilog;
namespace NadekoBot.Modules.Utility
@@ -23,18 +24,18 @@ namespace NadekoBot.Modules.Utility
public partial class Utility : NadekoModule
{
private readonly DiscordSocketClient _client;
private readonly ICoordinator _coord;
private readonly IStatsService _stats;
private readonly IBotCredentials _creds;
private readonly NadekoBot _bot;
private readonly DownloadTracker _tracker;
public Utility(NadekoBot nadeko, DiscordSocketClient client,
public Utility(DiscordSocketClient client, ICoordinator coord,
IStatsService stats, IBotCredentials creds, DownloadTracker tracker)
{
_client = client;
_coord = coord;
_stats = stats;
_creds = creds;
_bot = nadeko;
_tracker = tracker;
}
@@ -276,7 +277,7 @@ namespace NadekoBot.Modules.Utility
.AddField(efb => efb.WithName(GetText("uptime")).WithValue(_stats.GetUptimeString("\n")).WithIsInline(true))
.AddField(efb => efb.WithName(GetText("presence")).WithValue(
GetText("presence_txt",
_bot.GuildCount, _stats.TextChannels, _stats.VoiceChannels)).WithIsInline(true))).ConfigureAwait(false);
_coord.GetGuildCount(), _stats.TextChannels, _stats.VoiceChannels)).WithIsInline(true))).ConfigureAwait(false);
}
[NadekoCommand, Usage, Description, Aliases]