{"id":19944968,"url":"https://github.com/ehforwarderbot/efb-msg_blocker-middleware","last_synced_at":"2025-03-01T13:42:09.766Z","repository":{"id":77136266,"uuid":"325751948","full_name":"ehForwarderBot/efb-msg_blocker-middleware","owner":"ehForwarderBot","description":null,"archived":false,"fork":false,"pushed_at":"2020-12-31T08:20:53.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-12T05:12:37.073Z","etag":null,"topics":["efb-middleware","eh-forwarder-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ehForwarderBot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-31T08:20:42.000Z","updated_at":"2020-12-31T19:59:44.000Z","dependencies_parsed_at":"2023-03-12T00:08:47.999Z","dependency_job_id":null,"html_url":"https://github.com/ehForwarderBot/efb-msg_blocker-middleware","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehForwarderBot%2Fefb-msg_blocker-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehForwarderBot%2Fefb-msg_blocker-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehForwarderBot%2Fefb-msg_blocker-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehForwarderBot%2Fefb-msg_blocker-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ehForwarderBot","download_url":"https://codeload.github.com/ehForwarderBot/efb-msg_blocker-middleware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241374520,"owners_count":19952544,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["efb-middleware","eh-forwarder-bot"],"created_at":"2024-11-13T00:23:39.377Z","updated_at":"2025-03-01T13:42:09.741Z","avatar_url":"https://github.com/ehForwarderBot.png","language":"Python","readme":"# MessageBLocker: A middleware for EFB \n\n## Notice\n\n**Middleware ID**: `catbaron.message_blocker`\n\n**MessageBLocker** is a middleware for [EFB](https://ehforwarderbot.readthedocs.io), to manage filters and block some specific messages. \n\n**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`). \n\n**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:\n* Don't subscribe any official accounts. They don't worth it.\n* Link all official accounts to one chat, and block the chat. Refer to [wiki of EWS](https://github.com/blueset/efb-wechat-slave/wiki/EWS-\u0026-ETM%EF%BC%9A%E6%89%B9%E9%87%8F%E7%BB%91%E5%AE%9A%EF%BC%88%E5%85%AC%E4%BC%97%E5%8F%B7%E7%AD%89%EF%BC%89).\n\n## Dependense\n\n* Python \u003e= 3.6\n* EFB \u003e= 2.0.0b28\n* ETM \u003e= 2.0.0b45.dev1 (if you are using it)\n* EWS \u003e= 2.0.0a41.dev2 (if you are using it)\n* peewee\n* PyYaml\n\n## Install\n\n* Install\n    ```\n    pip install efb-msg_blocker-middleware\n    ```\n* Register to EFB\nFollowing [this document](https://ehforwarderbot.readthedocs.io/en/latest/getting-started.html) to edit the config file. The config file by default is `~/.ehforwarderbot/profiles/default`. It should look like:\n    ```\n    master_channel: foo.demo_master\n    slave_channels:\n    - foo.demo_slave\n    - bar.dummy\n    middlewares:\n    - foo.other_middlewares\n    - catbaron.msg_blocker\n    ```\n\n    Usually you just need to add the last line to your config file.\n\n* Restart EFB.\n\n## Usage\nThree 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.\n\n* `\\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 see `id`, `chat_name`, `user_name` and `msg_type` for each filter.\n    * `id` is the unique ID for this filter. You need it to delete a filter\n    * `chat_name` should be the name of current chat where you send the command.\n    * `user_name` is the user whose message will be filtered\n    * `msg_type` is type of messages to filter out. \n* `\\msg_blocker del {id}`: Delete a filter with filter `id`.\n* `\\msg_blocker add {msg_type}`: Add filters. There are some ways to add filters.\n    * `msg_type` is one of any `type` supported by **EFB** (including `Unsupported` type), so that all the messages in the specific type will be blocked. Check all of the supported types [here](https://ehforwarderbot.readthedocs.io/en/latest/API/constants.html#ehforwarderbot.constants.MsgType). For example `\\msg_blocker add image` adds a filter to block all the image messages.\n    * You cloud reply `\\msg_blocker add image` to a message. **MessageBLocker** will get the author of the replied message, and only block image message from the author.\n    * If you reply to a message with `\\msg_blocker add`, without the `msg_type` argument, all the message from the author will be blocked.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehforwarderbot%2Fefb-msg_blocker-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fehforwarderbot%2Fefb-msg_blocker-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehforwarderbot%2Fefb-msg_blocker-middleware/lists"}