tg-bot 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: faaae8ef51132665672bfcb0606d77f7a9a0fa8b3f220130b6bebe53d4745bae
4
- data.tar.gz: cb444a9ebb904e20137aa714131741d3d4ccc4fbba4e7f2fb4853129022897dc
3
+ metadata.gz: 138aa4dfb58a1e2fef7023fdf389ab3ea6756e057a03f1c37a71212d446c2451
4
+ data.tar.gz: c0d174a4e659b6d8b7cb9e863dfd34dd1aeab30c68d67fc8f54f5330769889fd
5
5
  SHA512:
6
- metadata.gz: 689c2faa4ec6f9a05d2d043756117245db544e2eae46a4c29b4e04db6dd5269ceafc10f01b24c644a8dd8b4266c29571865af0406ce2be6548e4e56041a3596f
7
- data.tar.gz: 61bcef6bd2f5c1b5e4b1e8f5d3b13bbbf86464e2b63c9e1001af21f039c0093b4f268778a7ecbffac4fd42f114dd787fda1104610fc28b7ed1b17ec025486e8c
6
+ metadata.gz: 3e7a401f78e1121a0f90fa32e2cc56cf77467312a9611c97d16d1e589ee089ae0458a7ae726f0174289dc9799a2a465e3cedab157e510c35b6472799ab2a4755
7
+ data.tar.gz: 4874ded1b7678473c11050ac899d6df85c47fdb4bf7dc68f69abc94462f6673e38398e3b1a04c946dd637ddef6bb4103a566e8a3098308fbe189ca88fb8c852d
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # tg-bot
2
+ > A simple Telegram Bot gem for Ruby on Rails
3
+
4
+ # Usage
5
+ 1. Setup your ENV
6
+ - Use bash to set environment variable
7
+ ```bash
8
+ export telegram_bot_token='Your bot token'
9
+ ```
10
+ - Use [figaro](https://github.com/laserlemon/figaro) gem to set environment variable
11
+ ```yaml
12
+ telegram_bot_token: Your bot token
13
+ ```
14
+ 2. Add this gem to your `Gemfile`
15
+ ```ruby
16
+ gem 'tg-bot', '~> 0.0.2'
17
+ ```
18
+ 3. Setup your Controller
19
+ > e.g. my webhook is https://xxxxx/telegram
20
+ ```ruby
21
+ def telegram
22
+ telegram = Telegram::Bot.new(params)
23
+ end
24
+ ```
25
+
26
+ 4. It has 3 ways to reply message
27
+ ```ruby
28
+ def telegram
29
+ telegram = Telegram::Bot.new(params)
30
+
31
+ # 1. reply text message
32
+ telegram.send_message(text: 'enter what you want to reply')
33
+
34
+ # 2. reply forward_message
35
+ telegram.forward_message( chat_id: 'The chatroom you want to reply',
36
+ from_chat_id: 'The chatroom you want to forward',
37
+ message_id: 'The message you want to forward')
38
+
39
+ # 3. reply photo by file or string
40
+ telegram.send_photo(photo: "https://picsum.photos/200/300/?random=#{Random.new_seed}")
41
+ end
42
+ ```
43
+
44
+ # Methods
45
+ ## setWebhook
46
+ ```ruby
47
+ def xxx
48
+ Telegram::Bot.SetWebhook(url)
49
+ end
50
+ ```
@@ -1,4 +1,4 @@
1
- require 'telegram_bot/params/shared/chat_component'
1
+ require 'telegram/params/shared/chat_component'
2
2
 
3
3
  module Telegram
4
4
  module Params
@@ -1,4 +1,4 @@
1
- require 'telegram_bot/params/shared/chat_component'
1
+ require 'telegram/params/shared/chat_component'
2
2
 
3
3
  module Telegram
4
4
  module Params
@@ -1,4 +1,4 @@
1
- require 'telegram_bot/params/shared/user_component'
1
+ require 'telegram/params/shared/user_component'
2
2
 
3
3
  module Telegram
4
4
  module Params
@@ -1,4 +1,4 @@
1
- require 'telegram_bot/params/shared/user_component'
1
+ require 'telegram/params/shared/user_component'
2
2
 
3
3
  module Telegram
4
4
  module Params
@@ -1,4 +1,4 @@
1
- require 'telegram_bot/params'
1
+ require 'telegram/params'
2
2
 
3
3
  module Telegram
4
4
  module Params
@@ -0,0 +1,5 @@
1
+ require 'telegram/params/chat'
2
+ require 'telegram/params/forward_chat'
3
+ require 'telegram/params/forward_from'
4
+ require 'telegram/params/from'
5
+ require 'telegram/params/message'
@@ -0,0 +1,3 @@
1
+ require 'telegram/reply/send_message'
2
+ require 'telegram/reply/forward_message'
3
+ require 'telegram/reply/send_photo'
@@ -1,5 +1,5 @@
1
- require 'telegram_bot/url'
2
- require 'telegram_bot/reply/request'
1
+ require 'telegram/url'
2
+ require 'telegram/reply/request'
3
3
 
4
4
  module Telegram
5
5
  module Reply
@@ -1,5 +1,5 @@
1
- require 'telegram_bot/url'
2
- require 'telegram_bot/reply/request'
1
+ require 'telegram/url'
2
+ require 'telegram/reply/request'
3
3
 
4
4
  module Telegram
5
5
  module Reply
@@ -1,5 +1,5 @@
1
- require 'telegram_bot/url'
2
- require 'telegram_bot/reply/request'
1
+ require 'telegram/url'
2
+ require 'telegram/reply/request'
3
3
 
4
4
  module Telegram
5
5
  module Reply
@@ -1,5 +1,5 @@
1
1
  module Telegram
2
2
  module Bot
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  require 'net/http'
2
- require 'telegram_bot/replies'
3
- require 'telegram_bot/params'
2
+ require 'telegram/replies'
3
+ require 'telegram/params'
4
4
 
5
5
  module Telegram
6
6
  class Bot
@@ -22,8 +22,8 @@ module Telegram
22
22
  end
23
23
 
24
24
  class << self
25
- def setWebhook(url)
26
- uri = URI("https://api.telegram.org/bot#{ENV['telegram_bot_token']}/setWebhook?url=#{url}")
25
+ def SetWebhook(url)
26
+ uri = URI("https://api.telegram.org/bot#{ENV['telegram_token']}/setWebhook?url=#{url}")
27
27
  Net::HTTP.get(uri)
28
28
  end
29
29
  end
data/telegram_bot.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
- require "telegram_bot/version"
3
+ require "telegram/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'tg-bot'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tg-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vense Chang
@@ -17,22 +17,23 @@ extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
19
  - ".gitignore"
20
- - lib/telegram_bot.rb
21
- - lib/telegram_bot/params.rb
22
- - lib/telegram_bot/params/chat.rb
23
- - lib/telegram_bot/params/forward_chat.rb
24
- - lib/telegram_bot/params/forward_from.rb
25
- - lib/telegram_bot/params/from.rb
26
- - lib/telegram_bot/params/message.rb
27
- - lib/telegram_bot/params/shared/chat_component.rb
28
- - lib/telegram_bot/params/shared/user_component.rb
29
- - lib/telegram_bot/replies.rb
30
- - lib/telegram_bot/reply/forward_message.rb
31
- - lib/telegram_bot/reply/request.rb
32
- - lib/telegram_bot/reply/send_message.rb
33
- - lib/telegram_bot/reply/send_photo.rb
34
- - lib/telegram_bot/url.rb
35
- - lib/telegram_bot/version.rb
20
+ - README.md
21
+ - lib/telegram/params.rb
22
+ - lib/telegram/params/chat.rb
23
+ - lib/telegram/params/forward_chat.rb
24
+ - lib/telegram/params/forward_from.rb
25
+ - lib/telegram/params/from.rb
26
+ - lib/telegram/params/message.rb
27
+ - lib/telegram/params/shared/chat_component.rb
28
+ - lib/telegram/params/shared/user_component.rb
29
+ - lib/telegram/replies.rb
30
+ - lib/telegram/reply/forward_message.rb
31
+ - lib/telegram/reply/request.rb
32
+ - lib/telegram/reply/send_message.rb
33
+ - lib/telegram/reply/send_photo.rb
34
+ - lib/telegram/url.rb
35
+ - lib/telegram/version.rb
36
+ - lib/tg-bot.rb
36
37
  - telegram_bot.gemspec
37
38
  homepage: https://github.com/VenseChang/telegram-bot-gem.git
38
39
  licenses:
@@ -1,5 +0,0 @@
1
- require 'telegram_bot/params/chat'
2
- require 'telegram_bot/params/forward_chat'
3
- require 'telegram_bot/params/forward_from'
4
- require 'telegram_bot/params/from'
5
- require 'telegram_bot/params/message'
@@ -1,3 +0,0 @@
1
- require 'telegram_bot/reply/send_message'
2
- require 'telegram_bot/reply/forward_message'
3
- require 'telegram_bot/reply/send_photo'
File without changes
File without changes