ksssomesh12 / tgmb-beta

Predecessor to `tgmb`
MIT License
15 stars 16 forks source link

Bot replying to every command used in group. #12

Closed oneironaut2209 closed 3 years ago

oneironaut2209 commented 3 years ago

On using any command other than bots's specific command it will reply with this :

screen

Here are some logs : 2021-08-18T06:33:41.518728+00:00 app[worker.1]: 2021-08-18 12:03:41.518 | DEBUG | telegram.ext.utils.webhookhandler:post:172 - Webhook triggered 2021-08-18T06:33:41.519013+00:00 app[worker.1]: 2021-08-18 12:03:41.518 | DEBUG | telegram.ext.utils.webhookhandler:post:177 - Webhook received data: {"update_id":572062085, 2021-08-18T06:33:41.519015+00:00 app[worker.1]: "message":{"message_id":82253,"from":{"id":1091602920,"is_bot":false,"first_name":"Chaitanya","username":"oneironaut2209","language_code":"en"},"chat":{"id":-1001372805029,"title":"Black Listed Bois","type":"supergroup"},"date":1629268421,"text":"/anyotherbotcommand","entities":[{"offset":0,"length":19,"type":"bot_command"}]}} 2021-08-18T06:33:41.519325+00:00 app[worker.1]: 2021-08-18 12:03:41.519 | DEBUG | telegram.ext.utils.webhookhandler:post:180 - Received Update with ID 572062085 on Webhook 2021-08-18T06:33:41.519821+00:00 app[worker.1]: 2021-08-18 12:03:41.519 | DEBUG | telegram.ext.dispatcher:start:376 - Processing Update: {'update_id': 572062085, 'message': {'message_id': 82253, 'date': 1629268421, 'chat': {'id': -1001372805029, 'type': 'supergroup', 'title': 'Black Listed Bois'}, 'text': '/anyotherbotcommand', 'entities': [{'type': 'bot_command', 'offset': 0, 'length': 19}], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 1091602920, 'first_name': 'Chaitanya', 'is_bot': False, 'username': 'oneironaut2209', 'language_code': 'en'}}} 2021-08-18T06:33:41.520252+00:00 app[worker.1]: 2021-08-18 12:03:41.520 | DEBUG | telegram.ext.conversationhandler:check_update:534 - selecting conversation (-1001372805029, 1091602920) with state None 2021-08-18T06:33:41.520613+00:00 app[worker.1]: 2021-08-18 12:03:41.520 | DEBUG | telegram.ext.conversationhandler:check_update:534 - selecting conversation (-1001372805029, 1091602920) with state None 2021-08-18T06:33:41.521051+00:00 app[worker.1]: 2021-08-18 12:03:41.520 | DEBUG | telegram.bot:decorator:126 - Entering: send_message 2021-08-18T06:33:41.818702+00:00 app[worker.1]: 2021-08-18 12:03:41.818 | DEBUG | telegram.bot:decorator:128 - {'message_id': 82254, 'date': 1629268421, 'chat': {'id': -1001372805029, 'type': 'supergroup', 'title': 'Black Listed Bois'}, 'reply_to_message': {'message_id': 82253, 'date': 1629268421, 'chat': {'id': -1001372805029, 'type': 'supergroup', 'title': 'Black Listed Bois'}, 'text': '/anyotherbotcommand', 'entities': [{'type': 'bot_command', 'offset': 0, 'length': 19}], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 1091602920, 'first_name': 'Chaitanya', 'is_bot': False, 'username': 'oneironaut2209', 'language_code': 'en'}}, 'text': 'Sorry, the command is not registered with a CommandHandler !', 'entities': [], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 1737922429, 'first_name': 'Morningstar bot', 'is_bot': True, 'username': 'heroku69bot'}} 2021-08-18T06:33:41.818938+00:00 app[worker.1]: 2021-08-18 12:03:41.818 | DEBUG | telegram.bot:decorator:129 - Exiting: send_message 2021-08-18T06:44:33.405219+00:00 app[worker.1]: 2021-08-18 12:14:33.405 | DEBUG | telegram.ext.utils.webhookhandler:post:172 - Webhook triggered 2021-08-18T06:44:33.405403+00:00 app[worker.1]: 2021-08-18 12:14:33.405 | DEBUG | telegram.ext.utils.webhookhandler:post:177 - Webhook received data: {"update_id":572062086, 2021-08-18T06:44:33.405404+00:00 app[worker.1]: "message":{"message_id":82255,"from":{"id":1091602920,"is_bot":false,"first_name":"Chaitanya","username":"oneironaut2209","language_code":"en"},"chat":{"id":-1001372805029,"title":"Black Listed Bois","type":"supergroup"},"date":1629269073,"text":"/anyotherbotcommand","entities":[{"offset":0,"length":19,"type":"bot_command"}]}} 2021-08-18T06:44:33.405708+00:00 app[worker.1]: 2021-08-18 12:14:33.405 | DEBUG | telegram.ext.utils.webhookhandler:post:180 - Received Update with ID 572062086 on Webhook 2021-08-18T06:44:33.406230+00:00 app[worker.1]: 2021-08-18 12:14:33.406 | DEBUG | telegram.ext.dispatcher:start:376 - Processing Update: {'update_id': 572062086, 'message': {'message_id': 82255, 'date': 1629269073, 'chat': {'id': -1001372805029, 'type': 'supergroup', 'title': 'Black Listed Bois'}, 'text': '/anyotherbotcommand', 'entities': [{'type': 'bot_command', 'offset': 0, 'length': 19}], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 1091602920, 'first_name': 'Chaitanya', 'is_bot': False, 'username': 'oneironaut2209', 'language_code': 'en'}}} 2021-08-18T06:44:33.406637+00:00 app[worker.1]: 2021-08-18 12:14:33.406 | DEBUG | telegram.ext.conversationhandler:check_update:534 - selecting conversation (-1001372805029, 1091602920) with state None 2021-08-18T06:44:33.406989+00:00 app[worker.1]: 2021-08-18 12:14:33.406 | DEBUG | telegram.ext.conversationhandler:check_update:534 - selecting conversation (-1001372805029, 1091602920) with state None 2021-08-18T06:44:33.407492+00:00 app[worker.1]: 2021-08-18 12:14:33.407 | DEBUG | telegram.bot:decorator:126 - Entering: send_message 2021-08-18T06:44:33.752672+00:00 app[worker.1]: 2021-08-18 12:14:33.752 | DEBUG | telegram.bot:decorator:128 - {'message_id': 82256, 'date': 1629269073, 'chat': {'id': -1001372805029, 'type': 'supergroup', 'title': 'Black Listed Bois'}, 'reply_to_message': {'message_id': 82255, 'date': 1629269073, 'chat': {'id': -1001372805029, 'type': 'supergroup', 'title': 'Black Listed Bois'}, 'text': '/anyotherbotcommand', 'entities': [{'type': 'bot_command', 'offset': 0, 'length': 19}], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 1091602920, 'first_name': 'Chaitanya', 'is_bot': False, 'username': 'oneironaut2209', 'language_code': 'en'}}, 'text': 'Sorry, the command is not registered with a CommandHandler !', 'entities': [], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 1737922429, 'first_name': 'Morningstar bot', 'is_bot': True, 'username': 'heroku69bot'}} 2021-08-18T06:44:33.752865+00:00 app[worker.1]: 2021-08-18 12:14:33.752 | DEBUG | telegram.bot:decorator:129 - Exiting: send_message

