Spaces:
Running
Running
UPDATE
Browse files
app.py
CHANGED
@@ -140,9 +140,10 @@ client = TelegramClient('session_name', API_ID, API_HASH)
|
|
140 |
async def start_handler(event):
|
141 |
await event.respond("Welcome to the bot!")
|
142 |
|
143 |
-
@client.on(events.NewMessage(pattern='/
|
144 |
async def broadcast_handler(event):
|
145 |
-
|
|
|
146 |
await event.respond(message_to_broadcast)
|
147 |
|
148 |
|
@@ -152,10 +153,6 @@ async def initiation():
|
|
152 |
if __name__ == '__main__':
|
153 |
client.start(bot_token=BOT_TOKEN)
|
154 |
client.loop.run_until_complete(initiation())
|
155 |
-
thread_one = threading.Thread(target=client.run_until_disconnected)
|
156 |
-
thread_two = threading.Thread(target=iface.launch, kwargs={"share": False})
|
157 |
-
|
158 |
-
# Start the threads
|
159 |
-
thread_one.start()
|
160 |
print("Bot started succefully")
|
161 |
-
|
|
|
|
140 |
async def start_handler(event):
|
141 |
await event.respond("Welcome to the bot!")
|
142 |
|
143 |
+
@client.on(events.NewMessage(pattern='/rungradio'))
|
144 |
async def broadcast_handler(event):
|
145 |
+
threading.Thread(target=iface.launch).start() #(share=False)
|
146 |
+
message_to_broadcast = "Gradio running..."
|
147 |
await event.respond(message_to_broadcast)
|
148 |
|
149 |
|
|
|
153 |
if __name__ == '__main__':
|
154 |
client.start(bot_token=BOT_TOKEN)
|
155 |
client.loop.run_until_complete(initiation())
|
|
|
|
|
|
|
|
|
|
|
156 |
print("Bot started succefully")
|
157 |
+
client.run_until_disconnected()
|
158 |
+
|