rubydium 0.4.10 → 0.4.11
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 +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +15 -15
- data/example/open_ai_bot/utils.rb +8 -3
- data/lib/rubydium/mixins/command_macros.rb +36 -0
- data/lib/rubydium/version.rb +1 -1
- data/rubydium.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e28402279adde0d0dc81703f4016c121b3f673a97a805fb2fe1287031db6e75
|
|
4
|
+
data.tar.gz: 19f02ec65c566bab38c8289ac2288b247fe166de5066f54a22ac698e7754ee08
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 44129c699424f6126aaeb0f82b4918af0cab7e3c4c91e18ceea6558c26a089df1e8a18abcc5c387a576fb21bb5a150202e47ef6bf6ba34bd4f4fd89cce4ad70e
|
|
7
|
+
data.tar.gz: 408d68583c7c96a185130b9aacb21f5788010d630c64084e98127143b2afa5286b4a008e5e357aef1d8896e2458e833acea3f93b6b2cf3f41a55a2f02194d815
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -30,23 +30,23 @@ GEM
|
|
|
30
30
|
json
|
|
31
31
|
diff-lcs (1.5.1)
|
|
32
32
|
drb (2.2.1)
|
|
33
|
-
dry-core (1.
|
|
33
|
+
dry-core (1.2.0)
|
|
34
34
|
concurrent-ruby (~> 1.0)
|
|
35
35
|
logger
|
|
36
36
|
zeitwerk (~> 2.6)
|
|
37
|
-
dry-inflector (1.
|
|
37
|
+
dry-inflector (1.3.0)
|
|
38
38
|
dry-logic (1.6.0)
|
|
39
39
|
bigdecimal
|
|
40
40
|
concurrent-ruby (~> 1.0)
|
|
41
41
|
dry-core (~> 1.1)
|
|
42
42
|
zeitwerk (~> 2.6)
|
|
43
|
-
dry-struct (1.
|
|
43
|
+
dry-struct (1.8.0)
|
|
44
44
|
dry-core (~> 1.1)
|
|
45
|
-
dry-types (~> 1.8)
|
|
45
|
+
dry-types (~> 1.8, >= 1.8.2)
|
|
46
46
|
ice_nine (~> 0.11)
|
|
47
47
|
zeitwerk (~> 2.6)
|
|
48
|
-
dry-types (1.
|
|
49
|
-
bigdecimal (
|
|
48
|
+
dry-types (1.9.0)
|
|
49
|
+
bigdecimal (>= 3.0)
|
|
50
50
|
concurrent-ruby (~> 1.0)
|
|
51
51
|
dry-core (~> 1.0)
|
|
52
52
|
dry-inflector (~> 1.0)
|
|
@@ -54,14 +54,14 @@ GEM
|
|
|
54
54
|
zeitwerk (~> 2.6)
|
|
55
55
|
factory_bot (6.5.0)
|
|
56
56
|
activesupport (>= 5.0.0)
|
|
57
|
-
faraday (2.
|
|
57
|
+
faraday (2.14.0)
|
|
58
58
|
faraday-net_http (>= 2.0, < 3.5)
|
|
59
59
|
json
|
|
60
60
|
logger
|
|
61
|
-
faraday-multipart (1.
|
|
61
|
+
faraday-multipart (1.2.0)
|
|
62
62
|
multipart-post (~> 2.0)
|
|
63
|
-
faraday-net_http (3.4.
|
|
64
|
-
net-http (
|
|
63
|
+
faraday-net_http (3.4.2)
|
|
64
|
+
net-http (~> 0.5)
|
|
65
65
|
fiber-annotation (0.2.0)
|
|
66
66
|
fiber-local (1.1.0)
|
|
67
67
|
fiber-storage
|
|
@@ -75,8 +75,8 @@ GEM
|
|
|
75
75
|
logger (1.6.5)
|
|
76
76
|
minitest (5.25.4)
|
|
77
77
|
multipart-post (2.4.1)
|
|
78
|
-
net-http (0.
|
|
79
|
-
uri
|
|
78
|
+
net-http (0.9.1)
|
|
79
|
+
uri (>= 0.11.1)
|
|
80
80
|
parallel (1.26.3)
|
|
81
81
|
parser (3.3.7.0)
|
|
82
82
|
ast (~> 2.4.1)
|
|
@@ -113,7 +113,7 @@ GEM
|
|
|
113
113
|
rubocop (~> 1.61)
|
|
114
114
|
ruby-progressbar (1.13.0)
|
|
115
115
|
securerandom (0.4.1)
|
|
116
|
-
telegram-bot-ruby (2.
|
|
116
|
+
telegram-bot-ruby (2.5.0)
|
|
117
117
|
dry-struct (~> 1.6)
|
|
118
118
|
faraday (~> 2.0)
|
|
119
119
|
faraday-multipart (~> 1.0)
|
|
@@ -124,7 +124,7 @@ GEM
|
|
|
124
124
|
unicode-emoji (~> 4.0, >= 4.0.4)
|
|
125
125
|
unicode-emoji (4.0.4)
|
|
126
126
|
uri (1.0.2)
|
|
127
|
-
zeitwerk (2.7.
|
|
127
|
+
zeitwerk (2.7.4)
|
|
128
128
|
|
|
129
129
|
PLATFORMS
|
|
130
130
|
ruby
|
|
@@ -136,7 +136,7 @@ DEPENDENCIES
|
|
|
136
136
|
rspec
|
|
137
137
|
rubocop
|
|
138
138
|
rubocop-rspec
|
|
139
|
-
telegram-bot-ruby (~> 2.
|
|
139
|
+
telegram-bot-ruby (~> 2.5)
|
|
140
140
|
|
|
141
141
|
BUNDLED WITH
|
|
142
142
|
2.5.3
|
|
@@ -13,13 +13,18 @@ module Utils
|
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def download_file(voice)
|
|
17
|
-
|
|
16
|
+
def download_file(voice, dir=nil)
|
|
17
|
+
return unless voice
|
|
18
|
+
|
|
19
|
+
file_path = @api.get_file(file_id: voice.file_id)["result"]["file_path"]
|
|
18
20
|
|
|
19
21
|
url = "https://api.telegram.org/file/bot#{config.token}/#{file_path}"
|
|
20
22
|
|
|
21
23
|
file = Down.download(url)
|
|
22
|
-
|
|
24
|
+
dir ||= "."
|
|
25
|
+
|
|
26
|
+
FileUtils.mkdir(dir) unless Dir.exist? dir
|
|
27
|
+
FileUtils.mv(file.path, "#{dir.delete_suffix("/")}/#{file.original_filename}")
|
|
23
28
|
file
|
|
24
29
|
end
|
|
25
30
|
end
|
|
@@ -44,6 +44,30 @@ module Rubydium
|
|
|
44
44
|
}.join("\n")
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
def on_startup(method_name=nil, &block)
|
|
48
|
+
@registered_on_startup ||= []
|
|
49
|
+
action = method_name || block
|
|
50
|
+
raise ArgumentError, 'Provide either method name or a block' unless action
|
|
51
|
+
|
|
52
|
+
@registered_on_startup << action
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def registered_on_startup
|
|
56
|
+
@registered_on_startup ||= []
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def on_shutdown(method_name=nil, &block)
|
|
60
|
+
@registered_on_shutdown ||= []
|
|
61
|
+
action = method_name || block
|
|
62
|
+
raise ArgumentError, 'Provide either method name or a block' unless action
|
|
63
|
+
|
|
64
|
+
@registered_on_shutdown << action
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def registered_on_shutdown
|
|
68
|
+
@registered_on_shutdown ||= []
|
|
69
|
+
end
|
|
70
|
+
|
|
47
71
|
def on_mention(method_name=nil, ignore_forwarded: true, &block)
|
|
48
72
|
@registered_on_mention ||= []
|
|
49
73
|
action = method_name || block
|
|
@@ -98,6 +122,18 @@ module Rubydium
|
|
|
98
122
|
end
|
|
99
123
|
end
|
|
100
124
|
|
|
125
|
+
def execute_on_startup
|
|
126
|
+
self.class.registered_on_startup.each do |action|
|
|
127
|
+
execute_action(action)
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def execute_on_shutdown
|
|
132
|
+
self.class.registered_on_shutdown.each do |action|
|
|
133
|
+
execute_action(action)
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
101
137
|
def execute_on_every_message
|
|
102
138
|
self.class.registered_on_every_message.each do |action|
|
|
103
139
|
next if action[:ignore_forwarded] && @msg.forward_origin
|
data/lib/rubydium/version.rb
CHANGED
data/rubydium.gemspec
CHANGED
|
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
|
|
|
34
34
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
35
35
|
|
|
36
36
|
{
|
|
37
|
-
'telegram-bot-ruby' => ['~> 2.
|
|
37
|
+
'telegram-bot-ruby' => ['~> 2.5'],
|
|
38
38
|
'async' => ['~> 2.3']
|
|
39
39
|
}.each do |name, versions|
|
|
40
40
|
spec.add_dependency(name, *versions)
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubydium
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- bulgakke
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-01-10 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: telegram-bot-ruby
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '2.
|
|
18
|
+
version: '2.5'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '2.
|
|
25
|
+
version: '2.5'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: async
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|