Cxops commited on
Commit
f6f2b0b
·
verified ·
1 Parent(s): 8716daf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -9,19 +9,20 @@ app = Client("bot", api_id=API_ID, api_hash=API_HASH, bot_token=BOT_TOKEN)
9
 
10
  @app.on_message(filters.command("start"))
11
  async def start(_, msg):
12
- await msg.reply("Bot works! Send any file to upload.")
13
 
14
  @app.on_message()
15
  async def echo(_, msg):
16
  await msg.reply(f"Echo: {msg.text}")
17
 
18
  async def main():
19
- # Force a fresh session
20
- if os.path.exists("bot.session"):
21
- os.remove("bot.session")
 
 
22
  await app.start()
23
- print("Bot is ready. Send /start.")
24
  await asyncio.Event().wait()
25
 
26
- if __name__ == "__main__":
27
- asyncio.run(main())
 
9
 
10
  @app.on_message(filters.command("start"))
11
  async def start(_, msg):
12
+ await msg.reply("Works! Now /help")
13
 
14
  @app.on_message()
15
  async def echo(_, msg):
16
  await msg.reply(f"Echo: {msg.text}")
17
 
18
  async def main():
19
+ # Delete any old session file
20
+ import pathlib
21
+ for f in pathlib.Path(".").glob("bot.session*"):
22
+ f.unlink()
23
+ print("Deleted old session:", f)
24
  await app.start()
25
+ print("Bot started. Send /start.")
26
  await asyncio.Event().wait()
27
 
28
+ asyncio.run(main())