aldığım hata şu

import telegram
from telegram.ext import Updater, MessageHandler, Filters, CommandHandler
bot_token = ' bot tokenim'
message_to_track = {}
def forward_messages(update, context):
chat_id = update.effective_chat.id
quoted_message = update.message.reply_to_message
if quoted_message:
start_time = quoted_message.date
current_time = update.message.date
messages = get_messages_from_chat(update, start_time, current_time)
for message in messages:
print(f"{message.from_user.first_name}: {message.text}")
message_key = f"{start_time}-{quoted_message.text}"
message_to_track[message_key] = []
def get_messages_from_chat(update, from_time, to_time):
messages = update.effective_chat.get_updates()
relevant_messages = []
should_collect = False
for message in messages:
if should_collect:
relevant_messages.append(message)
if message.message.date == from_time:
should_collect = True
if message.message.date == to_time:
should_collect = False
break
return relevant_messages
def add_messages(update, context):
chat_id = update.effective_chat.id
latest_update = get_latest_update(update)
if latest_update:
start_time = latest_update.message.date
quoted_message_text = latest_update.message.text
message_key = f"{start_time}-{quoted_message_text}"
if message_key in message_to_track:
messages = message_to_track[message_key]
for message in messages:
print(f"{message.from_user.first_name}: {message.text}")
def get_latest_update(update):
return update.message.reply_to_message
def main():
updater = Updater(token=bot_token, use_context=True)
dp = updater.dispatcher
dp.add_handler(MessageHandler(Filters.reply, forward_messages))
dp.add_handler(CommandHandler('ekle', add_messages))
updater.start_polling()
updater.idle()
if __name__ == '__main__':
main()

