Notify everyone if Kees H joins

This commit is contained in:
barelyprofessional
2025-03-02 20:56:09 +08:00
parent 1efa808f82
commit a7829470de
2 changed files with 19 additions and 1 deletions

View File

@@ -352,7 +352,7 @@ public class ChatBot
private void OnUsersJoined(object sender, List<UserModel> users, UsersJsonModel jsonPayload)
{
var settings = Helpers.GetMultipleValues([BuiltIn.Keys.GambaSeshUserId, BuiltIn.Keys.GambaSeshDetectEnabled])
var settings = Helpers.GetMultipleValues([BuiltIn.Keys.GambaSeshUserId, BuiltIn.Keys.GambaSeshDetectEnabled, BuiltIn.Keys.BotKeesSeen])
.Result;
_logger.Debug($"Received {users.Count} user join events");
using var db = new ApplicationDbContext();
@@ -372,6 +372,13 @@ public class ChatBot
true);
_yatsLastSeen = DateTimeOffset.UtcNow;
}
if (user.Id == 89776 && !settings[BuiltIn.Keys.BotKeesSeen].ToBoolean())
{
_logger.Info("Kees has joined!");
SendChatMessage($":!: :!: {user.Username} has appeared! :!: :!:", true);
Helpers.SetValueAsBoolean(BuiltIn.Keys.BotKeesSeen, true).Wait(_cancellationToken);
}
_logger.Info($"{user.Username} joined!");
var userDb = db.Users.FirstOrDefault(u => u.KfId == user.Id);

View File

@@ -860,6 +860,16 @@ public static class BuiltIn
IsSecret = false,
CacheDuration = TimeSpan.FromHours(1),
ValueType = SettingValueType.Boolean
},
new BuiltInSettingsModel
{
Key = Keys.BotKeesSeen,
Regex = "(true|false)",
Description = "Track if Kees has been seen so users can receive a one-time notice if he suddenly shows up",
Default = "false",
IsSecret = false,
CacheDuration = TimeSpan.FromHours(1),
ValueType = SettingValueType.Boolean
}
];
@@ -931,5 +941,6 @@ public static class BuiltIn
public static string BotChrisDjLiveImage = "Bot.ChrisDjLiveImage";
public static string DiscordTemporarilyBypassGambaSeshInitialValue =
"Discord.TemporarilyBypassGambaSeshInitialValue";
public static string BotKeesSeen = "Bot.KeesSeen";
}
}