mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-16 11:02:44 -04:00
Notify everyone if Kees H joins
This commit is contained in:
@@ -352,7 +352,7 @@ public class ChatBot
|
|||||||
|
|
||||||
private void OnUsersJoined(object sender, List<UserModel> users, UsersJsonModel jsonPayload)
|
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;
|
.Result;
|
||||||
_logger.Debug($"Received {users.Count} user join events");
|
_logger.Debug($"Received {users.Count} user join events");
|
||||||
using var db = new ApplicationDbContext();
|
using var db = new ApplicationDbContext();
|
||||||
@@ -372,6 +372,13 @@ public class ChatBot
|
|||||||
true);
|
true);
|
||||||
_yatsLastSeen = DateTimeOffset.UtcNow;
|
_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!");
|
_logger.Info($"{user.Username} joined!");
|
||||||
|
|
||||||
var userDb = db.Users.FirstOrDefault(u => u.KfId == user.Id);
|
var userDb = db.Users.FirstOrDefault(u => u.KfId == user.Id);
|
||||||
|
|||||||
@@ -860,6 +860,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.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 BotChrisDjLiveImage = "Bot.ChrisDjLiveImage";
|
||||||
public static string DiscordTemporarilyBypassGambaSeshInitialValue =
|
public static string DiscordTemporarilyBypassGambaSeshInitialValue =
|
||||||
"Discord.TemporarilyBypassGambaSeshInitialValue";
|
"Discord.TemporarilyBypassGambaSeshInitialValue";
|
||||||
|
public static string BotKeesSeen = "Bot.KeesSeen";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user