MessageBLocker: A middleware for EFB
Notice
Middleware ID: catbaron.message_blocker
MessageBLocker is a middleware for EFB, to manage filters and block some specific messages.
Note: I rewrite most parts of this middleware in the last update. Please read the usage section to check the change. Because the structer of database is changed, you may need to delete the database file in order to make it work (usually it's at ~/.ehforwarderbot/profiles/default/catbaron.msg_blocker/ftdata.db).
Note: If you are looking for a way to block all messages from so called Official Accounts(公众号), this plugin is not what you need. Here are some advices:
- Don't subscribe any official accounts. They don't worth it.
- Link all official accounts to one chat, and block the chat. Refer to wiki of EWS.
Dependense
- Python >= 3.6
- EFB >= 2.0.0b28
- ETM >= 2.0.0b45.dev1 (if you are using it)
- EWS >= 2.0.0a41.dev2 (if you are using it)
- peewee
- PyYaml
Install
-
Install
pip install efb-msg_blocker-middleware -
Register to EFB Following this document to edit the config file. The config file by default is
~/.ehforwarderbot/profiles/default. It should look like:master_channel: foo.demo_master slave_channels: - foo.demo_slave - bar.dummy middlewares: - foo.other_middlewares - catbaron.msg_blockerUsually you just need to add the last line to your config file.
-
Restart EFB.
Usage
Three commands are supported by this middleware, namely list, add and del. To avoid conflict to other channels' command, all the commands MUST follow \msg_blocer and a space, as shown below.
\msg_blocker list: List all the filters you have added to one chat. You can reply this command to a message, then only filters applied to the author of the target message will be listed. You will seeid,chat_name,user_nameandmsg_typefor each filter.idis the unique ID for this filter. You need it to delete a filterchat_nameshould be the name of current chat where you send the command.user_nameis the user whose message will be filteredmsg_typeis type of messages to filter out.
\msg_blocker del {id}: Delete a filter with filterid.\msg_blocker add {msg_type}: Add filters. There are some ways to add filters.msg_typeis one of anytypesupported by EFB (includingUnsupportedtype), so that all the messages in the specific type will be blocked. Check all of the supported types here. For example\msg_blocker add imageadds a filter to block all the image messages.- You cloud reply
\msg_blocker add imageto a message. MessageBLocker will get the author of the replied message, and only block image message from the author. - If you reply to a message with
\msg_blocker add, without themsg_typeargument, all the message from the author will be blocked.
Metadata
Release files for efb-msg-blocker-middleware 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| efb-msg_blocker-middleware-1.1.0.tar.gz | 5.8 kB | Without provenance | Details for efb-msg_blocker-middleware-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| efb_msg_blocker_middleware-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for efb_msg_blocker_middleware-1.1.0-py3-none-any.whl |
Total release size: 12.6 kB
Release files / efb-msg_blocker-middleware-1.1.0.tar.gz
| Download URL | efb-msg_blocker-middleware-1.1.0.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00d1b231b0d10286b8fb19ed9a30832781de5d6a518cc2ba4fecdc964f27e1a0
|
|
BLAKE2b-256 checksum How to use checksums |
9ae1cbd65a26a3805d7c6767bef3237169d9290f2c9d59c70f0924891002525c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/51.1.1 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.6.9
|
Release files / efb_msg_blocker_middleware-1.1.0-py3-none-any.whl
| Download URL | efb_msg_blocker_middleware-1.1.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bcac61af37165494a1f42099517be43a4e84f03bafd3b075a661d35d49f43a7f
|
|
BLAKE2b-256 checksum How to use checksums |
d2d2fe620d4a18743783ca0497265976c973a9fb6fca94edf300ea7765dc579f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/51.1.1 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.6.9
|
Security for efb-msg-blocker-middleware 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.