mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Added a feature where the bot will send an image if it detects christopherdj is live when Bossman goes live and vice versa.
This commit is contained in:
@@ -389,3 +389,19 @@ public class RemoveCourtHearingCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync("Updated list of hearings", true);
|
||||
}
|
||||
}
|
||||
|
||||
public class NonceLiveCommand : ICommand
|
||||
{
|
||||
public List<Regex> Patterns => [
|
||||
new Regex(@"^admin togglenonce$")
|
||||
];
|
||||
|
||||
public string? HelpText => "Toggle IsChrisDjLive";
|
||||
public UserRight RequiredRight => UserRight.TrueAndHonest;
|
||||
public TimeSpan Timeout => TimeSpan.FromSeconds(10);
|
||||
public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments, CancellationToken ctx)
|
||||
{
|
||||
botInstance.BotServices.IsChrisDjLive = !botInstance.BotServices.IsChrisDjLive;
|
||||
await botInstance.SendChatMessageAsync($"IsChrisDjLive => {botInstance.BotServices.IsChrisDjLive}", true);
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ public class BotServices
|
||||
private string? _lastDiscordStatus;
|
||||
internal bool IsBmjLive = false;
|
||||
private bool _isBmjLiveSynced = false;
|
||||
internal bool IsChrisDjLive = false;
|
||||
|
||||
// lol
|
||||
internal bool TemporarilyBypassGambaSeshForDiscord = false;
|
||||
@@ -561,12 +562,16 @@ public class BotServices
|
||||
private void OnTwitchStreamStateUpdated(object sender, int channelId, bool isLive)
|
||||
{
|
||||
_logger.Info($"BossmanJack stream event came in. isLive => {isLive}");
|
||||
var settings = Helpers.GetMultipleValues([BuiltIn.Keys.RestreamUrl, BuiltIn.Keys.TwitchBossmanJackUsername]).Result;
|
||||
var settings = Helpers.GetMultipleValues([BuiltIn.Keys.RestreamUrl, BuiltIn.Keys.TwitchBossmanJackUsername, BuiltIn.Keys.BotToyStoryImage]).Result;
|
||||
|
||||
if (isLive)
|
||||
{
|
||||
_chatBot.SendChatMessage($"{settings[BuiltIn.Keys.TwitchBossmanJackUsername].Value} just went live on Twitch! https://www.twitch.tv/{settings[BuiltIn.Keys.TwitchBossmanJackUsername].Value}\r\n" +
|
||||
settings[BuiltIn.Keys.RestreamUrl].Value);
|
||||
if (IsChrisDjLive)
|
||||
{
|
||||
_chatBot.SendChatMessage($"[img]{settings[BuiltIn.Keys.BotToyStoryImage].Value}[/img]", true);
|
||||
}
|
||||
IsBmjLive = true;
|
||||
return;
|
||||
}
|
||||
@@ -677,7 +682,8 @@ public class BotServices
|
||||
private void OnStreamerIsLive(object sender, KickModels.StreamerIsLiveEventModel? e)
|
||||
{
|
||||
if (e == null) return;
|
||||
var channels = Helpers.GetValue(BuiltIn.Keys.KickChannels).Result.JsonDeserialize<List<KickChannelModel>>();
|
||||
var settings = Helpers.GetMultipleValues([BuiltIn.Keys.KickChannels, BuiltIn.Keys.BotToyStoryImage]).Result;
|
||||
var channels = settings[BuiltIn.Keys.KickChannels].JsonDeserialize<List<KickChannelModel>>();
|
||||
if (channels == null)
|
||||
{
|
||||
_logger.Error("Caught null when grabbing Kick channels");
|
||||
@@ -701,6 +707,12 @@ public class BotServices
|
||||
|
||||
_chatBot.SendChatMessage(
|
||||
$"@{user.KfUsername} is live! {e.Livestream.SessionTitle} https://kick.com/{channel.ChannelSlug}", true);
|
||||
|
||||
if (channel.ChannelSlug == "christopherdj")
|
||||
{
|
||||
IsChrisDjLive = true;
|
||||
_chatBot.SendChatMessage($"[img]{settings[BuiltIn.Keys.BotToyStoryImage].Value}[/img]", true);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnStopStreamBroadcast(object sender, KickModels.StopStreamBroadcastEventModel? e)
|
||||
@@ -730,5 +742,6 @@ public class BotServices
|
||||
|
||||
_chatBot.SendChatMessage(
|
||||
$"@{user.KfUsername} is no longer live! :lossmanjack:", true);
|
||||
if (channel.ChannelSlug == "christopherdj") IsChrisDjLive = false;
|
||||
}
|
||||
}
|
||||
@@ -711,10 +711,18 @@ public static class BuiltIn
|
||||
Description = "Whether the Rainbet integration is enabled at all",
|
||||
Default = "false",
|
||||
IsSecret = false,
|
||||
CacheDuration = TimeSpan.FromHours(1)
|
||||
CacheDuration = TimeSpan.FromHours(1),
|
||||
ValueType = SettingValueType.Boolean
|
||||
},
|
||||
new BuiltInSettingsModel
|
||||
{
|
||||
Key = Keys.BotToyStoryImage,
|
||||
Regex = ".+",
|
||||
Description = "Image to use for the Toy Story joke",
|
||||
Default = "https://i.ibb.co/603dk32R/nonce-drop.png",
|
||||
IsSecret = false,
|
||||
CacheDuration = TimeSpan.FromHours(1),
|
||||
ValueType = SettingValueType.Text
|
||||
}
|
||||
];
|
||||
|
||||
@@ -779,5 +787,6 @@ public static class BuiltIn
|
||||
public static string HowlggEnabled = "Howlgg.Enabled";
|
||||
public static string ChipsggEnabled = "Chipsgg.Enabled";
|
||||
public static string RainbetEnabled = "Rainbet.Enabled";
|
||||
public static string BotToyStoryImage = "Bot.ToyStoryImage";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user