fix: Possible fixes for buggy .bye behavior, ref #437

This commit is contained in:
Kwoth
2024-10-03 01:58:18 +00:00
parent 3c108e531e
commit a7be56a562
3 changed files with 53 additions and 145 deletions

View File

@@ -1,49 +0,0 @@
using Grpc.Core;
namespace NadekoBot.GrpcApi;
public sealed class ServerInfoSvc : GrpcInfo.GrpcInfoBase, INService
{
private readonly IStatsService _stats;
public ServerInfoSvc(IStatsService stats)
{
_stats = stats;
}
public override Task<GetServerInfoReply> GetServerInfo(ServerInfoRequest request, ServerCallContext context)
{
var info = _stats.GetGuildInfo(request.GuildId);
var reply = new GetServerInfoReply()
{
Id = info.Id,
Name = info.Name,
IconUrl = info.IconUrl,
OwnerId = info.OwnerId,
OwnerName = info.Owner,
TextChannels = info.TextChannels,
VoiceChannels = info.VoiceChannels,
MemberCount = info.MemberCount,
CreatedAt = info.CreatedAt.Ticks,
};
reply.Features.AddRange(info.Features);
reply.Emojis.AddRange(info.Emojis.Select(x => new EmojiReply()
{
Name = x.Name,
Url = x.Url,
Code = x.ToString()
}));
reply.Roles.AddRange(info.Roles.Select(x => new RoleReply()
{
Id = x.Id,
Name = x.Name,
IconUrl = x.GetIconUrl() ?? string.Empty,
Color = x.Color.ToString()
}));
return Task.FromResult(reply);
}
}