telegem 3.4.0 → 3.6.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.
- checksums.yaml +4 -4
- data/.anv +2 -0
- data/CHANGELOG.md +28 -2
- data/README.md +2 -0
- data/_config.yml +10 -0
- data/docs/changelog.md +134 -169
- data/docs/webhooks.md +511 -19
- data/lib/api/client.rb +176 -55
- data/lib/api/types.rb +60 -9
- data/lib/core/context.rb +56 -0
- data/lib/core/rate_limit.rb +6 -3
- data/lib/telegem.rb +1 -1
- data/lib/webhook/server.rb +36 -14
- metadata +30 -16
- data/CODE_OF_CONDUCT.md +0 -13
- data/Gemfile.lock +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4afe1dcca2394d2581b01adf2f297704cce042bbb305837b69d67db564d32078
|
|
4
|
+
data.tar.gz: '05094b45797bea03c29e90e41579039b68edcc3d45e4dfd53956f0c4096f9cb6'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 182b284882e0df817bd5ecb593c3408c37a3e70fc28167013bf21aa5e6118132415103b26ae2bb2c3eaa223b260643714613c4dfeaea20d9c3c50108d744239e
|
|
7
|
+
data.tar.gz: dbe43b9158685118b5b1ca4354f8774bfb86ccaf968b7b8be188eb0fb5fd792d58667e2b8cf97f84d7495e8ef8d30d06737882af400a73a225f414446a8fb0be
|
data/.anv
ADDED
data/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,36 @@
|
|
|
1
1
|
# Telegem Changelog
|
|
2
2
|
|
|
3
|
-
## v3.
|
|
3
|
+
## v3.5.0 (latest)
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- **Bot API 10.0 Full Support**
|
|
7
|
+
- Guest mode support: `SentGuestMessage` type and `guest_message` update type
|
|
8
|
+
- Message reactions: Support for deleting reactions via `call('deleteAllMessageReactions', ...)` and `call('deleteMessageReaction', ...)`
|
|
9
|
+
- Live photos: `LivePhoto`, `InputMediaLivePhoto`, `PaidMediaLivePhoto`, `InputPaidMediaLivePhoto` types
|
|
10
|
+
- Poll media enhancements: `PollMedia`, `InputPollMedia`, `InputPollOptionMedia` types
|
|
11
|
+
- Business access: New types and methods accessible via generic `call` method
|
|
12
|
+
- Enhanced chat administrators: Support for `return_bots` parameter in `getChatAdministrators`
|
|
13
|
+
- User guest query support: `supports_guest_queries` field in User type
|
|
14
|
+
- Message guest fields: `guest_bot_caller_user`, `guest_bot_caller_chat`, `guest_query_id`, `live_photo` in Message type
|
|
15
|
+
- Poll media fields: `media`, `explanation_media` in Poll type; `media` in PollOption type
|
|
16
|
+
- Reaction permissions: `can_react_to_messages` in ChatPermissions and ChatMemberRestricted types
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Updated API version support to Bot API 10.0
|
|
20
|
+
- All new API methods automatically supported through generic `call()` and `call!()` methods
|
|
21
|
+
|
|
22
|
+
## v3.4.0
|
|
4
23
|
|
|
5
24
|
- added bot api 9.6 full support
|
|
6
25
|
- all fixes from v3.3.2-rc.1
|
|
7
|
-
|
|
26
|
+
- enhanced install message
|
|
27
|
+
- requires ruby v >= 3.4.x
|
|
28
|
+
- added bot api 9.6 helper to ctx
|
|
29
|
+
- introduced redis store to `session/redis_store.rb`
|
|
30
|
+
- new translate plugin
|
|
31
|
+
- added more docs to support telegem -v 3.x
|
|
32
|
+
- improved error message on invalid middlewares
|
|
33
|
+
- removed `concurrent-ruby` gem to keep telegem lightweight
|
|
8
34
|
|
|
9
35
|
## v3.3.2-rc.1
|
|
10
36
|
|
data/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Welcome to the comprehensive documentation for Telegem, a modern Ruby framework for building Telegram bots.
|
|
4
4
|
|
|
5
|
+
[](https://github.com/slick-lab/telegem/actions/workflows/github-code-scanning/codeql)
|
|
6
|
+
[](https://github.com/slick-lab/telegem)
|
|
5
7
|
[](https://badge.fury.io/rb/telegem)
|
|
6
8
|
[](https://t.me/r_telegem)
|
|
7
9
|
|
data/_config.yml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
site:
|
|
2
|
+
title: Telegem Documentation
|
|
3
|
+
description: Build Telegram bots with Ruby - Complete documentation and guides
|
|
4
|
+
url: https://slick-lab.github.io/telegem
|
|
5
|
+
baseurl: /telegem
|
|
6
|
+
theme: jekyll-theme-slate
|
|
7
|
+
markdown: kramdown
|
|
8
|
+
kramdown:
|
|
9
|
+
input: GFM
|
|
10
|
+
hard_wrap: false
|
data/docs/changelog.md
CHANGED
|
@@ -1,182 +1,147 @@
|
|
|
1
|
-
# Changelog
|
|
1
|
+
# Telegem Changelog
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [Unreleased]
|
|
3
|
+
## v3.5.0 (latest)
|
|
9
4
|
|
|
10
5
|
### Added
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- Structured logging support
|
|
23
|
-
- Connection pooling for better performance
|
|
24
|
-
- Graceful degradation features
|
|
25
|
-
- Input validation middleware
|
|
26
|
-
- Monitoring and metrics collection
|
|
6
|
+
- **Bot API 10.0 Full Support**
|
|
7
|
+
- Guest mode support: `SentGuestMessage` type and `guest_message` update type
|
|
8
|
+
- Message reactions: Support for deleting reactions via `call('deleteAllMessageReactions', ...)` and `call('deleteMessageReaction', ...)`
|
|
9
|
+
- Live photos: `LivePhoto`, `InputMediaLivePhoto`, `PaidMediaLivePhoto`, `InputPaidMediaLivePhoto` types
|
|
10
|
+
- Poll media enhancements: `PollMedia`, `InputPollMedia`, `InputPollOptionMedia` types
|
|
11
|
+
- Business access: New types and methods accessible via generic `call` method
|
|
12
|
+
- Enhanced chat administrators: Support for `return_bots` parameter in `getChatAdministrators`
|
|
13
|
+
- User guest query support: `supports_guest_queries` field in User type
|
|
14
|
+
- Message guest fields: `guest_bot_caller_user`, `guest_bot_caller_chat`, `guest_query_id`, `live_photo` in Message type
|
|
15
|
+
- Poll media fields: `media`, `explanation_media` in Poll type; `media` in PollOption type
|
|
16
|
+
- Reaction permissions: `can_react_to_messages` in ChatPermissions and ChatMemberRestricted types
|
|
27
17
|
|
|
28
18
|
### Changed
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
- Updated API version support to Bot API 10.0
|
|
20
|
+
- All new API methods automatically supported through generic `call()` and `call!()` methods
|
|
21
|
+
|
|
22
|
+
## v3.4.0
|
|
23
|
+
|
|
24
|
+
- added bot api 9.6 full support
|
|
25
|
+
- all fixes from v3.3.2-rc.1
|
|
26
|
+
- enhanced install message
|
|
27
|
+
- requires ruby v >= 3.4.x
|
|
28
|
+
- added bot api 9.6 helper to ctx
|
|
29
|
+
- introduced redis store to `session/redis_store.rb`
|
|
30
|
+
- new translate plugin
|
|
31
|
+
- added more docs to support telegem -v 3.x
|
|
32
|
+
- improved error message on invalid middlewares
|
|
33
|
+
- removed `concurrent-ruby` gem to keep telegem lightweight
|
|
34
|
+
|
|
35
|
+
## v3.3.2-rc.1
|
|
34
36
|
|
|
35
37
|
### Fixed
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
- Session persistence issues
|
|
38
|
+
- Webhook `set_webhook` now correctly passes URL as positional argument
|
|
39
|
+
- Removed unsafe thread usage in `Context#with_typing` (async-safe now)
|
|
40
|
+
- Added automatic retry with exponential backoff in API client
|
|
41
|
+
- Improved `telegem-ssl` to detect dnf/yum on Fedora/RHEL
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
### Changed
|
|
44
|
+
- No breaking changes. Safe upgrade from v3.3.1.
|
|
43
45
|
|
|
44
|
-
### Added
|
|
45
|
-
- Initial release of Telegem framework
|
|
46
|
-
- Core bot functionality with command and hears handlers
|
|
47
|
-
- Telegram API client with automatic retries
|
|
48
|
-
- Session management with memory and Redis stores
|
|
49
|
-
- Scene system for multi-step conversations
|
|
50
|
-
- Inline and reply keyboard DSL
|
|
51
|
-
- Webhook and polling support
|
|
52
|
-
- FileExtract plugin for document processing
|
|
53
|
-
- Translate plugin for text translation
|
|
54
|
-
- Middleware system for request processing
|
|
55
|
-
- Type-safe API response handling
|
|
56
|
-
- Comprehensive error handling
|
|
57
|
-
- Async I/O support with Async gem
|
|
58
|
-
- Rate limiting and timeout handling
|
|
59
|
-
- SSL/TLS support for webhooks
|
|
60
|
-
|
|
61
|
-
### Technical Details
|
|
62
|
-
- Ruby 3.0+ requirement
|
|
63
|
-
- Async gem for concurrency
|
|
64
|
-
- Modular architecture with plugins
|
|
65
|
-
- RESTful API design
|
|
66
|
-
- Comprehensive test coverage
|
|
67
|
-
- Production-ready deployment options
|
|
68
46
|
|
|
69
|
-
|
|
47
|
+
## v3.3.1
|
|
48
|
+
### Features
|
|
49
|
+
- improved memeorystore to include diskbackup
|
|
50
|
+
- added 'telegem-init' cli
|
|
70
51
|
|
|
71
|
-
## Version History
|
|
72
|
-
|
|
73
|
-
### Pre-1.0 Releases
|
|
74
|
-
|
|
75
|
-
#### [0.5.0] - 2023-12-01
|
|
76
|
-
- Beta release with core functionality
|
|
77
|
-
- Basic bot operations
|
|
78
|
-
- API client implementation
|
|
79
|
-
- Handler system
|
|
80
|
-
- Session management
|
|
81
|
-
|
|
82
|
-
#### [0.3.0] - 2023-11-15
|
|
83
|
-
- Alpha release
|
|
84
|
-
- Basic Telegram API integration
|
|
85
|
-
- Command parsing
|
|
86
|
-
- Message handling
|
|
87
|
-
|
|
88
|
-
#### [0.1.0] - 2023-10-01
|
|
89
|
-
- Initial prototype
|
|
90
|
-
- Basic bot framework structure
|
|
91
|
-
- Proof of concept implementation
|
|
92
|
-
|
|
93
|
-
## Migration Guide
|
|
94
|
-
|
|
95
|
-
### Upgrading from 0.x to 1.0
|
|
96
|
-
|
|
97
|
-
#### Breaking Changes
|
|
98
|
-
1. **Handler Registration:**
|
|
99
|
-
```ruby
|
|
100
|
-
# Old
|
|
101
|
-
bot.on('/start') { |ctx| ... }
|
|
102
|
-
|
|
103
|
-
# New
|
|
104
|
-
bot.command('start') { |ctx| ... }
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
2. **Session Store:**
|
|
108
|
-
```ruby
|
|
109
|
-
# Old
|
|
110
|
-
bot.session_store = Redis.new
|
|
111
|
-
|
|
112
|
-
# New
|
|
113
|
-
bot.session_store = Telegem::Session::RedisStore.new(ENV['REDIS_URL'])
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
3. **Middleware:**
|
|
117
|
-
```ruby
|
|
118
|
-
# Old
|
|
119
|
-
bot.middleware.add(MyMiddleware)
|
|
120
|
-
|
|
121
|
-
# New
|
|
122
|
-
bot.use MyMiddleware.new
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
#### New Features
|
|
126
|
-
- Async operations support
|
|
127
|
-
- Plugin system
|
|
128
|
-
- Enhanced error handling
|
|
129
|
-
- Webhook SSL support
|
|
130
|
-
- Scene system improvements
|
|
131
|
-
|
|
132
|
-
#### Migration Steps
|
|
133
|
-
1. Update handler registrations
|
|
134
|
-
2. Configure new session store format
|
|
135
|
-
3. Update middleware usage
|
|
136
|
-
4. Add error handling
|
|
137
|
-
5. Test thoroughly
|
|
138
|
-
|
|
139
|
-
## Future Plans
|
|
140
|
-
|
|
141
|
-
### Version 1.1.0 (Planned)
|
|
142
|
-
- [ ] Database session store
|
|
143
|
-
- [ ] Message queue integration
|
|
144
|
-
- [ ] Advanced rate limiting
|
|
145
|
-
- [ ] Bot analytics dashboard
|
|
146
|
-
- [ ] Multi-language support
|
|
147
|
-
|
|
148
|
-
### Version 1.2.0 (Planned)
|
|
149
|
-
- [ ] Voice message handling
|
|
150
|
-
- [ ] Location services integration
|
|
151
|
-
- [ ] Payment processing
|
|
152
|
-
- [ ] Bot-to-bot communication
|
|
153
|
-
- [ ] Advanced scene workflows
|
|
154
|
-
|
|
155
|
-
### Version 2.0.0 (Planned)
|
|
156
|
-
- [ ] GraphQL API support
|
|
157
|
-
- [ ] Real-time updates with WebSocket
|
|
158
|
-
- [ ] Machine learning integrations
|
|
159
|
-
- [ ] Advanced NLP features
|
|
160
|
-
- [ ] Multi-platform bot support
|
|
161
|
-
|
|
162
|
-
## Contributing
|
|
163
|
-
|
|
164
|
-
When contributing to Telegem, please:
|
|
165
|
-
1. Update the changelog with your changes
|
|
166
|
-
2. Follow the existing format
|
|
167
|
-
3. Add entries under [Unreleased] section
|
|
168
|
-
4. Categorize changes as Added, Changed, Fixed, or Removed
|
|
169
|
-
|
|
170
|
-
## Categories
|
|
171
|
-
|
|
172
|
-
- **Added** for new features
|
|
173
|
-
- **Changed** for changes in existing functionality
|
|
174
|
-
- **Deprecated** for soon-to-be removed features
|
|
175
|
-
- **Removed** for now removed features
|
|
176
|
-
- **Fixed** for any bug fixes
|
|
177
|
-
- **Security** in case of vulnerabilities
|
|
178
52
|
|
|
179
|
-
|
|
53
|
+
## v3.1.1
|
|
54
|
+
|
|
55
|
+
### New Features
|
|
56
|
+
|
|
57
|
+
-FileExtractor Plugin: New plugin for extracting content from various file types (PDF, JSON, HTML, TXT)
|
|
58
|
+
- Async File Download: Added download method to API client for downloading Telegram files
|
|
59
|
+
- Context File Helpers: Added download_file, download_photo, download_document methods to Context
|
|
60
|
+
- Extended File Support: Plugin supports PDF text extraction, JSON parsing, HTML/raw text processing
|
|
61
|
+
- Async/Sync Dual Mode: All file operations available in both sync (download) and async (download!) modes
|
|
62
|
+
|
|
63
|
+
## v3.1.0
|
|
64
|
+
|
|
65
|
+
### features
|
|
66
|
+
- BREAKING: Rewrote polling system to prevent duplicate messages
|
|
67
|
+
- Fixed thread deadlock in async polling loop
|
|
68
|
+
- Added scene_middleware.rb for scene-based conversations
|
|
69
|
+
- Improved MemoryStore with TTL and thread safety
|
|
70
|
+
- Enhanced keyboard markup builder with web_app support
|
|
71
|
+
- Added message reaction and chat boost update types
|
|
72
|
+
- Fixed callback query handling for inline keyboards
|
|
73
|
+
|
|
74
|
+
## v3.0.0
|
|
75
|
+
### features
|
|
76
|
+
|
|
77
|
+
- BREAKING: Complete async rewrite with async gem
|
|
78
|
+
- New HTTP client using HTTPX with proper async/await pattern
|
|
79
|
+
- Added scene system for multi-step conversations
|
|
80
|
+
- Middleware composer system for plugin architecture
|
|
81
|
+
- Type system with dynamic accessors for Telegram objects
|
|
82
|
+
- Session management with memory store
|
|
83
|
+
- Rate limiting middleware
|
|
84
|
+
- File upload support via multipart forms
|
|
85
|
+
|
|
86
|
+
## v2.0.0
|
|
87
|
+
|
|
88
|
+
- BREAKING: Ruby 3.0+ requirement
|
|
89
|
+
- Added webhook support with Rack middleware
|
|
90
|
+
- Inline query and callback query handlers
|
|
91
|
+
- Location, contact, and poll answer handlers
|
|
92
|
+
- Keyboard markup helpers (Telegem::Markup)
|
|
93
|
+
- Improved error handling with custom error classes
|
|
94
|
+
- Logging integration with configurable loggers
|
|
95
|
+
|
|
96
|
+
## v1.5.0
|
|
97
|
+
|
|
98
|
+
- Added command argument parsing (ctx.command_args)
|
|
99
|
+
- Message entity parsing (mentions, hashtags, bot commands)
|
|
100
|
+
- Chat member update handlers
|
|
101
|
+
- Pre-checkout and shipping query support
|
|
102
|
+
- File download helper methods
|
|
103
|
+
- Context helper methods for common API calls
|
|
104
|
+
|
|
105
|
+
## v1.0.0
|
|
106
|
+
|
|
107
|
+
- Stable API release
|
|
108
|
+
- Message handlers with text pattern matching
|
|
109
|
+
- Command handlers with regex support
|
|
110
|
+
- Basic context object with chat/message accessors
|
|
111
|
+
- Simple API client with error handling
|
|
112
|
+
- Polling and webhook modes
|
|
113
|
+
- Configuration options for timeout and limits
|
|
114
|
+
|
|
115
|
+
## v0.5.0
|
|
180
116
|
|
|
181
|
-
|
|
182
|
-
|
|
117
|
+
- Added callback query support
|
|
118
|
+
- Inline keyboard builder
|
|
119
|
+
- Message editing and deletion helpers
|
|
120
|
+
- Media sending methods (photo, document, audio, video)
|
|
121
|
+
- Chat action methods (typing, upload indicators)
|
|
122
|
+
|
|
123
|
+
## v0.3.0
|
|
124
|
+
|
|
125
|
+
- Middleware system with bot.use
|
|
126
|
+
- Session management foundation
|
|
127
|
+
- Basic rate limiting
|
|
128
|
+
- Command filtering by chat type
|
|
129
|
+
- Improved logging with debug levels
|
|
130
|
+
|
|
131
|
+
## v0.2.0
|
|
132
|
+
|
|
133
|
+
- Basic polling implementation
|
|
134
|
+
- Message type detection (text, photo, document)
|
|
135
|
+
- Command parsing with arguments
|
|
136
|
+
- Simple reply methods
|
|
137
|
+
- Error handling for API calls
|
|
138
|
+
|
|
139
|
+
## v0.1.0 (Initial Release)
|
|
140
|
+
|
|
141
|
+
- Basic Telegram Bot API wrapper
|
|
142
|
+
- Send/receive messages
|
|
143
|
+
- Simple command handling
|
|
144
|
+
- Minimal dependencies (just httparty)
|
|
145
|
+
- Support for basic message types
|
|
146
|
+
|
|
147
|
+
---
|