telegem 3.3.0 → 3.4.0

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.
data/CHANGELOG DELETED
@@ -1,95 +0,0 @@
1
- Telegem Changelog
2
-
3
- v3.1.1 (current)
4
-
5
- 🚀 New Features
6
-
7
- · FileExtractor Plugin: New plugin for extracting content from various file types (PDF, JSON, HTML, TXT)
8
- · Async File Download: Added download method to API client for downloading Telegram files
9
- · Context File Helpers: Added download_file, download_photo, download_document methods to Context
10
- · Extended File Support: Plugin supports PDF text extraction, JSON parsing, HTML/raw text processing
11
- · Async/Sync Dual Mode: All file operations available in both sync (download) and async (download!) modes
12
-
13
- v3.1.0
14
-
15
- · BREAKING: Rewrote polling system to prevent duplicate messages
16
- · Fixed thread deadlock in async polling loop
17
- · Added scene_middleware.rb for scene-based conversations
18
- · Improved MemoryStore with TTL and thread safety
19
- · Enhanced keyboard markup builder with web_app support
20
- · Added message reaction and chat boost update types
21
- · Fixed callback query handling for inline keyboards
22
-
23
- v3.0.0
24
-
25
- · BREAKING: Complete async rewrite with async gem
26
- · New HTTP client using HTTPX with proper async/await pattern
27
- · Added scene system for multi-step conversations
28
- · Middleware composer system for plugin architecture
29
- · Type system with dynamic accessors for Telegram objects
30
- · Session management with memory store
31
- · Rate limiting middleware
32
- · File upload support via multipart forms
33
-
34
- v2.0.0
35
-
36
- · BREAKING: Ruby 3.0+ requirement
37
- · Added webhook support with Rack middleware
38
- · Inline query and callback query handlers
39
- · Location, contact, and poll answer handlers
40
- · Keyboard markup helpers (Telegem::Markup)
41
- · Improved error handling with custom error classes
42
- · Logging integration with configurable loggers
43
-
44
- v1.5.0
45
-
46
- · Added command argument parsing (ctx.command_args)
47
- · Message entity parsing (mentions, hashtags, bot commands)
48
- · Chat member update handlers
49
- · Pre-checkout and shipping query support
50
- · File download helper methods
51
- · Context helper methods for common API calls
52
-
53
- v1.0.0
54
-
55
- · Stable API release
56
- · Message handlers with text pattern matching
57
- · Command handlers with regex support
58
- · Basic context object with chat/message accessors
59
- · Simple API client with error handling
60
- · Polling and webhook modes
61
- · Configuration options for timeout and limits
62
-
63
- v0.5.0
64
-
65
- · Added callback query support
66
- · Inline keyboard builder
67
- · Message editing and deletion helpers
68
- · Media sending methods (photo, document, audio, video)
69
- · Chat action methods (typing, upload indicators)
70
-
71
- v0.3.0
72
-
73
- · Middleware system with bot.use
74
- · Session management foundation
75
- · Basic rate limiting
76
- · Command filtering by chat type
77
- · Improved logging with debug levels
78
-
79
- v0.2.0
80
-
81
- · Basic polling implementation
82
- · Message type detection (text, photo, document)
83
- · Command parsing with arguments
84
- · Simple reply methods
85
- · Error handling for API calls
86
-
87
- v0.1.0 (Initial Release)
88
-
89
- · Basic Telegram Bot API wrapper
90
- · Send/receive messages
91
- · Simple command handling
92
- · Minimal dependencies (just httparty)
93
- · Support for basic message types
94
-
95
- ---
data/Contributing.md DELETED
@@ -1,161 +0,0 @@
1
- # 🤝 contributing to Telegem
2
-
3
- Thank you for your interest in contributing to Telegem! This document provides guidelines and instructions for contributing to Telegem.
4
- whether you are fixing bugs, improving documentation or proposing new features, your contributions are welcome
5
-
6
- ## 📋 Table of Contents
7
- - [Code of Conduct](#-code-of-conduct)
8
- - [Getting Started](#-getting-started)
9
- - [How to Contribute](#-how-to-contribute)
10
- - [Reporting Bugs](#reporting-bugs)
11
- - [Suggesting Features](#suggesting-features)
12
- - [Code Contributions](#code-contributions)
13
- - [Documentation](#documentation)
14
- - [Development Setup](#-development-setup)
15
- - [Pull Request Process](#-pull-request-process)
16
- - [Style Guides](#-style-guides)
17
- - [Community](#-community)
18
- - [Recognition](#-recognition)
19
-
20
- ## code of conduct
21
-
22
- We are committed to providing a welcoming and inspiring community for all. Please read our [Code of Conduct](CODE_OF_CONDUCT.md) before participating.
23
-
24
- ## 🚀 Getting Started
25
-
26
- ### Prerequisites
27
- - Ruby v3.x
28
- - Git
29
-
30
- ### Quick Start
31
- 1. **Fork the repository** on GitLab
32
- 2. **Clone your fork:**
33
- ```bash
34
- git clone https://gitlab.com/your-username/telegem.git
35
- cd telegem
36
- ```
37
- 3. Install dependencies
38
- ```bash
39
- $ gem install
40
- ```
41
- 4. run test
42
- ```bash
43
- $ rspec test/spec.rb
44
- ```
45
- ## How to contribute
46
-
47
- ##reporting bugs
48
- Bugs are tracked as Gitlab Issues
49
-
50
- **before submitting a bug report:**
51
- - check if the issue has already been reported
52
- - update to the latest version to see if issues persists
53
- - check the documentation and existing solutions to the issue
54
- **A good report includes:**
55
- 1. clear descriptive title
56
- 2. steps to be reproduced (be specific)
57
- 3. expected behavior
58
- 4. relevant logs or message
59
-
60
- Code Contributions
61
-
62
- 1. Find an issue to work on:
63
- - Check issues labeled good first issue or help wanted
64
- - Comment on the issue to let us know you're working on it
65
- 2. Create a feature branch:
66
- ```bash
67
- git checkout -b feature/your-feature-name
68
- # or
69
- git checkout -b fix/issue-description
70
- ```
71
- 3. Make your changes
72
- 4. Write/update tests
73
- 5. Update documentation if needed
74
- 6. Run tests locally:
75
- ```bash
76
- rspec test/spec.rb
77
- ```
78
-
79
- Documentation
80
-
81
- Good documentation is crucial! You can help by:
82
-
83
- - Fixing typos or unclear explanations
84
- - Adding examples to existing documentation
85
- - Writing tutorials or how-to guides
86
- - Improving API documentation
87
- - Translating documentation
88
-
89
- Testing
90
-
91
- ```bash
92
- # Run all tests
93
- rspec test/spec.rb
94
-
95
- bundle exec bundle-audit
96
- ```
97
-
98
- 🎯 Pull Request Process
99
-
100
- 1. Update your fork with the latest changes from upstream:
101
- ```bash
102
- git remote add upstream https://gitlab.com/ruby-telegem/telegem.git
103
- git fetch upstream
104
- git rebase upstream/main
105
- ```
106
- 2. Ensure all tests pass
107
- 3. Update documentation if your changes affect functionality
108
- 4. Create a Merge Request (MR) on GitLab:
109
- - Use a clear, descriptive title
110
- - Reference any related issues (e.g., "Closes #123")
111
- 5. Address review feedback promptly
112
- 6. Once approved, a maintainer will merge your changes
113
-
114
-
115
-
116
-
117
-
118
- 👥 Community
119
-
120
- Discussion
121
-
122
- - Issues: GitLab Issues
123
- - Merge Requests: GitLab MRs
124
-
125
- Getting Help
126
-
127
- - Search existing issues and documentation first
128
- - Be respectful and patient with other community members
129
- - Provide as much context as possible when asking for help
130
-
131
- 🏆 Recognition
132
-
133
- All contributors are recognized in our HALL_OF_FAME.md. We appreciate every contribution, big or small!
134
-
135
- Contributors who make significant impact may be:
136
-
137
- - Added to the "Active Contributors" section
138
- - Given commit access (for trusted, regular contributors)
139
- - Featured in release notes
140
-
141
-
142
-
143
- Release Cycle
144
-
145
- - We follow Semantic Versioning
146
- - Major releases
147
- - Minor releases
148
- - Patch releases
149
-
150
- License
151
-
152
- By contributing, you agree that your contributions will be licensed under the project's LICENSE.
153
-
154
- ---
155
-
156
- Thank you for contributing to Telegem! Your efforts help make this project better for everyone. 🚀
157
-
158
- ```
159
-
160
-
161
-
data/Readme.md DELETED
@@ -1,302 +0,0 @@
1
- ![Telegem Logo](https://gitlab.com/ruby-telegem/telegem/-/raw/main/assets/logo.png)
2
-
3
- Modern, blazing-fast async Telegram Bot API for Ruby - Inspired by Telegraf, built for performance.
4
-
5
- ![Gem Version](https://badge.fury.io/rb/telegem.svg) ![GitLab](https://img.shields.io/badge/gitlab-telegem-orange) ![Ruby Version](https://img.shields.io/badge/Ruby-3.0+-red.svg) ![License](https://img.shields.io/badge/License-MIT-blue.svg) ![Async I/O](https://img.shields.io/badge/Async-I/O-green.svg)
6
-
7
- ![GitLab stars](https://img.shields.io/gitlab/stars/ruby-telegem/telegem?style=for-the-badge&logo=gitlab&color=orange)
8
- ![GitLab contributors](https://img.shields.io/gitlab/contributors/ruby-telegem/telegem?style=for-the-badge&logo=gitlab)
9
- ![GitLab last commit](https://img.shields.io/gitlab/last-commit/ruby-telegem/telegem?style=for-the-badge&logo=gitlab)
10
- ![GitLab license](https://img.shields.io/gitlab/license/ruby-telegem/telegem?style=for-the-badge&logo=gitlab)
11
-
12
-
13
-
14
- Blazing-fast, modern Telegram Bot framework for Ruby. Inspired by Telegraf.js, built for performance with true async/await patterns.
15
-
16
- ---
17
-
18
- ✨ Features
19
-
20
- - ⚡ True Async I/O - Built on async gem, not blocking threads
21
- - 🎯 Telegraf-style DSL - Familiar API for JavaScript developers
22
- - 🔌 Middleware System - Compose behavior like Express.js
23
- - 🧙 Scene System - Multi-step conversations (wizards/forms)
24
- - 💾 Session Management - Redis, memory, or custom stores
25
- - ⌨️ Keyboard DSL - Clean markup builders with fluent API
26
- - 🌐 Webhook Server - Production-ready async HTTP server
27
- - 🏗️ Type-Safe Objects - Ruby classes for all Telegram types
28
- - 📦 Minimal Dependencies - Just async gems + mime-types
29
-
30
- ---
31
-
32
- 🚀 Quick Start
33
-
34
- Installation
35
-
36
- ```bash
37
- gem install telegem
38
- ```
39
-
40
- Or add to your Gemfile:
41
-
42
- ```ruby
43
- gem 'telegem'
44
- ```
45
-
46
- Your First Bot (in 60 seconds)
47
-
48
- ```ruby
49
- require 'telegem'
50
-
51
- # 1. Get token from @BotFather on Telegram
52
- bot = Telegem.new('YOUR_BOT_TOKEN')
53
-
54
- # 2. Add commands
55
- bot.command('start') do |ctx|
56
- ctx.reply "Hello #{ctx.from.first_name}! 👋"
57
- end
58
-
59
- bot.command('help') do |ctx|
60
- ctx.reply "I'm your friendly Telegem bot!"
61
- end
62
-
63
- # 3. Start listening
64
- puts "🤖 Bot starting..."
65
- bot.start_polling
66
- ```
67
-
68
- Interactive Example
69
-
70
- ```ruby
71
- # Pizza ordering bot example
72
- bot.command('order') do |ctx|
73
- keyboard = Telegem.keyboard do
74
- row "🍕 Margherita", "🍕 Pepperoni"
75
- row "🥤 Drinks", "🍰 Dessert"
76
- row "📞 Support", "❌ Cancel"
77
- end.resize.one_time
78
-
79
- ctx.reply "What would you like?", reply_markup: keyboard
80
- end
81
- ```
82
-
83
- ---
84
-
85
-
86
- ---
87
-
88
- 🎯 Why Telegem?
89
-
90
- vs. Other Ruby Telegram Libraries
91
-
92
- | Telegem | telegram-bot-ruby |
93
- | ------ | ------ |
94
- | fast async | multiple thread |
95
- | non blocking request | slow thread based |
96
- | clean telegraf dsl | no dsl |
97
- | scene management. | verbose |
98
- | middleware | raw json |
99
- | clean markup dsl|. |
100
-
101
- Perfect For:
102
-
103
- - High-traffic bots needing async performance
104
- - Complex conversations with multi-step flows
105
- - Production deployments with webhooks & scaling
106
- - Developers familiar with Telegraf.js/Express
107
- - Modern Ruby (3.0+) applications
108
-
109
- ---
110
-
111
- [📚 Documentation](https://rubydoc.info/gems/telegem/3.2.3/index)
112
-
113
-
114
-
115
- 🧩 Advanced Features
116
-
117
- Scene System (Multi-step Conversations)
118
-
119
- ```ruby
120
- bot.scene :registration do
121
- step :ask_name do |ctx|
122
- ctx.reply "What's your name?"
123
- end
124
-
125
- step :save_name do |ctx|
126
- ctx.session[:name] = ctx.message.text
127
- ctx.reply "Hi #{ctx.session[:name]}! What's your email?"
128
- end
129
-
130
- step :complete do |ctx|
131
- ctx.session[:email] = ctx.message.text
132
- ctx.reply "Registration complete! ✅"
133
- ctx.leave_scene
134
- end
135
- end
136
- ```
137
-
138
- Middleware Pipeline
139
-
140
- ```ruby
141
- # Add cross-cutting concerns
142
- bot.use AuthenticationMiddleware.new
143
- bot.use RateLimiter.new(limit: 10)
144
- bot.use LoggingMiddleware.new
145
-
146
- # Custom middleware
147
- bot.use do |ctx, next_middleware|
148
- puts "Processing message from #{ctx.from.username}"
149
- next_middleware.call(ctx)
150
- end
151
- ```
152
-
153
- Multiple Session Stores
154
-
155
- ```ruby
156
- # Memory (development)
157
- Telegem::Session::MemoryStore.new
158
-
159
- # Redis (production)
160
- require 'redis'
161
- redis = Redis.new(url: ENV['REDIS_URL'])
162
- Telegem::Session::RedisStore.new(redis)
163
-
164
- # Custom (database, etc.)
165
- class DatabaseStore
166
- def get(user_id); end
167
- def set(user_id, data); end
168
- end
169
- ```
170
-
171
- ---
172
-
173
- 🌐 Production Deployment
174
-
175
- Webhook Mode (Recommended)
176
-
177
- ```ruby
178
- # Production setup
179
- server = bot.webhook_server(
180
- port: ENV['PORT'] || 3000,
181
- endpoint: Async::HTTP::Endpoint.parse("https://#{ENV['DOMAIN']}")
182
- )
183
-
184
- # Set webhook automatically
185
- bot.set_webhook(
186
- url: "https://#{ENV['DOMAIN']}/webhook/#{bot.token}",
187
- max_connections: 40
188
- )
189
-
190
- server.run
191
- end
192
- ```
193
-
194
- Docker Deployment
195
-
196
- ```dockerfile
197
- FROM ruby:3.2-alpine
198
- WORKDIR /app
199
- COPY Gemfile Gemfile.lock ./
200
- RUN bundle install
201
- COPY . .
202
- CMD ["ruby", "bot.rb"]
203
- ```
204
-
205
- ---
206
-
207
-
208
- ---
209
-
210
- 📦 Project Structure
211
-
212
- ```
213
- my_bot/
214
- ├── bot.rb # Main bot file
215
- ├── Gemfile
216
- ├── config/
217
- │ ├── initializers/ # Middleware, database setup
218
- │ └── environments/ # Development/production configs
219
- ├── lib/
220
- │ ├── middleware/ # Custom middleware classes
221
- │ ├── scenes/ # Scene definitions
222
- │ └── services/ # Business logic
223
- ├── db/ # Database migrations
224
- └── spec/ # Tests
225
- ```
226
-
227
- ---
228
-
229
- [🤝 contributing](https://gitlab.com/ruby-telegem/telegem/-/blob/main/Contributing.md)
230
-
231
-
232
-
233
- Development Setup:
234
-
235
- ```bash
236
- git clone https://gitlab.com/ruby-telegem/telegem.git
237
- cd telegem
238
- bundle install
239
- rake spec # Run tests
240
- ```
241
-
242
- Need Help?
243
-
244
- - Issues - Bug reports and feature requests
245
- - Merge Requests - Code contributions
246
- - Discussions - Questions and ideas
247
-
248
- ---
249
-
250
- 🚧 Roadmap
251
-
252
- Coming Soon
253
-
254
- - Plugin System - Community plugins ecosystem
255
- - More Session Stores - PostgreSQL, MySQL, MongoDB
256
- - Built-in Analytics - Usage tracking & insights
257
- - Admin Dashboard - Web interface for bot management
258
-
259
-
260
- ---
261
-
262
- 📄 License
263
-
264
- MIT License - see LICENSE.txt for details.
265
-
266
- ---
267
-
268
- 🙏 Acknowledgments
269
-
270
- - Inspired by Telegraf.js - Amazing Node.js Telegram framework
271
- - Built on async - Ruby's async I/O gem
272
- - Thanks to the Telegram team for the excellent Bot API
273
- - Community - All contributors and users
274
-
275
- ---
276
-
277
- 🌟 Star History
278
-
279
- [history](https://api.star-history.com/svg?repos=ruby-telegem/telegem&type=Date)
280
-
281
- ---
282
-
283
- 📞 Support & Community
284
-
285
- - GitLab Issues: Report bugs & request features
286
- - Examples: Example bots repository
287
- - Chat: Join our community (Telegram group)
288
-
289
- ---
290
-
291
- 🎉 Ready to Build?
292
-
293
- ```bash
294
- # Start building your bot now!
295
- gem install telegem
296
- ruby -r telegem -e "puts 'Welcome to Telegem! 🚀'"
297
- ```
298
-
299
-
300
- ---
301
-
302
- Built with ❤️ for the Ruby community. Happy bot building! 🤖✨
data/examples/.gitkeep DELETED
File without changes
data/public/.gitkeep DELETED
File without changes