Exemplo n.º 1
0
    public void EngineShouldSplit(string input, params string[] expectedSplit)
    {
        var result = EmotesEngine.Split(input);

        Assert.Equal(expectedSplit.Length, result.Count);

        for (var i = 0; i < expectedSplit.Length; i++)
        {
            Assert.Equal(expectedSplit[i], result[i]);
        }
    }
Exemplo n.º 2
0
    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
        });
    }