/// <summary> /// Start the message queue. Messages enqueued by <see cref="SendMessageWithQueue(TelegramBot, ChatId, string, bool, bool, int, ReplyMarkupBase)"/> will only be sent after this method was called. /// </summary> /// <param name="Bot">The Telegram Bot object for which the message queue is started</param> /// <param name="parseMode">All messages that are enqueued with <see cref="SendMessageWithQueue(TelegramBot, ChatId, string, bool, bool, int, ReplyMarkupBase)"/> will use this ParseMode.</param> /// <param name="mergeMessages">If this is true, multiple queued messages can be merged into one, seperated by two newlines, for more efficient message sending. Note that messages having a replyToMessageId or replyMarkup will never be merged.</param> public static void StartQueue(this TelegramBot Bot, ParseMode parseMode, bool mergeMessages = true) { if (Bot.IsMessageQueueing) { return; } Bot.IsMessageQueueing = true; Bot._messageQueueParseMode = parseMode; Bot._messageQueueMerging = mergeMessages; Bot._messageQueueThread = new Thread(() => Bot.MessageQueue()); Bot._messageQueueThread.Start(); }