telegem 3.0.6 → 3.1.3

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/Contributing.md CHANGED
@@ -1,553 +1,161 @@
1
- 🤝 Contributing to Telegem
2
-
3
- Welcome! We're excited you want to contribute to Telegem. This guide will help you get started, whether you're fixing a bug, adding a feature, or improving documentation.
4
-
5
- ---
6
-
7
- 🎯 First Time Contributor?
8
-
9
- Start here! We welcome contributions of all sizes:
10
-
11
- · 🐛 Bug fixes - Found an issue? Help us fix it!
12
- · New features - Have an idea? Let's build it!
13
- · 📚 Documentation - Can something be clearer? Improve it!
14
- · 🧪 Tests - Help us make Telegem more reliable
15
- · 🌍 Examples - Share how you're using Telegem
16
-
17
- No contribution is too small! Even fixing a typo is appreciated.
18
-
19
- ---
20
-
21
- 📋 Table of Contents
22
-
23
- 1. Code of Conduct
24
- 2. Getting Started
25
- 3. Development Setup
26
- 4. Project Structure
27
- 5. Making Changes
28
- 6. Pull Request Process
29
- 7. Coding Standards
30
- 8. Testing
31
- 9. Documentation
32
- 10. Community
33
-
34
- ---
35
-
36
- 📜 Code of Conduct
37
-
38
- We are committed to providing a friendly, safe, and welcoming environment for all. By participating, you agree to:
39
-
40
- · Be respectful and inclusive
41
- · Give and receive constructive feedback gracefully
42
- · Focus on what's best for the community
43
- · Show empathy towards other community members
44
-
45
- Harassment of any kind will not be tolerated. If you experience or witness unacceptable behavior, please contact the maintainers.
46
-
47
- ---
48
-
49
- 🚀 Getting Started
50
-
51
- Find Something to Work On
52
-
53
- Good First Issues:
54
- Look for issues tagged with:
55
-
56
- · good first issue - Perfect for newcomers
57
- · help wanted - Need community help
58
- · documentation - Docs need improvement
59
-
60
- Want to suggest a feature?
61
-
62
- 1. Check if it already exists in issues
63
- 2. If not, open an issue to discuss first
64
- 3. Get feedback before writing code
65
-
66
- Communication
67
-
68
- · Discuss first - For significant changes, open an issue to discuss
69
- · Ask questions - Don't hesitate to ask for clarification
70
- · Be patient - Maintainers are volunteers with limited time
71
-
72
- ---
73
-
74
- 🛠️ Development Setup
75
-
76
- 1. Fork & Clone
77
-
78
- ```bash
79
- # Fork on GitLab
80
- # Then clone your fork
81
- git clone https://gitlab.com/YOUR_USERNAME/telegem.git
82
- cd telegem
83
- ```
84
-
85
- 2. Install Dependencies
86
-
87
- ```bash
88
- # Install Ruby (3.0+ required)
89
- ruby --version
90
-
91
- # Install Bundler if needed
92
- gem install bundler
93
-
94
- # Install gem dependencies
95
- bundle install
96
- ```
97
-
98
- 3. Set Up Your Environment
99
-
100
- ```bash
101
- # Create a test bot token
102
- # Get one from @BotFather on Telegram
103
- export TEST_BOT_TOKEN="your_test_token_here"
104
-
105
- # Optional: Set up test Redis for session tests
106
- export REDIS_URL="redis://localhost:6379"
107
- ```
108
-
109
- 4. Verify Setup
110
-
111
- ```bash
112
- # Run tests to ensure everything works
113
- bundle exec rake spec
114
-
115
- # Build the gem locally
116
- gem build telegem.gemspec
117
-
118
- # Test installation
119
- gem install ./telegem-*.gem
120
- ```
121
-
122
- ---
123
-
124
- 🏗️ Project Structure
125
-
126
- ```
127
- telegem/
128
- ├── lib/
129
- │ ├── telegem.rb # Main entry point
130
- │ ├── api/ # Telegram API client
131
- │ │ ├── client.rb
132
- │ │ └── types.rb
133
- │ ├── core/ # Core bot framework
134
- │ │ ├── bot.rb
135
- │ │ ├── context.rb
136
- │ │ ├── composer.rb
137
- │ │ └── scene.rb
138
- │ ├── session/ # Session management
139
- │ │ ├── middleware.rb
140
- │ │ └── memory_store.rb
141
- │ └── markup/ # Keyboard builders
142
- │ └── keyboard.rb
143
- ├── webhook/ # Webhook server
144
- │ └── server.rb
145
- ├── spec/ # Tests
146
- │ ├── unit/
147
- │ ├── integration/
148
- │ └── spec_helper.rb
149
- ├── examples/ # Example bots
150
- │ ├── pizza_bot.rb
151
- │ └── echo_bot.rb
152
- ├── docs/ # Documentation
153
- │ ├── How_to_use.md
154
- │ ├── usage.md
155
- │ ├── cookbook.md
156
- │ └── API.md
157
- ├── Gemfile
158
- ├── telegem.gemspec
159
- └── Rakefile
160
- ```
161
-
162
- ---
163
-
164
- 🔧 Making Changes
165
-
166
- 1. Create a Branch
167
-
168
- ```bash
169
- # Always work on a branch, never on main
170
- git checkout -b feature/your-feature-name
171
- # or
172
- git checkout -b fix/issue-description
173
- # or
174
- git checkout -b docs/improve-readme
175
- ```
176
-
177
- 2. Make Your Changes
178
-
179
- Follow our coding standards. Write tests for new functionality.
180
-
181
- 3. Test Your Changes
182
-
183
- ```bash
184
- # Run all tests
185
- bundle exec rake spec
186
-
187
- # Run specific test file
188
- bundle exec rspec spec/core/bot_spec.rb
189
-
190
- # Run with coverage
191
- bundle exec rspec --format progress --coverage
192
- ```
193
-
194
- 4. Update Documentation
195
-
196
- · Update relevant documentation
197
- · Add examples if adding new features
198
- · Update API reference if changing public API
199
-
200
- 5. Commit Your Changes
201
-
202
- ```bash
203
- # Use descriptive commit messages
204
- git commit -m "Add feature: description of change
205
-
206
- - Detail 1 about the change
207
- - Detail 2 about the change
208
- - Fixes #123 (if applicable)"
209
- ```
210
-
211
- Commit Message Guidelines:
212
-
213
- · First line: Summary (50 chars or less)
214
- · Blank line
215
- · Detailed description (wrap at 72 chars)
216
- · Reference issues: Fixes #123, Closes #456
217
-
218
- ---
219
-
220
- 🔄 Pull Request Process
221
-
222
- 1. Push Your Branch
223
-
224
- ```bash
225
- git push origin your-branch-name
226
- ```
227
-
228
- 2. Create a Merge Request
229
-
230
- On GitLab:
231
-
232
- 1. Click "Merge Requests" → "New Merge Request"
233
- 2. Select your branch
234
- 3. Fill in the template
235
- 4. Request review from maintainers
236
-
237
- 3. Merge Request Template
238
-
239
- ```markdown
240
- ## Description
241
- <!-- What does this PR do? Why is it needed? -->
242
-
243
- ## Type of Change
244
- - [ ] Bug fix (non-breaking change)
245
- - [ ] New feature (non-breaking change)
246
- - [ ] Breaking change (fix/feature causing existing functionality to break)
247
- - [ ] Documentation update
248
- - [ ] Example/test addition
249
-
250
- ## Testing
251
- - [ ] Added tests for new functionality
252
- - [ ] Updated existing tests
253
- - [ ] All tests pass locally
254
- - [ ] Manual testing completed
255
-
256
- ## Documentation
257
- - [ ] Updated API documentation
258
- - [ ] Updated usage examples
259
- - [ ] Updated README if needed
260
-
261
- ## Checklist
262
- - [ ] Code follows project standards
263
- - [ ] Self-reviewed my own code
264
- - [ ] Added comments for complex logic
265
- - [ ] No new warnings generated
266
- ```
267
-
268
- 4. Review Process
269
-
270
- · Maintainers will review within a few days
271
- · Address any feedback requested
272
- · Tests must pass
273
- · Keep discussions constructive
274
-
275
- 5. After Approval
276
-
277
- · Maintainer will merge your PR
278
- · Your contribution will be in the next release!
279
- · You'll be added to contributors list
280
-
281
- ---
282
-
283
- 📏 Coding Standards
284
-
285
- Ruby Style
286
-
287
- Follow Ruby Style Guide with these specifics:
288
-
289
- ```ruby
290
- # Good
291
- def send_message(text, parse_mode: nil)
292
- # ...
293
- end
294
-
295
- # Bad
296
- def sendMessage(text, parse_mode = nil)
297
- # ...
298
- end
299
- ```
300
-
301
- Naming
302
-
303
- · Modules/Classes: CamelCase
304
- · Methods/Variables: snake_case
305
- · Constants: SCREAMING_SNAKE_CASE
306
-
307
- Async Patterns
308
-
309
- ```ruby
310
- # Use Async.do for I/O operations
311
- def fetch_data
312
- Async do
313
- await api.call('method', params)
314
- end
315
- end
316
-
317
- # Handle errors properly
318
- Async do
319
- begin
320
- await risky_operation
321
- rescue => e
322
- logger.error("Failed: #{e.message}")
323
- raise
324
- end
325
- end
326
- ```
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
+ ```
327
78
 
328
79
  Documentation
329
80
 
330
- ```ruby
331
- # Document public methods
332
- # @param [String] text The message to send
333
- # @option options [String] :parse_mode "HTML", "Markdown", or "MarkdownV2"
334
- # @return [Async::Task] Async task that sends the message
335
- def reply(text, **options)
336
- Async do
337
- # ...
338
- end
339
- end
340
- ```
341
-
342
- ---
343
-
344
- 🧪 Testing
345
-
346
- Writing Tests
347
-
348
- ```ruby
349
- # spec/core/bot_spec.rb
350
- RSpec.describe Telegem::Core::Bot do
351
- describe "#command" do
352
- it "registers a command handler" do
353
- bot = described_class.new("test_token")
354
- bot.command('test') { |ctx| ctx.reply("Working") }
355
-
356
- expect(bot.handlers[:message].size).to eq(1)
357
- end
358
- end
359
- end
360
- ```
361
-
362
- Test Structure
81
+ Good documentation is crucial! You can help by:
363
82
 
364
- · Unit tests - Test individual components
365
- · Integration tests - Test component interactions
366
- · Async tests - Test async behavior properly
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
367
88
 
368
- Running Tests
89
+ Testing
369
90
 
370
91
  ```bash
