Sha256: 42973b57abcd358c33c8dc0f9287f64587e169798b98fdecc61c9be871d07c4c
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
require 'telegram/bot' module Mutx module Support class TelegramSender def initialize token=nil, chat_id @token = token || Configuration.telegram_token @chat_id = chat_id end # Send a message to the given group # @param [Fixnum] chat_id = the id of the telegram group # @param [String] message = the message to be sent # @param [String] type of message [Markdown, HTML] def send_message message Telegram::Bot::Client.run(@token) do |bot| bot.api.send_message(chat_id: @chat_id, text: message) end end # Send a message to the given group # @param [Fixnum] chat_id = the id of the telegram group # @param [String] message = the message to be sent # @param [String] type of message [Markdown, HTML] def self.send_message chat_id, message, parse_mode=nil Telegram::Bot::Client.run(Configuration.telegram_token) do |bot| bot.api.send_message(chat_id: chat_id, text: message, parse_mode:parse_mode) end end def self.run_client Telegram::Bot::Client.run(Configuration.telegram_token) do |bot| yield bot end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mutx-0.2.9 | lib/mutx/support/telegram_sender.rb |
mutx-0.2.8 | lib/mutx/support/telegram_sender.rb |
mutx-0.2.7 | lib/mutx/support/telegram_sender.rb |