Update app.py
Browse files
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("
|
| 13 |
|
| 14 |
@app.on_message()
|
| 15 |
async def echo(_, msg):
|
| 16 |
await msg.reply(f"Echo: {msg.text}")
|
| 17 |
|
| 18 |
async def main():
|
| 19 |
-
#
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
await app.start()
|
| 23 |
-
print("Bot
|
| 24 |
await asyncio.Event().wait()
|
| 25 |
|
| 26 |
-
|
| 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())
|
|
|