예제 #1
0
            public async Task GetEmitterAsync(CommandContext context)
            {
                GuildConfig config = await guildConfig.FindOrCreateConfigAsync(context.Guild.Id);

                if (config.ApiLogin is null)
                {
                    await context.RespondAsync("Please set API Credentials first.");

                    return;
                }

                Emitter emitter = await _emitterClient.GetEmitterAsync(await _apiAuthService.GetOrUpdateAuthTokenAsync(context.Guild.Id));

                if (emitter is null)
                {
                    await context.RespondAsync("No Emitter set for provided credentials.");
                }
                else
                {
                    await context.RespondAsync(embed : Utilities.BuildEmitterEmbed(emitter));
                }
            }
            public async Task GetEmitterAsync(InteractionContext ctx)
            {
                await ctx.CreateResponseAsync(InteractionResponseType.DeferredChannelMessageWithSource, new() { IsEphemeral = true });

                GuildConfig config = await guildConfig.FindOrCreateConfigAsync(ctx.Guild.Id);

                if (config.ApiLogin is null)
                {
                    await ctx.FollowUpAsync("Please set API Credentials first.");

                    return;
                }

                Emitter emitter = await _emitterClient.GetEmitterAsync(await _apiAuthService.GetOrUpdateAuthTokenAsync(ctx.Guild.Id));

                if (emitter is null)
                {
                    await ctx.FollowUpAsync("No Emitter set for provided credentials.");
                }
                else
                {
                    await ctx.FollowUpAsync(new DiscordFollowupMessageBuilder().AddEmbed(Utilities.BuildEmitterEmbed(emitter)));
                }
            }