Add delete configuration flag
This commit is contained in:
parent
dc986457e5
commit
61ef1e0ed9
@ -25,6 +25,18 @@ namespace ChaosBot.Repositories
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void DeleteValue(string key, ulong guildId)
|
||||||
|
{
|
||||||
|
using (ChaosbotContext dbContext = new ChaosbotContext())
|
||||||
|
{
|
||||||
|
Configuration config = dbContext.Configuration
|
||||||
|
.SingleOrDefault(c => c.DiscordGuildId == guildId && c.Key == key);
|
||||||
|
if (config == null) return;
|
||||||
|
dbContext.Remove(config);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static T GetValueFromAppSettings<T>(string key, ulong guildId, T defaultValue)
|
private static T GetValueFromAppSettings<T>(string key, ulong guildId, T defaultValue)
|
||||||
{
|
{
|
||||||
return Program.AppSettingsHandler.GetValue($"Servers:{guildId}:{key}", Program.AppSettingsHandler.GetValue(key, defaultValue));
|
return Program.AppSettingsHandler.GetValue($"Servers:{guildId}:{key}", Program.AppSettingsHandler.GetValue(key, defaultValue));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user