mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Disable juicers while Austin is live
This commit is contained in:
@@ -21,7 +21,11 @@ public class JuiceCommand : ICommand
|
|||||||
// Have to attach the entity because it is coming from another DB context
|
// Have to attach the entity because it is coming from another DB context
|
||||||
// https://stackoverflow.com/questions/52718652/ef-core-sqlite-sqlite-error-19-unique-constraint-failed
|
// https://stackoverflow.com/questions/52718652/ef-core-sqlite-sqlite-error-19-unique-constraint-failed
|
||||||
db.Users.Attach(user);
|
db.Users.Attach(user);
|
||||||
var juicerSettings = await Helpers.GetMultipleValues([BuiltIn.Keys.JuiceAmount, BuiltIn.Keys.JuiceCooldown, BuiltIn.Keys.JuiceLoserDivision, BuiltIn.Keys.GambaSeshDetectEnabled]);
|
var juicerSettings = await Helpers.GetMultipleValues([
|
||||||
|
BuiltIn.Keys.JuiceAmount, BuiltIn.Keys.JuiceCooldown, BuiltIn.Keys.JuiceLoserDivision,
|
||||||
|
BuiltIn.Keys.GambaSeshDetectEnabled, BuiltIn.Keys.JuiceAllowedWhileStreaming,
|
||||||
|
BuiltIn.Keys.TwitchBossmanJackUsername
|
||||||
|
]);
|
||||||
var cooldown = juicerSettings[BuiltIn.Keys.JuiceCooldown].ToType<int>();
|
var cooldown = juicerSettings[BuiltIn.Keys.JuiceCooldown].ToType<int>();
|
||||||
var amount = juicerSettings[BuiltIn.Keys.JuiceAmount].ToType<int>();
|
var amount = juicerSettings[BuiltIn.Keys.JuiceAmount].ToType<int>();
|
||||||
if (user.UserRight == UserRight.Loser) amount /= juicerSettings[BuiltIn.Keys.JuiceLoserDivision].ToType<int>();
|
if (user.UserRight == UserRight.Loser) amount /= juicerSettings[BuiltIn.Keys.JuiceLoserDivision].ToType<int>();
|
||||||
@@ -31,6 +35,14 @@ public class JuiceCommand : ICommand
|
|||||||
await botInstance.SendChatMessageAsync("Looks like GambaSesh isn't here. If he is, get him to say something then try again.", true);
|
await botInstance.SendChatMessageAsync("Looks like GambaSesh isn't here. If he is, get him to say something then try again.", true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!juicerSettings[BuiltIn.Keys.JuiceAllowedWhileStreaming].ToBoolean() && botInstance.BotServices.IsBmjLive)
|
||||||
|
{
|
||||||
|
await botInstance.SendChatMessageAsync(
|
||||||
|
$"No juicers permitted while {juicerSettings[BuiltIn.Keys.TwitchBossmanJackUsername].Value} is live!", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (lastJuicer.Count == 0)
|
if (lastJuicer.Count == 0)
|
||||||
{
|
{
|
||||||
await botInstance.SendChatMessageAsync($"!juice {message.Author.Id} {amount}", true);
|
await botInstance.SendChatMessageAsync($"!juice {message.Author.Id} {amount}", true);
|
||||||
|
|||||||
@@ -920,6 +920,16 @@ public static class BuiltIn
|
|||||||
IsSecret = false,
|
IsSecret = false,
|
||||||
CacheDuration = TimeSpan.FromHours(1),
|
CacheDuration = TimeSpan.FromHours(1),
|
||||||
ValueType = SettingValueType.Boolean
|
ValueType = SettingValueType.Boolean
|
||||||
|
},
|
||||||
|
new BuiltInSettingsModel
|
||||||
|
{
|
||||||
|
Key = Keys.JuiceAllowedWhileStreaming,
|
||||||
|
Regex = "(true|false)",
|
||||||
|
Description = "Whether to allow juicers while Austin is streaming",
|
||||||
|
Default = "false",
|
||||||
|
IsSecret = false,
|
||||||
|
CacheDuration = TimeSpan.FromHours(1),
|
||||||
|
ValueType = SettingValueType.Boolean
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -997,5 +1007,6 @@ public static class BuiltIn
|
|||||||
public static string BotAlmanacText = "Bot.Almanac.Text";
|
public static string BotAlmanacText = "Bot.Almanac.Text";
|
||||||
public static string BotAlmanacInterval = "Bot.Almanac.Interval";
|
public static string BotAlmanacInterval = "Bot.Almanac.Interval";
|
||||||
public static string BotAlmanacInitialState = "Bot.Almanac.InitialState";
|
public static string BotAlmanacInitialState = "Bot.Almanac.InitialState";
|
||||||
|
public static string JuiceAllowedWhileStreaming = "Juice.AllowedWhileStreaming";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user