DavideGalilei / markinim

Markinim Telegram bot source code
MIT License
80 stars 16 forks source link

Bot mostly only replies non english spam messages #5

Closed drishal closed 2 years ago

drishal commented 2 years ago

There is a small problem with the bot: once some telegram bots attacked my group, but the problem is markinim most of the times sends only those spam messages/gibberish for example image

Is there any way for the bot to be in english only mode so it does not reply with those old spam messages?

DavideGalilei commented 2 years ago

There is no way to force english only messages, however there are 2 workarounds:

drishal commented 2 years ago

There is no way to force english only messages, however there are 2 workarounds:

* By using the /deletefrom command, which deletes from the database all messages a spammer sent. You can use this command both in reply to someone, or by manually inserting the user id, example: `/deletefrom 123`. Note: this action cannot be undone, and it **doesn't** ask for confirmation

* By deleting all messages from the database, using the /delete command (it asks for a confirmation)

But the problem is, it was atleast 40 bots which attacked the group during that time...and also it reads old deleted messages, atleast is there a way to prevent the bot from reading from deleted messages then?

DavideGalilei commented 2 years ago

it reads old deleted messages

It doesn't actually read old messages, it just stores every message upon receiving it. It is not possible to know whether a message has been deleted, due to Telegram BotAPI limitations (the bot doesn't receive updates when a message gets deleted)

Unfortunately, unless you want to delete all the messages from the bot memory, you must use the /deletefrom one by one. I don't think I can do much about it, since that means that I would have to detect spam or repeated messages, and that's resource expensive :(

drishal commented 2 years ago

Maybe you can instead allow an option for proper english only?

DavideGalilei commented 2 years ago

That would require natural language processing, and I don't plan to add that since it would be restricted to english only. One may argue that the SFW filter is english only as well, but the reason for it is that it's not as resource expensive as NLP, and that it's easy to implement

drishal commented 2 years ago

Anyways ran the delete command on the bot, and now atleast it does not spam the old spam messages...closing the issue for now tho please look into reducing the issue