Possible fixes for buggy .bye behavior

This commit is contained in:
Toastie 2024-10-03 17:51:01 +13:00
parent b506b4461b
commit de97213046
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
4 changed files with 53 additions and 150 deletions
src/EllieBot/Services

View file

@ -1,50 +0,0 @@
using EllieBot.GrpcApi;
using Grpc.Core;
namespace EllieBot.GrpcApi;
public sealed class ServerInfoSvc : GrpcInfo.GrpcInfoBase, IEService
{
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);
}
}

View file

@ -15,18 +15,15 @@ public class GrpcApiService : IEService, IReadyExecutor
private readonly OtherSvc _other;
private readonly ExprsSvc _exprs;
private readonly ServerInfoSvc _info;
private readonly GreetByeSvc _greet;
public GrpcApiService(
OtherSvc other,
ExprsSvc exprs,
ServerInfoSvc info,
GreetByeSvc greet)
{
_other = other;
_exprs = exprs;
_info = info;
_greet = greet;
}
@ -43,7 +40,6 @@ public class GrpcApiService : IEService, IReadyExecutor
{
GrpcOther.BindService(_other),
GrpcExprs.BindService(_exprs),
GrpcInfo.BindService(_info),
GrpcGreet.BindService(_greet)
},
Ports =