te_bot 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7d234f02d1972e727baf9fbc6576e7d9f2ef437c10ccdeb3cc208c3f2f3dd092
4
+ data.tar.gz: b5f032d95cab54dec2387cd9e1ad662d05f846f73247c8c64aa233e837e92678
5
+ SHA512:
6
+ metadata.gz: e810fb8f9052cd7c8ee2727acfbed634422a503f918b2d0e02a3a382228696c7d6d8cc493861958a95188644b127f31d8739fcaceaa6e2e2cd41bbf5fe3bec70
7
+ data.tar.gz: 9fb92b63eda3eda8b522e6455ee989fec4267809f6cf60819dfc082fbf02745e60a1e9378abe0f0ee8501dc083aeca65fe1e0ce06b8ea62216dbc1bf1a178519
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/testdouble/standard
3
+ ruby_version: 2.6
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-06-25
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at nap.aripurna@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in te_bot.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+ gem "minitest", "~> 5.0"
10
+ gem "standard", "~> 1.3"
11
+ gem "byebug", "~> 11.1"
12
+ gem "webmock", "~> 3.14"
13
+ gem "rack-test", "~> 2.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,72 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ te_bot (0.1.0)
5
+ faraday (~> 2.3)
6
+ rack (~> 2.2)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.8.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
13
+ ast (2.4.2)
14
+ byebug (11.1.3)
15
+ crack (0.4.5)
16
+ rexml
17
+ faraday (2.3.0)
18
+ faraday-net_http (~> 2.0)
19
+ ruby2_keywords (>= 0.0.4)
20
+ faraday-net_http (2.0.3)
21
+ hashdiff (1.0.1)
22
+ minitest (5.16.1)
23
+ parallel (1.22.1)
24
+ parser (3.1.2.0)
25
+ ast (~> 2.4.1)
26
+ public_suffix (4.0.7)
27
+ rack (2.2.3.1)
28
+ rack-test (2.0.0)
29
+ rack (>= 1.3)
30
+ rainbow (3.1.1)
31
+ rake (13.0.6)
32
+ regexp_parser (2.5.0)
33
+ rexml (3.2.5)
34
+ rubocop (1.29.1)
35
+ parallel (~> 1.10)
36
+ parser (>= 3.1.0.0)
37
+ rainbow (>= 2.2.2, < 4.0)
38
+ regexp_parser (>= 1.8, < 3.0)
39
+ rexml (>= 3.2.5, < 4.0)
40
+ rubocop-ast (>= 1.17.0, < 2.0)
41
+ ruby-progressbar (~> 1.7)
42
+ unicode-display_width (>= 1.4.0, < 3.0)
43
+ rubocop-ast (1.18.0)
44
+ parser (>= 3.1.1.0)
45
+ rubocop-performance (1.13.3)
46
+ rubocop (>= 1.7.0, < 2.0)
47
+ rubocop-ast (>= 0.4.0)
48
+ ruby-progressbar (1.11.0)
49
+ ruby2_keywords (0.0.5)
50
+ standard (1.12.1)
51
+ rubocop (= 1.29.1)
52
+ rubocop-performance (= 1.13.3)
53
+ unicode-display_width (2.2.0)
54
+ webmock (3.14.0)
55
+ addressable (>= 2.8.0)
56
+ crack (>= 0.3.2)
57
+ hashdiff (>= 0.4.0, < 2.0.0)
58
+
59
+ PLATFORMS
60
+ x86_64-linux
61
+
62
+ DEPENDENCIES
63
+ byebug (~> 11.1)
64
+ minitest (~> 5.0)
65
+ rack-test (~> 2.0)
66
+ rake (~> 13.0)
67
+ standard (~> 1.3)
68
+ te_bot!
69
+ webmock (~> 3.14)
70
+
71
+ BUNDLED WITH
72
+ 2.3.11
data/README.md ADDED
@@ -0,0 +1,132 @@
1
+ # ::TeBot
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/te_bot`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ This gem is used to handle telegram webhook and sending message with telegram bot
6
+
7
+ ## Installation
8
+
9
+ Install the gem and add to the application's Gemfile
10
+
11
+ gem "te_bot", github: "aaripurna/te_bot"
12
+ Then run
13
+
14
+ $ bundle install
15
+
16
+ If bundler is not being used to manage dependencies, install the gem by executing:
17
+
18
+ $ gem install te_bot -l https://github.com/aaripurna/te_bot.git
19
+
20
+ ## Usage
21
+
22
+ ### Webhook
23
+ This gem can be used as a standalone app since it implement rack interface. To use it as a standalone app, you need to define the webhook
24
+ ```rb
25
+ # app.rb
26
+
27
+ require "te_bot"
28
+
29
+ class MyWebhookApp < TeBot::Court
30
+ access_token ENV["YOUR_BOT_ACCESS_TOKEN"]
31
+
32
+ command("/start") do |conn, params|
33
+ reply(conn, "Welcome aboard my friend!")
34
+ end
35
+
36
+ command("/today") do |conn, params|
37
+ reply(conn, Time.now.to_s)
38
+ end
39
+ end
40
+ ```
41
+
42
+ To run this as a standalone app, you need to install `rack` and a webserver such as `puma`
43
+
44
+ $ bundle add rack puma
45
+ create a file named `config.ru` as the rack entrypoint.
46
+
47
+ ```rb
48
+ # config.ru
49
+
50
+ require_relative "./app"
51
+
52
+ run MyWebhookApp.new
53
+ ```
54
+ To run the app we can use rackup
55
+
56
+ $ bundle exec rackup
57
+
58
+ For more detailed information about rack please visit [Rack Repository](https://github.com/rack/rack).
59
+
60
+ Now, our `MyWebhookApp` class is ready to handle some commands from telegram bot which are `/start` and `/today`.
61
+ The command aslo support argument that will be passed to the `#command` block as `params`. To pass arguments, we can simply type `/today city:Jakarta limit:10`. The argument will be parsed as a Hash with string key => `{"city" => "Jakarta", "limit" => "10"}`. While the parameter `conn` is the message object which contains the full message including the chat_id to repy to.
62
+
63
+ To add a default handler for non existing command we can use the `#default_command` macro.
64
+
65
+ ```rb
66
+ # app.rb
67
+
68
+ class MyWebhookApp < TeBot::Court
69
+ default_command do |conn, params|
70
+ reply(conn, "Sorry, Comand not found. Try another command. or type /help")
71
+ end
72
+ end
73
+ ```
74
+
75
+ Other type of messages are also supported by using this macros `text` for regular text message, `query`, `document`, `audio`, and `voice`. For more detail please check this [Telegram Docs](https://core.telegram.org/bots/webhooks#testing-your-bot-with-updates). These macros is only expecting `conn` as an argument.
76
+
77
+ ```rb
78
+ # app.rb
79
+
80
+ class MyWebhookApp < TeBot::Court
81
+ text do |conn|
82
+ message = do_some_fancy_stuff_here(conn)
83
+ reply(conn, message)
84
+ end
85
+ end
86
+ ```
87
+ And also we can define a macro for defaul action `#default_action` if the request does not match with this [Documentation](https://core.telegram.org/bots/webhooks#testing-your-bot-with-updates), Or we have not create the handler for that specific message type. Just becarefull, the `conn.data` might returns nil if the message format doesnot match the documentation.
88
+
89
+ ```rb
90
+ # app.rb
91
+
92
+ class MyWebhookApp < TeBot::Court
93
+ default_action do |conn|
94
+ reply(conn, "No, I can't talk like people. use command instead") if conn.data&.chat_id
95
+ end
96
+ end
97
+ ```
98
+ Since this app implements rack interface, and railr is also a rack based application. We can mount this app direcly inside rails app.
99
+
100
+ ```rb
101
+ # config/routes.rb
102
+
103
+ require "lib/to/your_webhook"
104
+
105
+ Rails.application.routes.draw do
106
+ mount MyAwessomWebhook.new => "telegram_webhook"
107
+ end
108
+ ```
109
+
110
+ ### Sending Message to Telegram
111
+ To send message direcly to telegram, we can use this module `TeBot::Wire`
112
+
113
+ ```rb
114
+ # app.rb
115
+ sender = TeBot::Wire.new(ENV['YOUR_ACCESS_TOKEN_HERE'])
116
+ sender.send_message(chat_id, message_string)
117
+ ```
118
+ This gem only support [sendMessage](https://core.telegram.org/bots/api#sendmessage) API for this moment.
119
+
120
+ ## Development
121
+
122
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
123
+
124
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
125
+
126
+ ## Contributing
127
+
128
+ Bug reports and pull requests are welcome on GitHub at https://github.com/aaripurna/te_bot. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/aaripurna/te_bot/blob/main/CODE_OF_CONDUCT.md).
129
+
130
+ ## Code of Conduct
131
+
132
+ Everyone interacting in the TeBot project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/aaripurna/te_bot/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/test_*.rb"]
10
+ end
11
+
12
+ require "standard/rake"
13
+
14
+ task default: %i[test standard]
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rack"
4
+ require "json"
5
+
6
+ module TeBot
7
+ class Court
8
+ class << self
9
+ attr_reader :wire, :commands
10
+
11
+ def access_token(token)
12
+ @wire = ::TeBot::Wire.new(token)
13
+ end
14
+
15
+ def default_command(&block)
16
+ @default_command ||= block
17
+ end
18
+
19
+ def default_action(&block)
20
+ @default_action ||= block
21
+ end
22
+
23
+ def reply(conn, message)
24
+ send_message(conn.data&.chat_id, message)
25
+ end
26
+
27
+ def send_message(chat_id, message)
28
+ wire.send_message(chat_id, message)
29
+ end
30
+
31
+ def command(text, &block)
32
+ @commands ||= {}
33
+ @commands[text] = block
34
+ end
35
+
36
+ ::TeBot::Message::GENERAL_MESSAGE_TYPES.each do |m|
37
+ define_method(m) do |&block|
38
+ instance_variable_get("@#{m}") || instance_variable_set("@#{m}", block)
39
+ instance_variable_get("@#{m}")
40
+ end
41
+ end
42
+ end
43
+
44
+ def call(env)
45
+ json_only(env) do |body|
46
+ response = handle_request(body)
47
+
48
+ if response.is_a?(Array)
49
+ status, headers, body = response
50
+ [status, headers, body]
51
+ else
52
+ [200, {"Content-Type" => "application/json"}, [JSON.generate({"message" => "success"})]]
53
+ end
54
+ end
55
+ end
56
+
57
+ private
58
+
59
+ def json_only(env)
60
+ unless env["CONTENT_TYPE"]&.start_with?("application/json")
61
+ return [400, {"Content-Type" => "application/json"}, [JSON.generate({"message" => "only accepting application/json"})]]
62
+ end
63
+
64
+ req = Rack::Request.new(env)
65
+ body = req.body.read
66
+
67
+ return [400, {"Content-Type" => "application/json"}, [JSON.generate({"message" => "Body is required"})]] if body.nil? || body.empty?
68
+
69
+ data = JSON.parse(body)
70
+
71
+ yield(data)
72
+ end
73
+
74
+ def handle_request(body)
75
+ message = ::TeBot::Message.new(body)
76
+
77
+ message.command do
78
+ command, params = message.data.content.parse
79
+ handler = self.class.commands[command]
80
+
81
+ if handler.respond_to?(:call)
82
+ handler.call(message, params)
83
+ elsif self.class.default_command.respond_to?(:call)
84
+ self.class.default_command.call(message, params)
85
+ end
86
+ end
87
+
88
+ ::TeBot::Message::GENERAL_MESSAGE_TYPES.each do |f|
89
+ message.public_send(f) do
90
+ handler = self.class.public_send(f)
91
+
92
+ next unless handler.respond_to?(:call)
93
+ handler.call(message)
94
+ end
95
+ end
96
+
97
+ if message.handler.respond_to?(:call)
98
+ message.call
99
+ elsif self.class.default_action.respond_to?(:call)
100
+ self.class.default_action.call(message)
101
+ end
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,164 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TeBot
4
+ class Message
5
+ GENERAL_MESSAGE_TYPES = %i[text query document audio voice]
6
+ MESSAGE_TYPES = %I[command text query document audio voice]
7
+
8
+ def initialize(body)
9
+ data = body.dig("message") || body.dig("edited_message") ||
10
+ body.dig("inline_query") || body.dig("chosen_inline_result") ||
11
+ body.dig("chosen_inline_result") || {}
12
+
13
+ @message = Format.new(data)
14
+ end
15
+
16
+ def data
17
+ @message
18
+ end
19
+
20
+ MESSAGE_TYPES.each do |format|
21
+ define_method(format) do |&block|
22
+ instance_variable_set("@#{format}", block)
23
+ end
24
+ end
25
+
26
+ def handler
27
+ return unless data || data.content
28
+ content_class = data.content.class.name.split("::").last.downcase
29
+
30
+ instance_variable_get("@#{content_class}")
31
+ end
32
+
33
+ def call
34
+ handler&.call
35
+ end
36
+
37
+ class Format
38
+ attr_reader :date, :chat, :message_id, :from, :forward_from,
39
+ :forward_date, :reply_to_message, :content, :edit_date, :chat_id
40
+
41
+ def initialize(message = {})
42
+ @date = message.dig("date")
43
+ @chat = message.dig("chat")
44
+ @message_id = message.dig("message_id")
45
+ @from = message.dig("from")
46
+ @forward_from = message.dig("forward_from")
47
+ @forward_date = message.dig("forward_date")
48
+ @edit_date = message.dig("edit_date")
49
+ @content = extract_content(message)
50
+ @chat_id = @chat&.dig("id")
51
+
52
+ @reply_to_message = message.dig("reply_to_message")
53
+ end
54
+
55
+ private
56
+
57
+ def extract_content(message = {})
58
+ if message.dig("audio")
59
+ return Audio.new(message)
60
+ elsif message.dig("voice")
61
+ return Voice.new(message)
62
+ elsif message.dig("document")
63
+ return Document.new(message)
64
+ elsif message.dig("query") || message.dig("data")
65
+ return Query.new(message)
66
+ end
67
+
68
+ text = message.dig("text")
69
+ return unless text
70
+
71
+ if /^\/\S+/.match?(text)
72
+ Command.new(message)
73
+ else
74
+ Text.new(message)
75
+ end
76
+ end
77
+
78
+ def extract_reply(message = {})
79
+ return unless message.dig("reply_to_message")
80
+
81
+ Format.new(message.dig("reply_to_message"))
82
+ end
83
+ end
84
+
85
+ class Command
86
+ def initialize(message)
87
+ @text = message.dig("text")
88
+ end
89
+
90
+ def parse
91
+ command
92
+ end
93
+
94
+ private
95
+
96
+ def command
97
+ @command ||= [extract_command, extract_params]
98
+ end
99
+
100
+ def extract_command
101
+ r = @text.match(/^\/\S+/)
102
+
103
+ r[0] if r
104
+ end
105
+
106
+ def extract_params
107
+ @text.scan(/\S+:\S+/).each_with_object({}) do |query, memo|
108
+ key, value = query.split(":")
109
+ memo[key] = value
110
+ end
111
+ end
112
+ end
113
+
114
+ class Text
115
+ def initialize(message)
116
+ @text = message.dig("text")
117
+ end
118
+
119
+ def parse
120
+ @text
121
+ end
122
+ end
123
+
124
+ class Query
125
+ def initialize(message)
126
+ @query = message.dig("query") || message.dig("data")
127
+ end
128
+
129
+ def parse
130
+ @query
131
+ end
132
+ end
133
+
134
+ class Document
135
+ def initialize(message)
136
+ @document = message.dig("document")
137
+ end
138
+
139
+ def parse
140
+ @document
141
+ end
142
+ end
143
+
144
+ class Audio
145
+ def initialize(message)
146
+ @audio = message.dig("audio")
147
+ end
148
+
149
+ def parse
150
+ @audio
151
+ end
152
+ end
153
+
154
+ class Voice
155
+ def initialize(message)
156
+ @voice = message.dig("voice")
157
+ end
158
+
159
+ def parse
160
+ @voice
161
+ end
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TeBot
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+ require "faraday/net_http"
5
+
6
+ module TeBot
7
+ class Wire
8
+ CONN = Faraday.new(
9
+ url: "https://api.telegram.org/",
10
+ headers: {"Content-Type" => "application/json"}
11
+ )
12
+
13
+ def url(path)
14
+ "/bot#{@access_token}/#{path}"
15
+ end
16
+
17
+ def initialize(access_token)
18
+ @access_token = access_token
19
+ end
20
+
21
+ def send_message(chat_id, message)
22
+ CONN.post(url("sendMessage")) do |req|
23
+ req.params["chat_id"] = chat_id
24
+ req.params["text"] = message
25
+ end
26
+ end
27
+ end
28
+ end
data/lib/te_bot.rb ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "te_bot/version"
4
+
5
+ module TeBot
6
+ autoload :Court, "te_bot/court.rb"
7
+ autoload :Wire, "te_bot/wire.rb"
8
+ autoload :Message, "te_bot/message.rb"
9
+
10
+ class Error < StandardError; end
11
+ # Your code goes here...
12
+ end
data/sig/te_bot.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module TeBot
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
data/te_bot.gemspec ADDED
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/te_bot/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "te_bot"
7
+ spec.version = TeBot::VERSION
8
+ spec.authors = ["Nawa Aripurna"]
9
+ spec.email = ["nap.aripurna@gmail.com"]
10
+
11
+ spec.summary = "Self-contaned telegram bot handler."
12
+ spec.description = "All at one telegram bot."
13
+ spec.homepage = "https://github.com/aaripurna/te_bot"
14
+ spec.required_ruby_version = ">= 2.6.0"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = "https://github.com/aaripurna/te_bot"
18
+ spec.metadata["changelog_uri"] = "https://github.com/aaripurna/te_bot/blob/main/CHANGELOG.md)"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(__dir__) do
23
+ `git ls-files -z`.split("\x0").reject do |f|
24
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
25
+ end
26
+ end
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ # Uncomment to register a new dependency of your gem
32
+ # spec.add_dependency "example-gem", "~> 1.0"
33
+
34
+ spec.add_dependency "rack", "~> 2.2"
35
+ spec.add_dependency "faraday", "~> 2.3"
36
+
37
+ # For more information and examples about making a new gem, check out our
38
+ # guide at: https://bundler.io/guides/creating_gem.html
39
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: te_bot
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nawa Aripurna
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-06-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.3'
41
+ description: All at one telegram bot.
42
+ email:
43
+ - nap.aripurna@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".standard.yml"
49
+ - CHANGELOG.md
50
+ - CODE_OF_CONDUCT.md
51
+ - Gemfile
52
+ - Gemfile.lock
53
+ - README.md
54
+ - Rakefile
55
+ - lib/te_bot.rb
56
+ - lib/te_bot/court.rb
57
+ - lib/te_bot/message.rb
58
+ - lib/te_bot/version.rb
59
+ - lib/te_bot/wire.rb
60
+ - sig/te_bot.rbs
61
+ - te_bot.gemspec
62
+ homepage: https://github.com/aaripurna/te_bot
63
+ licenses: []
64
+ metadata:
65
+ homepage_uri: https://github.com/aaripurna/te_bot
66
+ source_code_uri: https://github.com/aaripurna/te_bot
67
+ changelog_uri: https://github.com/aaripurna/te_bot/blob/main/CHANGELOG.md)
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 2.6.0
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubygems_version: 3.3.7
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Self-contaned telegram bot handler.
87
+ test_files: []