public async Task Signup([Remainder] string emotes) { using var setTyping = Context.Channel.EnterTypingState(); var criteria = new SetSignupEmotesCriteria() { GuildId = Context.Guild.Id, Emotes = emotes }; var result = await _guildOptionsManager.SetSignupEmotes(criteria); if (result.Status == SetSignupEmotesStatus.EmotesNotFound) { await ReplyAsync($"I could not find any valid emotes in your command. Please provide emotes as e.g. '{await GetPrefix()}set signup :white_check_mark:'."); return; } await ReplyAsync("Done."); }
public async Task <SetSignupEmotesResult> SetSignupEmotes(SetSignupEmotesCriteria criteria) { _setSignupEmotesValidator.ValidateAndThrow(criteria); _logger.LogDebug("Setting sign-up emotes options for guild '{GuildId}' with emotes '{Emotes}'.", criteria.GuildId, criteria.Emotes); var emotes = EmotesEngine.Split(criteria.Emotes); if (emotes.Count == 0) { _logger.LogDebug("Valid emotes were not found."); return(new SetSignupEmotesResult() { Status = SetSignupEmotesStatus.EmotesNotFound }); } var getOptionsQuery = new GetOptionsQuery() { GuildId = criteria.GuildId }; var options = await _guildAccessor.GetOptions(getOptionsQuery) ?? new GuildOptions(); options.Id = criteria.GuildId; options.SignupEmotes = emotes; var saveOptionsQuery = new SaveOptionsQuery() { Options = options }; await _guildAccessor.SaveOptions(saveOptionsQuery); return(new SetSignupEmotesResult() { Status = SetSignupEmotesStatus.Success }); }