Using .run instead of .system now
This commit is contained in:
parent
fa8bdc0e1f
commit
19b83c0631
@ -1,7 +1,7 @@
|
||||
#-*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import traceback
|
||||
from subprocess import run
|
||||
from traceback import format_exc
|
||||
from functions import *
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
@ -16,12 +16,12 @@ async def getWaterLeft(cardid, filename, app=None):
|
||||
|
||||
try:
|
||||
|
||||
os.system(f'touch data/pages/{str(filename)}.html')
|
||||
run(["touch", f"data/pages/{str(filename)}.html"])
|
||||
|
||||
if config["use_compiled_page_saver"]:
|
||||
os.system(f'PageSaver/pageSaver "https://bwtaqua.com.ua/card-topup/?id={cardid}" > data/pages/{str(filename)}.html')
|
||||
run(["PageSaver/pageSaver", f"\"https://bwtaqua.com.ua/card-topup/?id={cardid}\"", ">", f"data/pages/{str(filename)}.html"])
|
||||
else:
|
||||
os.system(f'node ./PageSaver/pageSaver.js "https://bwtaqua.com.ua/card-topup/?id={cardid}" > data/pages/{str(filename)}.html')
|
||||
run(["node", "PageSaver/pageSaver.js", f"\"https://bwtaqua.com.ua/card-topup/?id={cardid}\"", ">", f"data/pages/{str(filename)}.html"])
|
||||
|
||||
with open(f'data/pages/{str(filename)}.html') as f:
|
||||
html_file = f.read()
|
||||
@ -38,7 +38,7 @@ async def getWaterLeft(cardid, filename, app=None):
|
||||
appendLog(f"Exception occured: {exp} (user: {str(filename)}, cardid: {cardid})")
|
||||
|
||||
if app != None:
|
||||
await app.send_message(config["owner_id"], f"**Exception occured:**\n • User: `{str(filename)}`\n • Card: [{cardid}]({url})\n • Exception: `{exp}`\n • Traceback: `{traceback.format_exc()}`", disable_web_page_preview=True)
|
||||
await app.send_message(config["owner_id"], f"**Exception occured:**\n • User: `{str(filename)}`\n • Card: [{cardid}]({url})\n • Exception: `{exp}`\n • Traceback: `{format_exc()}`", disable_web_page_preview=True)
|
||||
else:
|
||||
print(f'Exception occured and could not send to user: {exp}')
|
||||
|
||||
|
Reference in New Issue
Block a user