more checks when to delete old text commands

This commit is contained in:
13xforever
2025-03-27 09:46:57 +05:00
parent e54e91b372
commit 7da98158f6
2 changed files with 6 additions and 1 deletions

View File

@@ -28,7 +28,11 @@ internal static partial class CommandErroredHandler
Context: TextCommandContext tctx
})
{
if (tctx.Prefix == Config.CommandPrefix || tctx.Prefix == Config.AutoRemoveCommandPrefix)
// if it has a command prefix, check that it's not a random string of punctuation
if ((tctx.Prefix == Config.CommandPrefix
|| tctx.Prefix == Config.AutoRemoveCommandPrefix)
&& tctx.Message.Content[tctx.Prefix.Length ..] is {Length: >0} args
&& !char.IsPunctuation(args[0]))
{
try
{

View File

@@ -20,6 +20,7 @@ internal class BotDb: DbContext
public DbSet<Kot> Kot { get; set; } = null!;
public DbSet<Doggo> Doggo { get; set; } = null!;
public DbSet<ForcedNickname> ForcedNicknames { get; set; } = null!;
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
var dbPath = DbImporter.GetDbPath("bot.db", Environment.SpecialFolder.ApplicationData);