public async Task SetPrefixCmd([Summary("If not specified, restores default prefix")] string prefix = null)
        {
            if (!string.IsNullOrEmpty(prefix) && prefix.Length > 32)
            {
                await ReplyAsync("Prefix can't be longer than 32 characters!"); // TODO: Use Post-Execution handler

                return;
            }
            GuildSettings settings = _guildSettingsCache.GetOrAddGuildSettings(Context.Guild.Id);

            settings.Prefix = prefix;
            _guildSettingsCache.UpsertGuildSettings(settings);
            await ReplyAsync($"Current prefix: {prefix ?? _config.Prefix}");
        }
Beispiel #2
0
        public async Task <RuntimeResult> SetPrefixCmd([Summary("If not specified, restores default prefix")] string prefix = null)
        {
            if (!string.IsNullOrEmpty(prefix) && prefix.Length > 32)
            {
                return(new PrefixLengthError());
            }
            GuildSettings settings = _guildSettingsCache.GetOrAddGuildSettings(Context.Guild.Id);

            settings.Prefix = prefix;
            _guildSettingsCache.UpsertGuildSettings(settings);
            await ReplyAsync($"Current prefix: {prefix ?? _config.Prefix}");

            return(new SuccessResult());
        }