What full code, and "active session"? just follow the example, and pass the details to TelegramClient(session, api_id, api_hash)
import config import telebot bot = telebot.TeleBot(config.token) @bot.message_handler(content_types=["text"]) def repeat_all_messages(message): bot.send_message(message.chat.id, message.text) if name == 'main': bot.infinity_polling()
read the second code box in the link
thats using telebot though which is an http bot api client
its dont client-bot...
Hide your api_id and hash when sharing code, something like this should work. if it doesn't, show your errors properly from telethon import TelegramClient, events client = TelegramClient('client', api_id, api_hash).start() @client.on(events.NewMessage) async def echo(event): if event.text: await event.respond(event.text) client.run_until_disconnected()
Обсуждают сегодня