Added GarbageMessageHandler "garbage" command to SPT Friend

Fixed namespaces
This commit is contained in:
Chomp
2025-02-07 12:06:39 +00:00
parent 372cad6732
commit 7da0ac6fa9
3 changed files with 43 additions and 3 deletions
@@ -1,11 +1,10 @@
using Core.Helpers.Dialogue.SPTFriend.Commands;
using Core.Models.Eft.Common;
using Core.Models.Eft.Profile;
using Core.Services;
using Core.Utils;
using SptCommon.Annotations;
namespace Core.Helpers.Dialogue.SptMessageHandlers;
namespace Core.Helpers.Dialogue.SPTFriend.Commands;
[Injectable]
public class AreYouABotMessageHandler(
@@ -0,0 +1,42 @@
using Core.Models.Eft.Common;
using Core.Models.Eft.Profile;
using Core.Services;
using Core.Utils;
using SptCommon.Annotations;
namespace Core.Helpers.Dialogue.SPTFriend.Commands;
[Injectable]
public class GarbageMessageHandler(
MailSendService _mailSendService,
RandomUtil _randomUtil) : IChatMessageHandler
{
public int GetPriority()
{
return 100;
}
public bool CanHandle(string message)
{
return message.ToLower() == "garbage";
}
public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData sender)
{
var beforeCollect = GC.GetTotalMemory(false) / 1024 / 1024;
GC.Collect(GC.MaxGeneration, GCCollectionMode.Aggressive, true, true);
var afterCollect = GC.GetTotalMemory(false) / 1024 / 1024;
_mailSendService.SendUserMessageToPlayer(
sessionId,
sptFriendUser,
$"Before: {beforeCollect}MB, After: {afterCollect}MB",
[],
null
);
}
}
@@ -1,4 +1,3 @@
using Core.Helpers.Dialog.Commando.SptCommands;
using Core.Models.Eft.Common;
using Core.Models.Eft.Dialog;
using Core.Models.Eft.Profile;