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:
@@ -388,4 +388,20 @@ public class RemoveCourtHearingCommand : ICommand
|
|||||||
await Helpers.SetValueAsJsonObject(BuiltIn.Keys.BotCourtCalendar, hearings);
|
await Helpers.SetValueAsJsonObject(BuiltIn.Keys.BotCourtCalendar, hearings);
|
||||||
await botInstance.SendChatMessageAsync("Updated list of hearings", true);
|
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;
|
private string? _lastDiscordStatus;
|
||||||
internal bool IsBmjLive = false;
|
internal bool IsBmjLive = false;
|
||||||
private bool _isBmjLiveSynced = false;
|
private bool _isBmjLiveSynced = false;
|
||||||
|
internal bool IsChrisDjLive = false;
|
||||||
|
|
||||||
// lol
|
// lol
|
||||||
internal bool TemporarilyBypassGambaSeshForDiscord = false;
|
internal bool TemporarilyBypassGambaSeshForDiscord = false;
|
||||||
@@ -561,12 +562,16 @@ public class BotServices
|
|||||||
private void OnTwitchStreamStateUpdated(object sender, int channelId, bool isLive)
|
private void OnTwitchStreamStateUpdated(object sender, int channelId, bool isLive)
|
||||||
{
|
{
|
||||||
_logger.Info($"BossmanJack stream event came in. isLive => {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)
|
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" +
|
_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);
|
settings[BuiltIn.Keys.RestreamUrl].Value);
|
||||||
|
if (IsChrisDjLive)
|
||||||
|
{
|
||||||
|
_chatBot.SendChatMessage($"[img]{settings[BuiltIn.Keys.BotToyStoryImage].Value}[/img]", true);
|
||||||
|
}
|
||||||
IsBmjLive = true;
|
IsBmjLive = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -677,7 +682,8 @@ public class BotServices
|
|||||||
private void OnStreamerIsLive(object sender, KickModels.StreamerIsLiveEventModel? e)
|
private void OnStreamerIsLive(object sender, KickModels.StreamerIsLiveEventModel? e)
|
||||||
{
|
{
|
||||||
if (e == null) return;
|
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)
|
if (channels == null)
|
||||||
{
|
{
|
||||||
_logger.Error("Caught null when grabbing Kick channels");
|
_logger.Error("Caught null when grabbing Kick channels");
|
||||||
@@ -701,6 +707,12 @@ public class BotServices
|
|||||||
|
|
||||||
_chatBot.SendChatMessage(
|
_chatBot.SendChatMessage(
|
||||||
$"@{user.KfUsername} is live! {e.Livestream.SessionTitle} https://kick.com/{channel.ChannelSlug}", true);
|
$"@{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)
|
private void OnStopStreamBroadcast(object sender, KickModels.StopStreamBroadcastEventModel? e)
|
||||||
@@ -730,5 +742,6 @@ public class BotServices
|
|||||||
|
|
||||||
_chatBot.SendChatMessage(
|
_chatBot.SendChatMessage(
|
||||||
$"@{user.KfUsername} is no longer live! :lossmanjack:", true);
|
$"@{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",
|
Description = "Whether the Rainbet integration is enabled at all",
|
||||||
Default = "false",
|
Default = "false",
|
||||||
IsSecret = false,
|
IsSecret = false,
|
||||||
CacheDuration = TimeSpan.FromHours(1)
|
|
||||||
CacheDuration = TimeSpan.FromHours(1),
|
CacheDuration = TimeSpan.FromHours(1),
|
||||||
ValueType = SettingValueType.Boolean
|
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 HowlggEnabled = "Howlgg.Enabled";
|
||||||
public static string ChipsggEnabled = "Chipsgg.Enabled";
|
public static string ChipsggEnabled = "Chipsgg.Enabled";
|
||||||
public static string RainbetEnabled = "Rainbet.Enabled";
|
public static string RainbetEnabled = "Rainbet.Enabled";
|
||||||
|
public static string BotToyStoryImage = "Bot.ToyStoryImage";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user