コード例 #1
0
        private async Task ToggleNotificationsAsync(CommandContext ctx, SubscriptionType type)
        {
            DiscordEmbed embed;

            if (await _subscriptionsService.IsChannelSubscribed(ctx.Channel.Id, type))
            {
                await _subscriptionsService.RemoveSubscriptionAsync(ctx.Channel.Id, type);

                embed = _subscriptionEmbedGenerator.BuildMessageOnRemove(type);
            }
            else
            {
                await _subscriptionsService.AddSubscriptionAsync(ctx.Guild.Id, ctx.Channel.Id, type);

                embed = _subscriptionEmbedGenerator.BuildMessageOnAdd(type);
            }

            await ctx.RespondAsync(embed : embed);
        }