/// <summary> /// Send a telegram message to the chat ID specified, supply token for custom bot. /// Note: Requires bot to have chat with user or be in the group specified by ID. /// </summary> /// <param name="user">Chat or group ID to send message to</param> /// <param name="message">Message to send</param> /// <param name="token">Bot token to use for this message</param> public bool Telegram(string id, string message, string token = null) { if (!Allow()) { return(false); } var telegram = new NotificationTelegram(id, message, token); Messages.Enqueue(telegram); return(true); }
/// <summary> /// Send message to telegram chanel /// </summary> /// <param name="message"></param> /// <returns></returns> public bool Telegram(string message) { if (!Allow()) { return(false); } string token = Config.Get("token"); string chat_id = Config.Get("chat_id"); if (token == "" || chat_id == "") { Log.Error($"token = {token}, chat_id={chat_id}. Add token and chat_id to config.json"); return(false); } var web = new NotificationTelegram(token, chat_id, message); Messages.Enqueue(web); return(true); }