|
6 | 6 |
|
7 | 7 | import os
|
8 | 8 | import shutil
|
| 9 | +import subprocess |
9 | 10 | import threading
|
10 |
| -# import pickle |
11 | 11 | import time
|
12 |
| -import random |
13 | 12 |
|
14 | 13 | from buttons import *
|
15 | 14 | import aifunctions
|
|
30 | 29 |
|
31 | 30 | # bot
|
32 | 31 | app = Client("my_bot",api_id=api_id, api_hash=api_hash,bot_token=bot_token)
|
33 |
| -os.system("chmod 777 c41lab.py negfix8 tgsconverter") |
34 | 32 | MESGS = {}
|
35 | 33 |
|
36 | 34 |
|
@@ -165,7 +163,8 @@ def follow(message,inputt,new,old,oldmessage):
|
165 | 163 | print("It is LibreOffice option")
|
166 | 164 | file = app.download_media(message)
|
167 | 165 | cmd = helperfunctions.libreofficecommand(file,new)
|
168 |
| - os.system(cmd) |
| 166 | + # os.system(cmd) |
| 167 | + subprocess.run([cmd],env={"HOME": "."},) |
169 | 168 | os.remove(file)
|
170 | 169 |
|
171 | 170 | if os.path.exists(output) and os.path.getsize(output) > 0:
|
@@ -345,13 +344,17 @@ def colorizeimage(message,oldmessage):
|
345 | 344 | file = app.download_media(message)
|
346 | 345 | output = file.split("/")[-1]
|
347 | 346 |
|
348 |
| - aifunctions.deoldify(file,output) |
349 |
| - app.send_document(message.chat.id,document=output, force_document=True,caption="used tool -> **Deoldify**", reply_to_message_id=message.id) |
350 |
| - os.remove(output) |
| 347 | + try: |
| 348 | + aifunctions.deoldify(file,output) |
| 349 | + app.send_document(message.chat.id,document=output, force_document=True,caption="used tool -> **Deoldify**", reply_to_message_id=message.id) |
| 350 | + os.remove(output) |
| 351 | + except: pass |
351 | 352 |
|
352 |
| - aifunctions.colorize_image(output,file) |
353 |
| - app.send_document(message.chat.id,document=output, force_document=True,caption="used tool -> **Local Model**", reply_to_message_id=message.id) |
354 |
| - os.remove(output) |
| 353 | + try: |
| 354 | + aifunctions.colorize_image(output,file) |
| 355 | + app.send_document(message.chat.id,document=output, force_document=True,caption="used tool -> **Local Model**", reply_to_message_id=message.id) |
| 356 | + os.remove(output) |
| 357 | + except: pass |
355 | 358 |
|
356 | 359 | os.remove(file)
|
357 | 360 | app.delete_messages(message.chat.id,message_ids=oldmessage.id)
|
|
0 commit comments