Ejemplo n.º 1
0
        public static async void Inline_Next(ITelegramBotClient telegramBot, long cid, int mid, string text)
        {
            var pagesInfo = text.Substring(text.IndexOf('[') + 1, text.IndexOf(']') - 1);
            var parts     = pagesInfo.Split('/');

            try
            {
                if (parts[0] != parts[1])
                {
                    int nextIndex = int.Parse(parts[0]) + 1;
                    int quantity  = int.Parse(parts[1]);

                    var    nextResult = PaginationHistory.getInstance().GetByMessageId(mid).ToArray();
                    string message    = "<b>[" + nextIndex + "/" + quantity + "] </b>" + nextResult[nextIndex - 1];

                    await telegramBot.EditMessageTextAsync(cid, mid, message, ParseMode.Html, false, Inline);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(cid + " clicked to fast at 'next arrow': " + ex.Message);
            }
        }
 public static PaginationHistory getInstance()
 {
     return(Instance ?? (Instance = new PaginationHistory()));
 }