WIP: Included Blacklist option#252
WIP: Included Blacklist option#252reyasmohammed wants to merge 6 commits intogroup-butler:developfrom
Conversation
|
Awesome! Thanks for your work. Since this is not shipping quality yet as you noted, I will mark this as WIP. |
|
@reyasmohammed looks good so far. I'm just not sure how the bot should behave if a blacklisted link is posted - brutally deleting it is cool but there should be some sort of "punishment" similar to how the antispam handles repeated spam messages (ban/kick/restrict the user). Maybe blacklisted links should be deleted & the user punished only when the antispam is off, but the bot will act as if it was on Eg: I think this would be the most logical solution |
|
I have initially written like that, then I have changed as per requirement from the Group which I had this clone running. I have the code with me, will include once I am back from my trip. |
yangm97
left a comment
There was a problem hiding this comment.
Once merge conflicts and review comments are solved this should be ready to go.
| end | ||
| end | ||
|
|
||
| local function is_blacklisted(chat_id, text) |
There was a problem hiding this comment.
Could've generalized the whitelist function and share some code between the two.
| api.sendReply(msg, 'Done') | ||
| end | ||
|
|
||
| if (blocks[1] == 'bl' or blocks[1] == 'blacklist') and blocks[2] then |
| if (blocks[1] == 'bl' or blocks[1] == 'blacklist') and not blocks[2] then | ||
| local links = db:smembers(('chat:%d:blacklist'):format(msg.chat.id)) | ||
| if not next(links) then | ||
| api.sendReply(msg, i18n("_The blacklist is empty_.\nUse `/bl [links]` to add some links to the blacklist"), true) |
I have manually included changes which I have already done on my own Clone running personally. No translations included. I didnt log the delete action, as I am using the telegram feature of recent actions to identify at present. Also the blacklist is not checked in Antispam, it is direct option for every message.
Share your comments, so that I can improve the code if required.