Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="chatId"></param>
        /// <returns></returns>
        public virtual T GetBackCommand <T>(long chatId) where T : class, ITelegramBotCommand
        {
            var user = TelegramBotDb.Users.FindOne(f => f.ChatId == chatId);

            if (user == null)
            {
                return(default(T));
            }

            return(TelegramBotCommandFactory.GetCommandByClrName(user.BackCommand) as T);
        }
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public virtual T GetBackCommandHandler <T>() where T : class, ITelegramBotCommand
        {
            var user = TelegramBotDb.Users.FindOne(f => f.ChatId == MessageService.Message.Chat.Id);

            if (user == null)
            {
                return(default(T));
            }

            return(TelegramBotCommandFactory.GetCommandByClrName(user.BackCommandHandler) as T);
        }