diff --git a/TelegramBotBase/Base/FormBase.cs b/TelegramBotBase/Base/FormBase.cs index 7557348..4b22b1c 100644 --- a/TelegramBotBase/Base/FormBase.cs +++ b/TelegramBotBase/Base/FormBase.cs @@ -447,4 +447,10 @@ public class FormBase : IDisposable Controls.Remove(c); } } + + /// + /// Returns if this instance is a subclass of AutoCleanForm. Necessary to prevent message deletion if not necessary. + /// + public bool IsAutoCleanForm() => this.GetType().IsSubclassOf(typeof(AutoCleanForm)); + } \ No newline at end of file diff --git a/TelegramBotBase/Controls/Hybrid/TaggedButtonGrid.cs b/TelegramBotBase/Controls/Hybrid/TaggedButtonGrid.cs index c12aced..9db6a87 100644 --- a/TelegramBotBase/Controls/Hybrid/TaggedButtonGrid.cs +++ b/TelegramBotBase/Controls/Hybrid/TaggedButtonGrid.cs @@ -455,7 +455,7 @@ public class TaggedButtonGrid : MultiView if (result.MessageText == "📁") { //Remove button click message - if (DeletePreviousMessage) + if (DeletePreviousMessage && !Device.ActiveForm.IsAutoCleanForm()) { await Device.DeleteMessage(result.MessageId); }