`your t
from telegram import Bot, Update
from telegram.ext import Updater, CommandHandler, MessageHandler, CallbackContext
# Replace 'YOUR_API_TOKEN' with your bot's API token
TOKEN = '7368233736:AAHPQcZ8WNuBv1BIjBtOH3Ea6zgLfsev3vo'
def start(update: Update, context: CallbackContext) -> None:
update.message.reply_text('Bot is running. Send /check to fetch messages mentioning "Antalya".')
def check(update: Update, context: CallbackContext) -> None:
channel_id = 'biletbulma' # Replace with your channel ID
messages = context.bot.get_updates(chat_id=channel_id, text="Antalya")
if messages:
for message in messages:
update.message.reply_text(message.text)
else:
update.message.reply_text("No messages mentioning 'Antalya' found.")
def main() -> None:
bot = Bot(TOKEN)
updater = Updater(bot=bot)
dispatcher = updater.dispatcher
dispatcher.add_handler(CommandHandler("start", start))
dispatcher.add_handler(CommandHandler("check", check))
updater.start_polling()
updater.idle()
if __name__ == '__main__':
main()
ext`
i am creating a telegram bot, I want this bot to bring me all the messages mentioned as “Antalya” from a telegram channel.
ChatGPT
but this problem have ı dont understand
New contributor
hasnagokmenn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.