teleruby 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/teleruby.rb +50 -0
- data/teleruby.gemspec +24 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0bbf37e2be057ef1da0472a350834e6626575e901feab77e8f42b6663fa0197b
|
4
|
+
data.tar.gz: 22224acffb403eaefd2b7a4e7f8df67557576a90353fc83db2e343591fe8a60d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cc20bd7f5a54f978c91f2115d8d536ee779370b3f42e7126e93959515fb5599906c042d7ee762255370b4c29eea49ad6b32fab039d685282acdaa86cca47f35a
|
7
|
+
data.tar.gz: c9d386a2f2ed63779008a3b84d23a624006a02cd1becff80a0ba3f482a9f6d96ffe2c722741915c12dbce451cacc53787486f7f754a93b36e20c1928d5357f62
|
data/lib/teleruby.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative 'teleruby/all_apis'
|
5
|
+
|
6
|
+
##
|
7
|
+
# @lee_crey (Solomon Boloshe)
|
8
|
+
#
|
9
|
+
# @teleruby_support
|
10
|
+
|
11
|
+
module Telegram
|
12
|
+
# Generic exception class.
|
13
|
+
class Error < StandardError; end
|
14
|
+
|
15
|
+
# Raise when chat_id, and user_id are incorrect,
|
16
|
+
class IdError < Error; end
|
17
|
+
|
18
|
+
# Raise when bot token is incorrect.
|
19
|
+
class TokenError < Error; end
|
20
|
+
|
21
|
+
# Raise when bot has not appropriate admin right in supergroups.
|
22
|
+
class PermissionError < Error; end
|
23
|
+
|
24
|
+
# Raise when one of optional parameters is incorrect and telegram
|
25
|
+
# unalbe to do the requested operation.
|
26
|
+
class TelegramError < Error; end
|
27
|
+
|
28
|
+
class FatalError < Error; end
|
29
|
+
class BadRequestError < Error; end
|
30
|
+
class UndefinedMethod < Error; end
|
31
|
+
|
32
|
+
# === Bot class
|
33
|
+
class Client < TGClient
|
34
|
+
include AllApis
|
35
|
+
def initialize(token: token)
|
36
|
+
@token = token
|
37
|
+
@last_update = 0
|
38
|
+
end
|
39
|
+
|
40
|
+
# for getting updates
|
41
|
+
# long polling
|
42
|
+
def run!(&block)
|
43
|
+
(fail LocalJumpError, 'block is not given' unless block_given?)
|
44
|
+
loop do
|
45
|
+
block.call
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
data/teleruby.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'teleruby'
|
5
|
+
spec.version = '1.5.0'
|
6
|
+
spec.authors = ['Solomon Boloshe(Lee Crey)']
|
7
|
+
spec.email = ['SolomonMail835@gmail.com']
|
8
|
+
spec.summary = %q{Simple ruby wrapper for Telegram bot}
|
9
|
+
spec.description = %q{Lightweight ruby wrapper for Telegram bot.}
|
10
|
+
spec.homepage = 'https://rubygems.org/gems/hedase'
|
11
|
+
spec.files = Dir.glob('lib/*.rb') + ['teleruby.gemspec']
|
12
|
+
spec.require_paths = ['lib']
|
13
|
+
spec.license = 'MIT'
|
14
|
+
spec.date = '2020-09-05'
|
15
|
+
spec.required_ruby_version = '>= 2.3.0'
|
16
|
+
spec.add_runtime_dependency 'faraday', '~> 1.0', '>= 1.0.0'
|
17
|
+
spec.add_runtime_dependency 'json', '~> 2.3', '>= 2.3.0'
|
18
|
+
|
19
|
+
spec.metadata = {
|
20
|
+
'source_code_uri' => 'https://github.com/SolomonBoloshe116/teleruby'
|
21
|
+
}
|
22
|
+
lib = File.expand_path("./lib/", __FILE__)
|
23
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: teleruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.5.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Solomon Boloshe(Lee Crey)
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-09-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.0.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.0.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: json
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '2.3'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.3.0
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '2.3'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.3.0
|
53
|
+
description: Lightweight ruby wrapper for Telegram bot.
|
54
|
+
email:
|
55
|
+
- SolomonMail835@gmail.com
|
56
|
+
executables: []
|
57
|
+
extensions: []
|
58
|
+
extra_rdoc_files: []
|
59
|
+
files:
|
60
|
+
- lib/teleruby.rb
|
61
|
+
- teleruby.gemspec
|
62
|
+
homepage: https://rubygems.org/gems/hedase
|
63
|
+
licenses:
|
64
|
+
- MIT
|
65
|
+
metadata:
|
66
|
+
source_code_uri: https://github.com/SolomonBoloshe116/teleruby
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.3.0
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubygems_version: 3.1.2
|
83
|
+
signing_key:
|
84
|
+
specification_version: 4
|
85
|
+
summary: Simple ruby wrapper for Telegram bot
|
86
|
+
test_files: []
|