Skip to content

[FAQ] handle image, video ... type Messages

Housa Hitomi edited this page Apr 14, 2023 · 2 revisions

register handler in client with :

async def foo(msg: Message):
    print(msg.content)


bot.client.register(MessageTypes.IMG, foo)

this snippet register a handler for image message to the bot

for other types message(AUDIO/VEDIO...), alter the 1st param in register() call to MessageTypes.XXX (refer to the MessageTypes for all supported types)