telegem 2.1.0 → 3.0.1
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/Readme.md +2 -2
- data/Starts_HallofFame.md +65 -0
- data/Test-Projects/bot.md +145 -0
- data/Test-Projects/bot1.rb +91 -0
- data/bin/telegem-ssl +44 -0
- data/docs-src/Bot-registration_.PNG +0 -0
- data/docs-src/bot.md +349 -180
- data/docs-src/ctx.md +399 -0
- data/docs-src/webhook.md +341 -0
- data/lib/api/client.rb +72 -27
- data/lib/core/bot.rb +81 -149
- data/lib/telegem.rb +1 -1
- data/lib/webhook/server.rb +149 -290
- data/public/index.html +481 -0
- metadata +32 -24
- data/Test-Projects/Movie-tracker-bot/Gemfile +0 -2
- data/Test-Projects/Movie-tracker-bot/bot.rb +0 -62
- data/Test-Projects/Movie-tracker-bot/handlers/.gitkeep +0 -0
- data/Test-Projects/Movie-tracker-bot/handlers/add_1_.rb +0 -160
- data/Test-Projects/Movie-tracker-bot/handlers/add_2_.rb +0 -139
- data/Test-Projects/Movie-tracker-bot/handlers/premium.rb +0 -13
- data/Test-Projects/Movie-tracker-bot/handlers/report.rb +0 -31
- data/Test-Projects/Movie-tracker-bot/handlers/search.rb +0 -150
- data/Test-Projects/Movie-tracker-bot/handlers/sponsor.rb +0 -14
- data/Test-Projects/Movie-tracker-bot/handlers/start.rb +0 -48
- data/Test-Projects/Movie-tracker-bot/handlers/watch.rb +0 -210
- data/Test-Projects/Test-submitted-by-marvel/.gitkeep +0 -0
- data/Test-Projects/Test-submitted-by-marvel/Marvel-bot.md +0 -3
- data/Test-Projects/bot_test1.rb +0 -75
- data/Test-Projects/pizza_test_bot_guide.md +0 -163
- data/docs-src/understanding-ctx.md +0 -581
- /data/{Test-Projects → bin}/.gitkeep +0 -0
- /data/{Test-Projects/Movie-tracker-bot → public}/.gitkeep +0 -0
data/public/index.html
ADDED
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Telegem Docs - Telegram Bot Framework for Ruby</title>
|
|
7
|
+
<style>
|
|
8
|
+
* {
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
body {
|
|
15
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
16
|
+
line-height: 1.6;
|
|
17
|
+
color: #1a1a1a;
|
|
18
|
+
background: #fafafa;
|
|
19
|
+
padding: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.container {
|
|
23
|
+
max-width: 900px;
|
|
24
|
+
margin: 0 auto;
|
|
25
|
+
padding: 2rem 1.5rem;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.header {
|
|
29
|
+
padding-bottom: 2rem;
|
|
30
|
+
margin-bottom: 2rem;
|
|
31
|
+
border-bottom: 1px solid #eaeaea;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.header h1 {
|
|
35
|
+
font-size: 2.2rem;
|
|
36
|
+
color: #2c3e50;
|
|
37
|
+
margin-bottom: 0.25rem;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.tagline {
|
|
41
|
+
font-size: 1.1rem;
|
|
42
|
+
color: #7f8c8d;
|
|
43
|
+
margin-bottom: 1.5rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.stats {
|
|
47
|
+
display: flex;
|
|
48
|
+
gap: 1.5rem;
|
|
49
|
+
margin-top: 1rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.stat {
|
|
53
|
+
background: white;
|
|
54
|
+
padding: 0.75rem 1rem;
|
|
55
|
+
border-radius: 6px;
|
|
56
|
+
border: 1px solid #eaeaea;
|
|
57
|
+
min-width: 120px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.stat-label {
|
|
61
|
+
font-size: 0.8rem;
|
|
62
|
+
color: #95a5a6;
|
|
63
|
+
text-transform: uppercase;
|
|
64
|
+
letter-spacing: 0.5px;
|
|
65
|
+
margin-bottom: 0.25rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.stat-value {
|
|
69
|
+
font-size: 1.1rem;
|
|
70
|
+
font-weight: 600;
|
|
71
|
+
color: #2c3e50;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.doc-nav {
|
|
75
|
+
display: flex;
|
|
76
|
+
gap: 0.5rem;
|
|
77
|
+
margin: 2rem 0;
|
|
78
|
+
flex-wrap: wrap;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.nav-btn {
|
|
82
|
+
background: white;
|
|
83
|
+
border: 1px solid #ddd;
|
|
84
|
+
padding: 0.5rem 1rem;
|
|
85
|
+
border-radius: 4px;
|
|
86
|
+
font-size: 0.9rem;
|
|
87
|
+
color: #555;
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
transition: all 0.2s;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.nav-btn:hover {
|
|
93
|
+
border-color: #3498db;
|
|
94
|
+
color: #3498db;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.nav-btn.active {
|
|
98
|
+
background: #3498db;
|
|
99
|
+
border-color: #3498db;
|
|
100
|
+
color: white;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.doc-section {
|
|
104
|
+
background: white;
|
|
105
|
+
border-radius: 8px;
|
|
106
|
+
padding: 2rem;
|
|
107
|
+
margin-bottom: 1.5rem;
|
|
108
|
+
border: 1px solid #eaeaea;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.doc-section h2 {
|
|
112
|
+
font-size: 1.5rem;
|
|
113
|
+
color: #2c3e50;
|
|
114
|
+
margin-bottom: 1rem;
|
|
115
|
+
padding-bottom: 0.5rem;
|
|
116
|
+
border-bottom: 2px solid #f0f0f0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.doc-section h3 {
|
|
120
|
+
font-size: 1.1rem;
|
|
121
|
+
color: #34495e;
|
|
122
|
+
margin: 1.5rem 0 0.75rem;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.doc-section p {
|
|
126
|
+
margin-bottom: 1rem;
|
|
127
|
+
color: #555;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.method-list {
|
|
131
|
+
list-style: none;
|
|
132
|
+
margin: 1rem 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.method-item {
|
|
136
|
+
margin-bottom: 0.75rem;
|
|
137
|
+
padding: 0.75rem;
|
|
138
|
+
background: #f8f9fa;
|
|
139
|
+
border-radius: 4px;
|
|
140
|
+
border-left: 3px solid #3498db;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.method-name {
|
|
144
|
+
font-family: 'SF Mono', Monaco, Consolas, monospace;
|
|
145
|
+
font-weight: 600;
|
|
146
|
+
color: #2c3e50;
|
|
147
|
+
margin-bottom: 0.25rem;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.method-desc {
|
|
151
|
+
color: #7f8c8d;
|
|
152
|
+
font-size: 0.9rem;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.code-block {
|
|
156
|
+
background: #2c3e50;
|
|
157
|
+
color: #ecf0f1;
|
|
158
|
+
padding: 1.25rem;
|
|
159
|
+
border-radius: 6px;
|
|
160
|
+
margin: 1rem 0;
|
|
161
|
+
font-family: 'SF Mono', Monaco, Consolas, monospace;
|
|
162
|
+
font-size: 0.9rem;
|
|
163
|
+
line-height: 1.5;
|
|
164
|
+
overflow-x: auto;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.code-block::selection {
|
|
168
|
+
background: #3498db;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.links {
|
|
172
|
+
display: flex;
|
|
173
|
+
gap: 1rem;
|
|
174
|
+
margin-top: 2rem;
|
|
175
|
+
padding-top: 1.5rem;
|
|
176
|
+
border-top: 1px solid #eaeaea;
|
|
177
|
+
flex-wrap: wrap;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.link-btn {
|
|
181
|
+
display: inline-flex;
|
|
182
|
+
align-items: center;
|
|
183
|
+
gap: 0.5rem;
|
|
184
|
+
padding: 0.6rem 1.2rem;
|
|
185
|
+
background: #3498db;
|
|
186
|
+
color: white;
|
|
187
|
+
text-decoration: none;
|
|
188
|
+
border-radius: 4px;
|
|
189
|
+
font-size: 0.9rem;
|
|
190
|
+
transition: background 0.2s;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.link-btn:hover {
|
|
194
|
+
background: #2980b9;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.link-btn.secondary {
|
|
198
|
+
background: white;
|
|
199
|
+
color: #555;
|
|
200
|
+
border: 1px solid #ddd;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.link-btn.secondary:hover {
|
|
204
|
+
background: #f8f9fa;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.note {
|
|
208
|
+
background: #f8f9fa;
|
|
209
|
+
padding: 1rem;
|
|
210
|
+
border-left: 3px solid #3498db;
|
|
211
|
+
margin: 1rem 0;
|
|
212
|
+
border-radius: 0 4px 4px 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@media (max-width: 768px) {
|
|
216
|
+
.container {
|
|
217
|
+
padding: 1rem;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.doc-section {
|
|
221
|
+
padding: 1.5rem;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.stats {
|
|
225
|
+
flex-direction: column;
|
|
226
|
+
gap: 0.75rem;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.stat {
|
|
230
|
+
min-width: auto;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
</style>
|
|
234
|
+
</head>
|
|
235
|
+
<body>
|
|
236
|
+
<div class="container">
|
|
237
|
+
<header class="header">
|
|
238
|
+
<div>
|
|
239
|
+
<h1>Telegem</h1>
|
|
240
|
+
<p class="tagline">Telegram Bot Framework for Ruby</p>
|
|
241
|
+
</div>
|
|
242
|
+
|
|
243
|
+
<div class="stats">
|
|
244
|
+
<div class="stat">
|
|
245
|
+
<div class="stat-label">Version</div>
|
|
246
|
+
<div class="stat-value" id="gem-version">Loading...</div>
|
|
247
|
+
</div>
|
|
248
|
+
<div class="stat">
|
|
249
|
+
<div class="stat-label">Downloads</div>
|
|
250
|
+
<div class="stat-value" id="gem-downloads">Loading...</div>
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
<div class="doc-nav">
|
|
255
|
+
<button class="nav-btn active" onclick="showDoc('quickstart')">Quick Start</button>
|
|
256
|
+
<button class="nav-btn" onclick="showDoc('ctx')">Context API</button>
|
|
257
|
+
<button class="nav-btn" onclick="showDoc('bot')">Bot API</button>
|
|
258
|
+
<button class="nav-btn" onclick="showDoc('scenes')">Scenes</button>
|
|
259
|
+
<button class="nav-btn" onclick="showDoc('webhook')">Webhook</button>
|
|
260
|
+
</div>
|
|
261
|
+
</header>
|
|
262
|
+
|
|
263
|
+
<!-- Quick Start -->
|
|
264
|
+
<section id="quickstart-doc" class="doc-section">
|
|
265
|
+
<h2>Quick Start</h2>
|
|
266
|
+
|
|
267
|
+
<h3>Installation</h3>
|
|
268
|
+
<div class="code-block">
|
|
269
|
+
# Add to Gemfile
|
|
270
|
+
gem 'telegem'
|
|
271
|
+
|
|
272
|
+
# Or install directly
|
|
273
|
+
$ gem install telegem
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
<h3>Basic Usage</h3>
|
|
277
|
+
<div class="code-block">
|
|
278
|
+
require 'telegem'
|
|
279
|
+
|
|
280
|
+
bot = Telegem.new("YOUR_BOT_TOKEN")
|
|
281
|
+
|
|
282
|
+
bot.command('start') do |ctx|
|
|
283
|
+
ctx.reply("Welcome to Telegem!")
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
bot.command('help') do |ctx|
|
|
287
|
+
ctx.reply("Available commands: /start, /help")
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
# Start the bot
|
|
291
|
+
bot.start_polling
|
|
292
|
+
</div>
|
|
293
|
+
|
|
294
|
+
<div class="note">
|
|
295
|
+
Replace <code>YOUR_BOT_TOKEN</code> with your actual Telegram Bot token from @BotFather
|
|
296
|
+
</div>
|
|
297
|
+
|
|
298
|
+
<div class="links">
|
|
299
|
+
<a href="https://rubygems.org/gems/telegem" class="link-btn">📦 View on RubyGems</a>
|
|
300
|
+
<a href="https://gitlab.com/ruby-telegem/telegem" class="link-btn secondary">🐱 GitLab Repository</a>
|
|
301
|
+
</div>
|
|
302
|
+
</section>
|
|
303
|
+
|
|
304
|
+
<!-- ctx API -->
|
|
305
|
+
<section id="ctx-doc" class="doc-section" style="display: none;">
|
|
306
|
+
<h2>Context API</h2>
|
|
307
|
+
<p>The context object provides access to the current update and response methods.</p>
|
|
308
|
+
|
|
309
|
+
<h3>Properties</h3>
|
|
310
|
+
<ul class="method-list">
|
|
311
|
+
<li class="method-item">
|
|
312
|
+
<div class="method-name">ctx.message</div>
|
|
313
|
+
<div class="method-desc">Current message object</div>
|
|
314
|
+
</li>
|
|
315
|
+
<li class="method-item">
|
|
316
|
+
<div class="method-name">ctx.from</div>
|
|
317
|
+
<div class="method-desc">User who sent the message</div>
|
|
318
|
+
</li>
|
|
319
|
+
<li class="method-item">
|
|
320
|
+
<div class="method-name">ctx.chat</div>
|
|
321
|
+
<div class="method-desc">Chat information</div>
|
|
322
|
+
</li>
|
|
323
|
+
<li class="method-item">
|
|
324
|
+
<div class="method-name">ctx.session</div>
|
|
325
|
+
<div class="method-desc">Persistent user storage</div>
|
|
326
|
+
</li>
|
|
327
|
+
</ul>
|
|
328
|
+
|
|
329
|
+
<h3>Methods</h3>
|
|
330
|
+
<div class="code-block">
|
|
331
|
+
# Send message
|
|
332
|
+
ctx.reply("Hello!")
|
|
333
|
+
|
|
334
|
+
# Send photo
|
|
335
|
+
ctx.photo("photo.jpg", caption: "My photo")
|
|
336
|
+
|
|
337
|
+
# Edit message
|
|
338
|
+
ctx.edit_message_text("Updated text")
|
|
339
|
+
|
|
340
|
+
# Delete message
|
|
341
|
+
ctx.delete_message(message_id)
|
|
342
|
+
</div>
|
|
343
|
+
|
|
344
|
+
<div class="links">
|
|
345
|
+
<a href="https://gitlab.com/ruby-telegem/telegem/-/tree/main/docs/context.md" class="link-btn">📄 Full Context Docs</a>
|
|
346
|
+
</div>
|
|
347
|
+
</section>
|
|
348
|
+
|
|
349
|
+
<!-- Bot API -->
|
|
350
|
+
<section id="bot-doc" class="doc-section" style="display: none;">
|
|
351
|
+
<h2>Bot API</h2>
|
|
352
|
+
<p>Configure handlers and control bot lifecycle.</p>
|
|
353
|
+
|
|
354
|
+
<div class="code-block">
|
|
355
|
+
# Handle commands
|
|
356
|
+
bot.command('start') { |ctx| ctx.reply("Welcome") }
|
|
357
|
+
|
|
358
|
+
# Handle text patterns
|
|
359
|
+
bot.hears(/hello/i) { |ctx| ctx.reply("Hi there!") }
|
|
360
|
+
|
|
361
|
+
# Handle specific update types
|
|
362
|
+
bot.on(:photo) { |ctx| ctx.reply("Nice photo!") }
|
|
363
|
+
bot.on(:callback_query) { |ctx| ctx.answer_callback_query }
|
|
364
|
+
|
|
365
|
+
# Start bot
|
|
366
|
+
bot.start_polling
|
|
367
|
+
# or
|
|
368
|
+
bot.webhook.run
|
|
369
|
+
</div>
|
|
370
|
+
|
|
371
|
+
<div class="links">
|
|
372
|
+
<a href="https://gitlab.com/ruby-telegem/telegem/-/tree/main/docs/bot.md" class="link-btn">📄 Bot API Reference</a>
|
|
373
|
+
</div>
|
|
374
|
+
</section>
|
|
375
|
+
|
|
376
|
+
<!-- Scenes -->
|
|
377
|
+
<section id="scenes-doc" class="doc-section" style="display: none;">
|
|
378
|
+
<h2>Scenes</h2>
|
|
379
|
+
<p>Multi-step conversations for complex interactions.</p>
|
|
380
|
+
|
|
381
|
+
<div class="code-block">
|
|
382
|
+
bot.scene :registration do
|
|
383
|
+
step :ask_name do |ctx|
|
|
384
|
+
ctx.reply("What is your name?")
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
step :save_name do |ctx|
|
|
388
|
+
ctx.session[:name] = ctx.message.text
|
|
389
|
+
ctx.reply("Hello #{ctx.session[:name]}!")
|
|
390
|
+
ctx.leave_scene
|
|
391
|
+
end
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
# Enter scene
|
|
395
|
+
bot.command('register') { |ctx| ctx.enter_scene(:registration) }
|
|
396
|
+
</div>
|
|
397
|
+
|
|
398
|
+
<div class="links">
|
|
399
|
+
<a href="https://gitlab.com/ruby-telegem/telegem/-/tree/main/docs/scenes.md" class="link-btn">📄 Scenes Guide</a>
|
|
400
|
+
</div>
|
|
401
|
+
</section>
|
|
402
|
+
|
|
403
|
+
<!-- Webhook -->
|
|
404
|
+
<section id="webhook-doc" class="doc-section" style="display: none;">
|
|
405
|
+
<h2>Webhook Deployment</h2>
|
|
406
|
+
<p>Production deployment with webhooks.</p>
|
|
407
|
+
|
|
408
|
+
<div class="code-block">
|
|
409
|
+
# Production setup
|
|
410
|
+
bot = Telegem.new("TOKEN")
|
|
411
|
+
|
|
412
|
+
# Configure webhook
|
|
413
|
+
bot.webhook(
|
|
414
|
+
url: 'https://your-domain.com/webhook',
|
|
415
|
+
port: 3000
|
|
416
|
+
).run
|
|
417
|
+
|
|
418
|
+
# For cloud platforms
|
|
419
|
+
bot.webhook.run # Auto-detects platform
|
|
420
|
+
</div>
|
|
421
|
+
|
|
422
|
+
<div class="note">
|
|
423
|
+
Webhook mode is recommended for production. Uses less resources than polling.
|
|
424
|
+
</div>
|
|
425
|
+
|
|
426
|
+
<div class="links">
|
|
427
|
+
<a href="https://gitlab.com/ruby-telegem/telegem/-/tree/main/docs/deployment.md" class="link-btn">📄 Deployment Guide</a>
|
|
428
|
+
</div>
|
|
429
|
+
</section>
|
|
430
|
+
|
|
431
|
+
<!-- Footer -->
|
|
432
|
+
<div class="doc-section">
|
|
433
|
+
<div class="links">
|
|
434
|
+
<a href="https://gitlab.com/ruby-telegem/telegem" class="link-btn">🏠 Main Repository</a>
|
|
435
|
+
<a href="https://rubygems.org/gems/telegem" class="link-btn secondary">💎 RubyGems</a>
|
|
436
|
+
<a href="https://gitlab.com/ruby-telegem/telegem/-/issues" class="link-btn secondary">🐛 Issue Tracker</a>
|
|
437
|
+
</div>
|
|
438
|
+
</div>
|
|
439
|
+
</div>
|
|
440
|
+
|
|
441
|
+
<script>
|
|
442
|
+
async function fetchGemStats() {
|
|
443
|
+
try {
|
|
444
|
+
const response = await fetch('https://rubygems.org/api/v1/gems/telegem.json');
|
|
445
|
+
const data = await response.json();
|
|
446
|
+
|
|
447
|
+
if (data.version) {
|
|
448
|
+
document.getElementById('gem-version').textContent = `v${data.version}`;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
if (data.downloads) {
|
|
452
|
+
document.getElementById('gem-downloads').textContent =
|
|
453
|
+
data.downloads.toLocaleString();
|
|
454
|
+
}
|
|
455
|
+
} catch (error) {
|
|
456
|
+
document.getElementById('gem-version').textContent = 'v3.0.0';
|
|
457
|
+
document.getElementById('gem-downloads').textContent = 'N/A';
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
function showDoc(section) {
|
|
462
|
+
document.querySelectorAll('.doc-section').forEach(el => {
|
|
463
|
+
el.style.display = 'none';
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
document.getElementById(`${section}-doc`).style.display = 'block';
|
|
467
|
+
|
|
468
|
+
document.querySelectorAll('.nav-btn').forEach(btn => {
|
|
469
|
+
btn.classList.remove('active');
|
|
470
|
+
});
|
|
471
|
+
event.target.classList.add('active');
|
|
472
|
+
|
|
473
|
+
window.scrollTo(0, 0);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
477
|
+
fetchGemStats();
|
|
478
|
+
});
|
|
479
|
+
</script>
|
|
480
|
+
</body>
|
|
481
|
+
</html>
|
metadata
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: telegem
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- sick_phantom
|
|
8
|
-
bindir:
|
|
8
|
+
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
@@ -77,6 +77,20 @@ dependencies:
|
|
|
77
77
|
- - "<"
|
|
78
78
|
- !ruby/object:Gem::Version
|
|
79
79
|
version: '7.0'
|
|
80
|
+
- !ruby/object:Gem::Dependency
|
|
81
|
+
name: async
|
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
|
83
|
+
requirements:
|
|
84
|
+
- - "~>"
|
|
85
|
+
- !ruby/object:Gem::Version
|
|
86
|
+
version: '2.1'
|
|
87
|
+
type: :runtime
|
|
88
|
+
prerelease: false
|
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
90
|
+
requirements:
|
|
91
|
+
- - "~>"
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '2.1'
|
|
80
94
|
- !ruby/object:Gem::Dependency
|
|
81
95
|
name: rake
|
|
82
96
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -153,7 +167,8 @@ description: |
|
|
|
153
167
|
and a clean DSL. Perfect for building scalable Telegram bots.
|
|
154
168
|
email:
|
|
155
169
|
- ynwghosted@icloud.com
|
|
156
|
-
executables:
|
|
170
|
+
executables:
|
|
171
|
+
- telegem-ssl
|
|
157
172
|
extensions: []
|
|
158
173
|
extra_rdoc_files: []
|
|
159
174
|
files:
|
|
@@ -163,31 +178,20 @@ files:
|
|
|
163
178
|
- Gemfile.lock
|
|
164
179
|
- LICENSE
|
|
165
180
|
- Readme.md
|
|
166
|
-
-
|
|
167
|
-
- Test-Projects/
|
|
168
|
-
- Test-Projects/
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
- Test-Projects/Movie-tracker-bot/handlers/add_1_.rb
|
|
172
|
-
- Test-Projects/Movie-tracker-bot/handlers/add_2_.rb
|
|
173
|
-
- Test-Projects/Movie-tracker-bot/handlers/premium.rb
|
|
174
|
-
- Test-Projects/Movie-tracker-bot/handlers/report.rb
|
|
175
|
-
- Test-Projects/Movie-tracker-bot/handlers/search.rb
|
|
176
|
-
- Test-Projects/Movie-tracker-bot/handlers/sponsor.rb
|
|
177
|
-
- Test-Projects/Movie-tracker-bot/handlers/start.rb
|
|
178
|
-
- Test-Projects/Movie-tracker-bot/handlers/watch.rb
|
|
179
|
-
- Test-Projects/Test-submitted-by-marvel/.gitkeep
|
|
180
|
-
- Test-Projects/Test-submitted-by-marvel/Marvel-bot.md
|
|
181
|
-
- Test-Projects/bot_test1.rb
|
|
182
|
-
- Test-Projects/pizza_test_bot_guide.md
|
|
181
|
+
- Starts_HallofFame.md
|
|
182
|
+
- Test-Projects/bot.md
|
|
183
|
+
- Test-Projects/bot1.rb
|
|
184
|
+
- bin/.gitkeep
|
|
185
|
+
- bin/telegem-ssl
|
|
183
186
|
- docs-src/.gitkeep
|
|
184
187
|
- docs-src/Bot-registration_.PNG
|
|
185
188
|
- docs-src/bot.md
|
|
186
189
|
- docs-src/context|ctx|.md
|
|
190
|
+
- docs-src/ctx.md
|
|
187
191
|
- docs-src/getting-started.md
|
|
188
192
|
- docs-src/keyboard_inline.md
|
|
189
193
|
- docs-src/scene.md
|
|
190
|
-
- docs-src/
|
|
194
|
+
- docs-src/webhook.md
|
|
191
195
|
- lib/api/client.rb
|
|
192
196
|
- lib/api/types.rb
|
|
193
197
|
- lib/core/bot.rb
|
|
@@ -201,6 +205,8 @@ files:
|
|
|
201
205
|
- lib/telegem.rb
|
|
202
206
|
- lib/webhook/.gitkeep
|
|
203
207
|
- lib/webhook/server.rb
|
|
208
|
+
- public/.gitkeep
|
|
209
|
+
- public/index.html
|
|
204
210
|
homepage: https://gitlab.com/ruby-telegem/telegem
|
|
205
211
|
licenses:
|
|
206
212
|
- MIT
|
|
@@ -211,8 +217,10 @@ metadata:
|
|
|
211
217
|
bug_tracker_uri: https://gitlab.com/ruby-telegem/telegem/-/issues
|
|
212
218
|
documentation_uri: https://gitlab.com/ruby-telegem/telegem/-/tree/main/docs-src?ref_type=heads
|
|
213
219
|
rubygems_mfa_required: 'false'
|
|
214
|
-
post_install_message: "Thanks for installing Telegem
|
|
215
|
-
|
|
220
|
+
post_install_message: "Thanks for installing Telegem 3.0.1!\n\n\U0001F4DA Documentation:
|
|
221
|
+
https://gitlab.com/ruby-telegem/telegem\n\n\U0001F510 For SSL Webhooks:\nRun: telegem-ssl
|
|
222
|
+
your-domain.com\nThis sets up Let's Encrypt certificates automatically.\n\n\U0001F916
|
|
223
|
+
Happy bot building!\n"
|
|
216
224
|
rdoc_options: []
|
|
217
225
|
require_paths:
|
|
218
226
|
- lib
|
|
@@ -227,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
227
235
|
- !ruby/object:Gem::Version
|
|
228
236
|
version: '0'
|
|
229
237
|
requirements: []
|
|
230
|
-
rubygems_version: 3.6.
|
|
238
|
+
rubygems_version: 3.6.7
|
|
231
239
|
specification_version: 4
|
|
232
240
|
summary: Modern, fast Telegram Bot Framework for Ruby
|
|
233
241
|
test_files: []
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
require 'telegem'
|
|
3
|
-
require 'sqlite3'
|
|
4
|
-
require 'fileutils'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
require_relative './handlers/start'
|
|
8
|
-
require_relative './handlers/add_1_'
|
|
9
|
-
require_relative './handlers/premium'
|
|
10
|
-
require_relative './handlers/add_2_'
|
|
11
|
-
require_relative './handlers/sponsor'
|
|
12
|
-
require_relative './handlers/watch'
|
|
13
|
-
require_relative './handlers/report'
|
|
14
|
-
require_relative './handlers/search'
|
|
15
|
-
|
|
16
|
-
bot_token = ENV['BOT_TOKEN']
|
|
17
|
-
|
|
18
|
-
bot = Telegem.new(ENV['BOT_TOKEN'])
|
|
19
|
-
puts "token is #{bot_token[0..10]}"
|
|
20
|
-
# In your code:
|
|
21
|
-
db = SQLite3::Database.new "movieflix.db"
|
|
22
|
-
|
|
23
|
-
puts "started sqlite"
|
|
24
|
-
|
|
25
|
-
StartHandler.new(bot, db)
|
|
26
|
-
SearchHandler.new(bot, db)
|
|
27
|
-
WatchHandler.new(bot, db)
|
|
28
|
-
HelpHandler.new(bot)
|
|
29
|
-
PremiumHandler.new(bot)
|
|
30
|
-
SponsorHandler.new(bot)
|
|
31
|
-
AddHandler.new(bot, db)
|
|
32
|
-
AddHears.new(bot, db)
|
|
33
|
-
|
|
34
|
-
port = (ENV['PORT'] || 3000).to_i
|
|
35
|
-
puts " 📍 Using port: #{port}"
|
|
36
|
-
puts " 🌐 Bind host: 0.0.0.0"
|
|
37
|
-
|
|
38
|
-
# Start polling
|
|
39
|
-
bot.start_polling
|
|
40
|
-
puts " started polling"
|
|
41
|
-
|
|
42
|
-
# Minimal health check server
|
|
43
|
-
Thread.new do
|
|
44
|
-
require 'socket'
|
|
45
|
-
server = TCPServer.new('0.0.0.0', port || 10000)
|
|
46
|
-
puts "✅ Health check server listening on port #{ENV['PORT'] || 10000}"
|
|
47
|
-
|
|
48
|
-
loop do
|
|
49
|
-
client = server.accept
|
|
50
|
-
request = client.gets
|
|
51
|
-
|
|
52
|
-
# Simple response for any request
|
|
53
|
-
client.puts "HTTP/1.1 200 OK\r\n"
|
|
54
|
-
client.puts "Content-Type: text/plain\r\n"
|
|
55
|
-
client.puts "\r\n"
|
|
56
|
-
client.puts "Telegram Bot is running"
|
|
57
|
-
client.close
|
|
58
|
-
end
|
|
59
|
-
puts "bot is running "
|
|
60
|
-
end
|
|
61
|
-
sleep
|
|
62
|
-
puts "bot is running alive now "
|
|
File without changes
|