371
- # All tests
372
- bundle exec rake spec
373
-
374
- # Specific test type
375
- bundle exec rspec spec/unit
376
- bundle exec rspec spec/integration
377
-
378
- # With verbose output
379
- bundle exec rspec --format documentation
380
-
381
- # Watch mode (development)
382
- bundle exec guard
92
+ # Run all tests
93
+ rspec test/spec.rb
94
+
95
+ bundle exec bundle-audit
383
96
  ```
384
97
 
385
- ---
386
-
387
- 📚 Documentation
98
+ 🎯 Pull Request Process
388
99
 
389
- Documentation Types
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
390
113
 
391
- 1. API Reference (docs/API.md) - Complete method documentation
392
- 2. Usage Guides (docs/usage.md) - Advanced patterns
393
- 3. Tutorials (docs/How_to_use.md) - Beginner guides
394
- 4. Cookbook (docs/cookbook.md) - Copy-paste recipes
395
- 5. Examples (examples/) - Working bot examples
396
114
 
397
- Writing Documentation
398
115
 
399
- · Use clear, simple language
400
- · Include code examples
401
- · Show both simple and advanced usage
402
- · Update when changing functionality
403
116
 
404
- Building Examples
405
117
 
406
- ```bash
407
- # Test your examples work
408
- cd examples
409
- ruby pizza_bot.rb --test-mode
410
- ```
118
+ 👥 Community
411
119
 
412
- ---
120
+ Discussion
413
121
 
414
- 🌍 Community
122
+ - Issues: GitLab Issues
123
+ - Merge Requests: GitLab MRs
415
124
 
416
125
  Getting Help
417
126
 
418
- · Issues - Bug reports and feature requests
419
- · Merge Requests - Code contributions
420
- · Discussions - Questions and ideas
421
- · Chat - Telegram group for quick questions
422
-
423
- Recognition
424
-
425
- All contributors are recognized in:
426
-
427
- · README.md contributors section
428
- · Release notes
429
- · Project documentation
430
-
431
- Becoming a Maintainer
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
432
130
 
433
- Consistent contributors may be invited to become maintainers. We look for:
131
+ 🏆 Recognition
434
132
 
435
- · Quality contributions over time
436
- · Helpful community participation
437
- · Understanding of project goals
438
- · Willingness to review others' work
133
+ All contributors are recognized in our HALL_OF_FAME.md. We appreciate every contribution, big or small!
439
134
 
440
- ---
441
-
442
- 🐛 Reporting Bugs
443
-
444
- Before Reporting
445
-
446
- 1. Check if issue already exists
447
- 2. Update to latest version
448
- 3. Try to reproduce with minimal code
449
-
450
- Bug Report Template
135
+ Contributors who make significant impact may be:
451
136
 
452
- ```markdown
453
- ## Description
454
- <!-- Clear description of the bug -->
137
+ - Added to the "Active Contributors" section
138
+ - Given commit access (for trusted, regular contributors)
139
+ - Featured in release notes
455
140
 
