D
D
Dmitry2022-01-11 01:00:12
Python
Dmitry, 2022-01-11 01:00:12

How to remove the inscription, are you subscribed to this channel?

Tell me how to delete the system entry, are you subscribed to this channel?

For a group, the bot has the following:

@dp.message_handler(content_types=['new_chat_members'])
async def on_user_joined(message: types.Message):
    print("JOIN message removed")
    await message.delete()

But for the telegram channel, this does not work, I use the Aiogram library.

I tried to write like this:
@dp.message_handler(content_types=['new_channel_members'])
async def on_user_joined(message: types.Message):
    await bot.delete_message(message.chat.id, message.message_id)
    await can_delete_messages()
    await message.delete()

But it didn’t help, I used 3 removal options at once and registered new_channel_members.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
soremix, 2022-01-11
@SoreMix

This message exists only for the user, so the bot cannot delete it, and it does not have any ID.

M
Mikhail Krostelev, 2022-01-11
@twistfire92

Perhaps you need to play around with the rights of the bot in this channel. For a group, he must be an administrator, maybe there are some roles for the channel too.
Where did you even get new_channel_members from ? From what documentation? There is no such thing in aiogram, it won't work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question