ksssomesh12 commented 3 years ago

On using any command other than bots's specific command it will reply with this :

screen

Here are some logs : 2021-08-18T06:33:41.518728+00:00 app[worker.1]: 2021-08-18 12:03:41.518 | DEBUG | telegram.ext.utils.webhookhandler:post:172 - Webhook triggered 2021-08-18T06:33:41.519013+00:00 app[worker.1]: 2021-08-18 12:03:41.518 | DEBUG | telegram.ext.utils.webhookhandler:post:177 - Webhook received data: {"update_id":572062085, 2021-08-18T06:33:41.519015+00:00 app[worker.1]: "message":{"message_id":82253,"from":{"id":1091602920,"is_bot":false,"first_name":"Chaitanya","username":"oneironaut2209","language_code":"en"},"chat":{"id":-1001372805029,"title":"Black Listed Bois","type":"supergroup"},"date":1629268421,"text":"/anyotherbotcommand","entities":[{"offset":0,"length":19,"type":"bot_command"}]}} 2021-08-18T06:33:41.519325+00:00 app[worker.1]: 2021-08-18 12:03:41.519 | DEBUG | telegram.ext.utils.webhookhandler:post:180 - Received Update with ID 572062085 on Webhook 2021-08-18T06:33:41.519821+00:00 app[worker.1]: 2021-08-18 12:03:41.519 | DEBUG | telegram.ext.dispatcher:start:376 - Processing Update: {'update_id': 572062085, 'message': {'message_id': 82253, 'date': 1629268421, 'chat': {'id': -1001372805029, 'type': 'supergroup', 'title': 'Black Listed Bois'}, 'text': '/anyotherbotcommand', 'entities': [{'type': 'bot_command', 'offset': 0, 'length': 19}], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 1091602920, 'first_name': 'Chaitanya', 'is_bot': False, 'username': 'oneironaut2209', 'language_code': 'en'}}} 2021-08-18T06:33:41.520252+00:00 app[worker.1]: 2021-08-18 12:03:41.520 | DEBUG | telegram.ext.conversationhandler:check_update:534 - selecting conversation (-1001372805029, 1091602920) with state None 2021-08-18T06:33:41.520613+00:00 app[worker.1]: 2021-08-18 12:03:41.520 | DEBUG | telegram.ext.conversationhandler:check_update:534 - selecting conversation (-1001372805029, 1091602920) with state None 2021-08-18T06:33:41.521051+00:00 app[worker.1]: 2021-08-18 12:03:41.520 | DEBUG | telegram.bot:decorator:126 - Entering: send_message 2021-08-18T06:33:41.818702+00:00 app[worker.1]: 2021-08-18 12:03:41.818 | DEBUG | telegram.bot:decorator:128 - {'message_id': 82254, 'date': 1629268421, 'chat': {'id': -1001372805029, 'type': 'supergroup', 'title': 'Black Listed Bois'}, 'reply_to_message': {'message_id': 82253, 'date': 1629268421, 'chat': {'id': -1001372805029, 'type': 'supergroup', 'title': 'Black Listed Bois'}, 'text': '/anyotherbotcommand', 'entities': [{'type': 'bot_command', 'offset': 0, 'length': 19}], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 1091602920, 'first_name': 'Chaitanya', 'is_bot': False, 'username': 'oneironaut2209', 'language_code': 'en'}}, 'text': 'Sorry, the command is not registered with a CommandHandler !', 'entities': [], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 1737922429, 'first_name': 'Morningstar bot', 'is_bot': True, 'username': 'heroku69bot'}} 2021-08-18T06:33:41.818938+00:00 app[worker.1]: 2021-08-18 12:03:41.818 | DEBUG | telegram.bot:decorator:129 - Exiting: send_message 2021-08-18T06:44:33.405219+00:00 app[worker.1]: 2021-08-18 12:14:33.405 | DEBUG | telegram.ext.utils.webhookhandler:post:172 - Webhook triggered 2021-08-18T06:44:33.405403+00:00 app[worker.1]: 2021-08-18 12:14:33.405 | DEBUG | telegram.ext.utils.webhookhandler:post:177 - Webhook received data: {"update_id":572062086, 2021-08-18T06:44:33.405404+00:00 app[worker.1]: "message":{"message_id":82255,"from":{"id":1091602920,"is_bot":false,"first_name":"Chaitanya","username":"oneironaut2209","language_code":"en"},"chat":{"id":-1001372805029,"title":"Black Listed Bois","type":"supergroup"},"date":1629269073,"text":"/anyotherbotcommand","entities":[{"offset":0,"length":19,"type":"bot_command"}]}} 2021-08-18T06:44:33.405708+00:00 app[worker.1]: 2021-08-18 12:14:33.405 | DEBUG | telegram.ext.utils.webhookhandler:post:180 - Received Update with ID 572062086 on Webhook 2021-08-18T06:44:33.406230+00:00 app[worker.1]: 2021-08-18 12:14:33.406 | DEBUG | telegram.ext.dispatcher:start:376 - Processing Update: {'update_id': 572062086, 'message': {'message_id': 82255, 'date': 1629269073, 'chat': {'id': -1001372805029, 'type': 'supergroup', 'title': 'Black Listed Bois'}, 'text': '/anyotherbotcommand', 'entities': [{'type': 'bot_command', 'offset': 0, 'length': 19}], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 1091602920, 'first_name': 'Chaitanya', 'is_bot': False, 'username': 'oneironaut2209', 'language_code': 'en'}}} 2021-08-18T06:44:33.406637+00:00 app[worker.1]: 2021-08-18 12:14:33.406 | DEBUG | telegram.ext.conversationhandler:check_update:534 - selecting conversation (-1001372805029, 1091602920) with state None 2021-08-18T06:44:33.406989+00:00 app[worker.1]: 2021-08-18 12:14:33.406 | DEBUG | telegram.ext.conversationhandler:check_update:534 - selecting conversation (-1001372805029, 1091602920) with state None 2021-08-18T06:44:33.407492+00:00 app[worker.1]: 2021-08-18 12:14:33.407 | DEBUG | telegram.bot:decorator:126 - Entering: send_message 2021-08-18T06:44:33.752672+00:00 app[worker.1]: 2021-08-18 12:14:33.752 | DEBUG | telegram.bot:decorator:128 - {'message_id': 82256, 'date': 1629269073, 'chat': {'id': -1001372805029, 'type': 'supergroup', 'title': 'Black Listed Bois'}, 'reply_to_message': {'message_id': 82255, 'date': 1629269073, 'chat': {'id': -1001372805029, 'type': 'supergroup', 'title': 'Black Listed Bois'}, 'text': '/anyotherbotcommand', 'entities': [{'type': 'bot_command', 'offset': 0, 'length': 19}], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 1091602920, 'first_name': 'Chaitanya', 'is_bot': False, 'username': 'oneironaut2209', 'language_code': 'en'}}, 'text': 'Sorry, the command is not registered with a CommandHandler !', 'entities': [], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 1737922429, 'first_name': 'Morningstar bot', 'is_bot': True, 'username': 'heroku69bot'}} 2021-08-18T06:44:33.752865+00:00 app[worker.1]: 2021-08-18 12:14:33.752 | DEBUG | telegram.bot:decorator:129 - Exiting: send_message

