mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Added a feature to force gamba messages even while live
This commit is contained in:
@@ -519,3 +519,21 @@ public class StartAlmanacCommand : ICommand
|
|||||||
await botInstance.SendChatMessageAsync("Asked it nicely to start", true);
|
await botInstance.SendChatMessageAsync("Asked it nicely to start", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ToggleForcedGambaMessagesCommand : ICommand
|
||||||
|
{
|
||||||
|
public List<Regex> Patterns => [
|
||||||
|
new Regex("^admin toggle gamba")
|
||||||
|
];
|
||||||
|
|
||||||
|
public string? HelpText => "Toggle forced gamba messages while a stream is running";
|
||||||
|
public UserRight RequiredRight => UserRight.TrueAndHonest;
|
||||||
|
public TimeSpan Timeout => TimeSpan.FromSeconds(10);
|
||||||
|
public RateLimitOptionsModel? RateLimitOptions => null;
|
||||||
|
public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments,
|
||||||
|
CancellationToken ctx)
|
||||||
|
{
|
||||||
|
botInstance.BotServices.TemporarilyForceGambaMessages = !botInstance.BotServices.TemporarilyForceGambaMessages;
|
||||||
|
await botInstance.SendChatMessageAsync($"TemporarilyForceGambaMessages is now {botInstance.BotServices.TemporarilyForceGambaMessages}", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,6 +50,7 @@ public class BotServices
|
|||||||
// lol
|
// lol
|
||||||
internal bool TemporarilyBypassGambaSeshForDiscord;
|
internal bool TemporarilyBypassGambaSeshForDiscord;
|
||||||
internal bool TemporarilySuppressGambaMessages = false;
|
internal bool TemporarilySuppressGambaMessages = false;
|
||||||
|
internal bool TemporarilyForceGambaMessages = false;
|
||||||
|
|
||||||
public BotServices(ChatBot botInstance, CancellationToken ctx)
|
public BotServices(ChatBot botInstance, CancellationToken ctx)
|
||||||
{
|
{
|
||||||
@@ -1188,6 +1189,7 @@ public class BotServices
|
|||||||
|
|
||||||
public async Task<bool> CheckBmjIsLive()
|
public async Task<bool> CheckBmjIsLive()
|
||||||
{
|
{
|
||||||
|
if (TemporarilyForceGambaMessages) return false;
|
||||||
var isLive =
|
var isLive =
|
||||||
(await SettingsProvider.GetValueAsync(BuiltIn.Keys.TwitchGraphQlPersistedCurrentlyLive)).ToBoolean();
|
(await SettingsProvider.GetValueAsync(BuiltIn.Keys.TwitchGraphQlPersistedCurrentlyLive)).ToBoolean();
|
||||||
if (isLive || TemporarilySuppressGambaMessages)
|
if (isLive || TemporarilySuppressGambaMessages)
|
||||||
|
|||||||
Reference in New Issue
Block a user