diff --git a/TelegramBotBase/Base/MessageResult.cs b/TelegramBotBase/Base/MessageResult.cs index 11e33d7..20b2bc6 100644 --- a/TelegramBotBase/Base/MessageResult.cs +++ b/TelegramBotBase/Base/MessageResult.cs @@ -62,6 +62,11 @@ public class MessageResult : ResultBase /// public bool IsBotCommand => MessageText.StartsWith("/"); + /// + /// Is this a bot command sent from a group via @BotId ? + /// + public bool IsBotGroupCommand => IsBotCommand && MessageText.Contains("@"); + /// /// Returns a List of all parameters which has been sent with the command itself (i.e. /start 123 456 789 => /// 123,456,789) @@ -87,12 +92,17 @@ public class MessageResult : ResultBase { get { - if (!IsBotCommand) + if (IsBotGroupCommand) { - return null; + return MessageText.Substring(0, MessageText.LastIndexOf('@')).Split(' ')[0]; } - return MessageText.Split(' ')[0]; + if (IsBotCommand) + { + return MessageText.Split(' ')[0]; + } + + return null; } }