public async Task GetSettingsValue(string key) { var guild = ((SocketGuildChannel)Context.Channel).Guild; var settingValue = await _guildSettingsFactory.GetGuildSettingByKey <string>(guild.Id, key); if (string.IsNullOrEmpty(settingValue)) { await ReplyAsync("Couldn't find the requested setting"); } await ReplyAsync(settingValue); }
public async Task Reddit(string subreddit, int amountOfRequests) { var guild = ((SocketGuildChannel)Context.Channel).Guild; //If the amount of requests is more than one ensure that it doesn't exceed the configured max requests. if (amountOfRequests > 1) { var maxBulkSetting = await _guildSettingsFactory.GetGuildSettingByKey <int>(guild.Id, DefaultSettingKeys.Bulk); var max = maxBulkSetting > 0 ? maxBulkSetting : 20; if (amountOfRequests > max) { await ReplyAsync($"You can't place more than {max} requests at once."); return; } } await Context.Channel.TriggerTypingAsync(); await _queueFactory.AddToQueue(guild.Id, subreddit, Domain.Models.PostType.Image, ((SocketGuildChannel)Context.Channel).Id, amountOfRequests); }