456
- ## Steps to Reproduce
457
- 1.
458
- 2.
459
- 3.
460
141
 
461
- ## Expected Behavior
462
- <!-- What should happen -->
463
142
 
464
- ## Actual Behavior
465
- <!-- What actually happens -->
143
+ Release Cycle
466
144
 
467
- ## Environment
468
- - Telegem version:
469
- - Ruby version:
470
- - OS:
471
- - Telegram Bot API token: (use test token)
145
+ - We follow Semantic Versioning
146
+ - Major releases
147
+ - Minor releases
148
+ - Patch releases
472
149
 
473
- ## Code Example
474
- ```ruby
475
- # Minimal code to reproduce
476
- ```
477
-
478
- Logs/Errors
150
+ License
479
151
 
480
- <!-- Any error messages or logs -->```
152
+ By contributing, you agree that your contributions will be licensed under the project's LICENSE.
481
153
 
482
154
  ---
483
155
 
484
- ## 💡 Suggesting Features
485
-
486
- ### Feature Request Template
487
- ```markdown
488
- ## Problem
489
- <!-- What problem does this solve? -->
490
-
491
- ## Solution
492
- <!-- Describe your proposed solution -->
493
-
494
- ## Alternatives
495
- <!-- Any alternative solutions considered -->
156
+ Thank you for contributing to Telegem! Your efforts help make this project better for everyone. 🚀
496
157
 
