added botonguild api endpoint
This commit is contained in:
parent
43f20cbbc2
commit
c3ea830d7b
2 changed files with 22 additions and 1 deletions
|
@ -8,7 +8,7 @@ import "google/protobuf/timestamp.proto";
|
||||||
package other;
|
package other;
|
||||||
|
|
||||||
service GrpcOther {
|
service GrpcOther {
|
||||||
|
rpc BotOnGuild(BotOnGuildRequest) returns (BotOnGuildReply);
|
||||||
rpc GetGuilds(google.protobuf.Empty) returns (GetGuildsReply);
|
rpc GetGuilds(google.protobuf.Empty) returns (GetGuildsReply);
|
||||||
rpc GetTextChannels(GetTextChannelsRequest) returns (GetTextChannelsReply);
|
rpc GetTextChannels(GetTextChannelsRequest) returns (GetTextChannelsReply);
|
||||||
|
|
||||||
|
@ -20,6 +20,14 @@ service GrpcOther {
|
||||||
rpc GetServerInfo(ServerInfoRequest) returns (GetServerInfoReply);
|
rpc GetServerInfo(ServerInfoRequest) returns (GetServerInfoReply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message BotOnGuildRequest {
|
||||||
|
uint64 guildId = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BotOnGuildReply {
|
||||||
|
bool success = 1;
|
||||||
|
}
|
||||||
|
|
||||||
message GetGuildsReply {
|
message GetGuildsReply {
|
||||||
repeated GuildReply guilds = 1;
|
repeated GuildReply guilds = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,19 @@ public sealed class OtherSvc : GrpcOther.GrpcOtherBase, IEService
|
||||||
_cache = cache;
|
_cache = cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[GrpcNoAuthRequired]
|
||||||
|
public override async Task<BotOnGuildReply> BotOnGuild(BotOnGuildRequest request, ServerCallContext context)
|
||||||
|
{
|
||||||
|
var guild = await _client.GetGuildAsync(request.GuildId);
|
||||||
|
|
||||||
|
var reply = new BotOnGuildReply
|
||||||
|
{
|
||||||
|
Success = guild is not null
|
||||||
|
};
|
||||||
|
|
||||||
|
return reply;
|
||||||
|
}
|
||||||
|
|
||||||
public override async Task<GetTextChannelsReply> GetTextChannels(
|
public override async Task<GetTextChannelsReply> GetTextChannels(
|
||||||
GetTextChannelsRequest request,
|
GetTextChannelsRequest request,
|
||||||
ServerCallContext context)
|
ServerCallContext context)
|
||||||
|
|
Loading…
Reference in a new issue