forked from EllieBotDevs/elliebot
Possible fixes for buggy .bye behavior
This commit is contained in:
parent
b506b4461b
commit
de97213046
4 changed files with 53 additions and 150 deletions
src/EllieBot/Services
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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 =
|
||||
|
|
Reference in a new issue