497
- ## Use Cases
498
- <!-- Who needs this and how will they use it? -->
499
-
500
- ## Implementation Ideas
501
- <!-- Technical implementation thoughts -->
502
158
  ```
159
+
503
160
 
504
- ---
505
-
506
- 🏷️ Release Process
507
-
508
- Versioning
509
-
510
- We follow Semantic Versioning:
511
-
512
- · MAJOR - Breaking changes
513
- · MINOR - New features (backwards compatible)
514
- · PATCH - Bug fixes (backwards compatible)
515
-
516
- Release Checklist
517
-
518
- · All tests pass
519
- · Documentation updated
520
- · Examples tested
521
- · Changelog updated
522
- · Version bumped in lib/telegem.rb
523
- · Git tag created
524
- · Gem pushed to RubyGems
525
- · Release notes published
526
-
527
- ---
528
-
529
- 🙏 Acknowledgments
530
-
531
- Thank you for contributing! Your work helps make Telegem better for everyone.
532
-
533
- Quick Start Recap
534
-
535
- 1. Fork & clone
536
- 2. Create branch
537
- 3. Make changes
538
- 4. Write tests
539
- 5. Update docs
540
- 6. Submit MR
541
-
542
- Remember: Every contribution matters. Whether you're fixing a typo or adding a major feature, you're helping build something awesome!
543
-
544
- ---
545
-
546
- ❓ Still Have Questions?
547
-
548
- · Read the documentation
549
- · Check existing issues
550
- · Ask in discussions
551
- · Join our Telegram group
552
-
553
- Happy coding! 🎉
161
+