Afk messages should now be sent in DMs to prevent abuse

Also updated EllieBot.sln
This commit is contained in:
Toastie (DCS Team) 2024-08-08 13:37:39 +12:00
parent 7a82f262f8
commit 6e0a129bc0
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
2 changed files with 3 additions and 3 deletions

View file

@ -13,7 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
migrate.ps1 = migrate.ps1 migrate.ps1 = migrate.ps1
README.md = README.md README.md = README.md
remove-migrations.ps1 = remove-migrations.ps1 remove-migrations.ps1 = remove-migrations.ps1
TODO.md = TODO.md
EndProjectSection EndProjectSection
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EllieBot", "src\EllieBot\EllieBot.csproj", "{4D9001F7-B3E8-48FE-97AA-CFD36DA65A64}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EllieBot", "src\EllieBot\EllieBot.csproj", "{4D9001F7-B3E8-48FE-97AA-CFD36DA65A64}"

View file

@ -74,7 +74,7 @@ public sealed class AfkService : IEService, IReadyExecutor
private Task TryTriggerAfkMessage(SocketMessage arg) private Task TryTriggerAfkMessage(SocketMessage arg)
{ {
if (arg.Author.IsBot) if (arg.Author.IsBot || arg.Author.IsWebhook)
return Task.CompletedTask; return Task.CompletedTask;
if (arg is not IUserMessage uMsg || uMsg.Channel is not ITextChannel tc) if (arg is not IUserMessage uMsg || uMsg.Channel is not ITextChannel tc)
@ -126,9 +126,10 @@ public sealed class AfkService : IEService, IReadyExecutor
{ {
var st = SmartText.CreateFrom(msg); var st = SmartText.CreateFrom(msg);
st = "The user is AFK: " + st; st = $"The user you've pinged ({arg.Author}) is AFK: " + st;
var toDelete = await _mss.Response(arg.Channel) var toDelete = await _mss.Response(arg.Channel)
.User(arg.Author)
.Message(uMsg) .Message(uMsg)
.Text(st) .Text(st)
.Sanitize(false) .Sanitize(false)