That is intentional by the way. I personally had a lot of issues with lzzy12's repo, without this command handler, being unable to know if some command is not registered or the command doesn't return anything on the user end. So, to me, this is very helpful, by the way. What is the real issue here? Does the bot return this message every time u send a command to other bots, when these bots are in the same group? If that's the case, then it can be resolved with a rather easy fix.

oneironaut2209 commented 3 years ago

Does the bot return this message every time u send a command to other bots, when these bots are in the same group? If that's the case, then it can be resolved with a rather easy fix.

Yes that's the case here. I have 3-4 bots in same group. This bot replies everytime I use others bots.

ksssomesh12 commented 3 years ago

Does the bot return this message every time u send a command to other bots, when these bots are in the same group? If that's the case, then it can be resolved with a rather easy fix.

Yes that's the case here. I have 3-4 bots in same group. This bot replies everytime I use others bots.

Generally the message format is like this, '/botcommand@bot_number_one some_text_here' right?

oneironaut2209 commented 3 years ago

Yes

ksssomesh12 commented 3 years ago

Try this commit and let me know if the issue is fixed.

oneironaut2209 commented 3 years ago

On using other bots with ""@botusername" It will not reply but on using command without username it will reply.

Screenshot_20210819-200144~2

ksssomesh12 commented 3 years ago

Well, that can't be fixed because, it is a recommended practice to suffix the bot command with the bot username when you have multiple bots in the same group, even if u don't have the specific command registered with multiple bots. Hope you understand what I am trying to imply.