Add guildId filtered config settings
This commit is contained in:
parent
9a98960717
commit
cb335bd393
@ -13,6 +13,16 @@ namespace ChaosBot.Database.Repository
|
||||
return AppSettingsHandler.GetValue<T>(configurationFlag);
|
||||
}
|
||||
|
||||
public static T GetValue<T>(string configurationFlag, ulong guildId)
|
||||
{
|
||||
return AppSettingsHandler.GetValue<T>($"Servers:{guildId}:{configurationFlag}");
|
||||
}
|
||||
|
||||
public static T SetValue<T>(string configurationFlag, T value)
|
||||
{
|
||||
return AppSettingsHandler.GetValue<T>(configurationFlag);
|
||||
}
|
||||
|
||||
public static IConfigurationSection GetSection(string configurationFlag)
|
||||
{
|
||||
return AppSettingsHandler.GetSection(configurationFlag);
|
||||
|
||||
@ -59,12 +59,12 @@ namespace ChaosBot.Discord.Modules
|
||||
[RequireUserPermission(GuildPermission.ManageGuild)]
|
||||
public async Task RaffleCommandAdd(string user, int amount = 1)
|
||||
{
|
||||
if (ConfigurationRepository.GetValue<int>($"Servers:{Context.Guild.Id}:Raffle:Max") >= amount)
|
||||
if (ConfigurationRepository.GetValue<int>($"Raffle:Max", Context.Guild.Id) >= amount)
|
||||
await RaffleCommandHelper("add", user, amount);
|
||||
else
|
||||
{
|
||||
await ReplyAsync(
|
||||
$"You cannot give more then {ConfigurationRepository.GetValue<int>($"Servers:{Context.Guild.Id}:Raffle:Max").ToString()} tickets at a time", false);
|
||||
$"You cannot give more then {ConfigurationRepository.GetValue<int>($"Raffle:Max", Context.Guild.Id).ToString()} tickets at a time", false);
|
||||
_logger.Warn($"{Context.User.Username} attempted to give {amount} tickets to {user}!");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user