Added grouping
This commit is contained in:
@@ -133,6 +133,8 @@ This will create ProjectBeta with only alice and bob, regardless of the default
|
||||
|
||||
QR backup data is the GroupHelp settings backup payload generated by GroupHelp itself. It is used to copy GroupHelp settings, such as welcome-message configuration, from one group to another by rendering the payload as a QR image and sending it with a `.importbackup` caption.
|
||||
|
||||
GroupFactory supports multiple logical QR config groups. The built-in group is `default`; additional names such as `sales`, `support`, or `alerts` can each have their own stored QR payload and assigned Telegram groups.
|
||||
|
||||
### Step 1: Generate or Obtain QR Code
|
||||
|
||||
Generate the QR backup from GroupHelp in the source group. You can either store the decoded payload directly, or start the interactive importer and forward the original GroupHelp QR image message.
|
||||
@@ -145,6 +147,12 @@ Store the GroupHelp QR backup payload directly:
|
||||
/admin_set_qr YOUR_QR_PAYLOAD_HERE
|
||||
```
|
||||
|
||||
Store a payload for a named logical QR group:
|
||||
|
||||
```
|
||||
/admin_set_qr sales YOUR_SALES_QR_PAYLOAD_HERE
|
||||
```
|
||||
|
||||
Example:
|
||||
```
|
||||
/admin_set_qr new_390530c569ec8902a6cbd8482d51d70d2857d4a0
|
||||
@@ -156,11 +164,17 @@ Or start the interactive QR importer:
|
||||
/admin_set_qr
|
||||
```
|
||||
|
||||
Then forward the original GroupHelp QR image message into the staff chat. The forwarded image message must have `.importbackup` as its caption/body. GroupFactory decodes the QR image and stores the decoded payload.
|
||||
Then forward the original GroupHelp QR image message into the staff chat. The forwarded image message must have `.importbackup` as its caption/body. GroupFactory decodes the QR image and stores the decoded payload for `default`.
|
||||
|
||||
For a named QR group, start the importer with:
|
||||
|
||||
```
|
||||
/admin_set_qr_group sales
|
||||
```
|
||||
|
||||
Response:
|
||||
```
|
||||
✅ QR backup data updated successfully!
|
||||
✅ QR backup image for `sales` decoded and stored successfully!
|
||||
|
||||
Data: `new_390530c569ec8902a6cbd8482d51d70d2857d4a0`
|
||||
```
|
||||
@@ -173,9 +187,15 @@ Retrieve the stored GroupHelp QR backup data anytime:
|
||||
/admin_get_qr
|
||||
```
|
||||
|
||||
Retrieve a named QR group:
|
||||
|
||||
```
|
||||
/admin_get_qr sales
|
||||
```
|
||||
|
||||
Response:
|
||||
```
|
||||
📊 Current QR Backup Data:
|
||||
📊 Current QR Backup Data for `sales`:
|
||||
`new_390530c569ec8902a6cbd8482d51d70d2857d4a0`
|
||||
```
|
||||
|
||||
@@ -186,6 +206,28 @@ Once you have the QR backup data stored, you can:
|
||||
2. Let GroupFactory render it as a QR image during `!newgrp`
|
||||
3. Let GroupHelp import the backed-up settings from the `.importbackup` image message
|
||||
|
||||
To resync the stored GroupHelp configuration across existing managed groups, run:
|
||||
|
||||
```
|
||||
/admin_sync_qr
|
||||
```
|
||||
|
||||
This sends the `default` stored `.importbackup` QR image only to unassigned owned group dialogs. It skips private chats and channels, and waits 30 seconds between each group.
|
||||
|
||||
Assign Telegram groups to named QR configs:
|
||||
|
||||
```
|
||||
/admin_qr_group_add sales -1001234567890 -1009876543210
|
||||
/admin_qr_groups
|
||||
```
|
||||
|
||||
Sync one named QR group, or all logical groups sequentially:
|
||||
|
||||
```
|
||||
/admin_sync_qr sales
|
||||
/admin_sync_qr all
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Database Structure
|
||||
@@ -318,8 +360,15 @@ FACTORY_BOT_USERNAME=your_bot_username
|
||||
- `/add_default_users <id1> <id2> ...` - Add users to default list
|
||||
- `/remove_default_users <id1> <id2> ...` - Remove users from default list
|
||||
- `/admin_get_qr` - View GroupHelp QR backup data
|
||||
- `/admin_set_qr <qr_payload>` - Set GroupHelp QR backup data directly
|
||||
- `/admin_set_qr` - Decode a forwarded `.importbackup` QR image
|
||||
- `/admin_get_qr <qr_group>` - View GroupHelp QR backup data for a named QR group
|
||||
- `/admin_set_qr <qr_payload>` - Set default GroupHelp QR backup data directly
|
||||
- `/admin_set_qr <qr_group> <qr_payload>` - Set named GroupHelp QR backup data directly
|
||||
- `/admin_set_qr` - Decode a forwarded `.importbackup` QR image for `default`
|
||||
- `/admin_set_qr_group <qr_group>` - Decode a forwarded `.importbackup` QR image for a named QR group
|
||||
- `/admin_qr_groups [qr_group]` - List QR configs and assigned Telegram groups
|
||||
- `/admin_qr_group_add <qr_group> <telegram_group_id> ...` - Assign Telegram groups to a QR config
|
||||
- `/admin_qr_group_remove <telegram_group_id> ...` - Remove Telegram group QR config assignment
|
||||
- `/admin_sync_qr [qr_group|all]` - Send stored `.importbackup` QR to owned assigned groups
|
||||
- `/config_help` - Show configuration command help
|
||||
- `/help` - Show all available commands
|
||||
|
||||
@@ -364,6 +413,12 @@ db.group_config.find()
|
||||
|
||||
# View GroupHelp QR backup
|
||||
db.ghconfig.find({key: 'qr_backup_data'})
|
||||
|
||||
# View all named GroupHelp QR backups
|
||||
db.ghconfig.find({key: /^qr_backup_data/})
|
||||
|
||||
# View QR group assignments
|
||||
db.ghconfig.find({key: 'qr_group_assignments'})
|
||||
```
|
||||
|
||||
---
|
||||
@@ -371,7 +426,7 @@ db.ghconfig.find({key: 'qr_backup_data'})
|
||||
## Operational Notes
|
||||
|
||||
1. QR backup data is a GroupHelp configuration payload, not a Telegram or Telethon session.
|
||||
2. During `!newgrp`, GroupFactory sends `.importbackup` with the stored GroupHelp settings as a QR image.
|
||||
2. During `!newgrp`, GroupFactory sends `.importbackup` with the `default` stored GroupHelp settings as a QR image.
|
||||
3. Limit configuration commands to trusted chats so group settings are changed intentionally.
|
||||
4. Monitor command usage if multiple operators manage the same groups.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user