start new😊
bot.onText(/swearWord/, (msg, [source, match]) => { bot.deleteMessage(msg.chat.id, msg.message_id); }); (Library: yagop/node-telegram-bot-api)
If you don't want to use regex, there's another way: (with array of swearWords) const swearWords = ['swear1', 'swear word2', 'swear3']; bot.on('message', msg => { if (swearWords.some(word => msg.text.includes(word))) { bot.deleteMessage(chatID, msg.message_id); } }); (Library: yagop/node-telegram-bot-api)
Обсуждают сегодня