Listen to entities: links, email, phone number
import { IContext, IMessage } from 'degreet-telegram/src/types'
bot.on('message:email', async (ctx: IContext): Promise<any> => {
try {
console.log(ctx.parsed) // { email: 'example@gmail.com', emails: ['example@gmail.com', 'second@gmail.com'] }
} catch (e: any) {
console.error(e)
}
})
You can also use 'message:entity' and pass into 'entity' one of allowed entitiy types instead 'message:email' (bold, bot_command, email, url, phone_number)
Last updated