コード例 #1
0
        private async Task UpdateState(CommandContext ctx, AlertType alertType, bool isSubscribed)
        {
            var userSubs = await _userSubsService.GetOrCreate(ctx.Member.Id, ctx.Guild.Id).ConfigureAwait(false);

            switch (alertType)
            {
            case AlertType.Works: userSubs.Works = isSubscribed;
                break;

            case AlertType.Adventure: userSubs.Adventure = isSubscribed;
                break;

            case AlertType.Training: userSubs.Training = isSubscribed;
                break;
            }

            await _userSubsService.Update(userSubs).ConfigureAwait(false);
        }
コード例 #2
0
        public async Task <bool> IsSubscribed(CommandContext ctx, AlertType alertType)
        {
            var userSubs = await _userSubsService.GetOrCreate(ctx.Member.Id, ctx.Guild.Id).ConfigureAwait(false);

            switch (alertType)
            {
            case AlertType.Works: return(userSubs.Works);

            case AlertType.Adventure: return(userSubs.Adventure);

            case AlertType.Training: return(userSubs.Training);

            default: return(false);
            }
        }