mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-11-07 17:36:00 +00:00
[ci] auto-format
This commit is contained in:
parent
4baa419f8a
commit
7f075d02ec
1 changed files with 103 additions and 122 deletions
|
|
@ -66,7 +66,6 @@ if ANDROID: # !can add ios in future
|
||||||
from websocket import WebSocketConnectionClosedException
|
from websocket import WebSocketConnectionClosedException
|
||||||
import websocket
|
import websocket
|
||||||
|
|
||||||
|
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
|
|
||||||
class PresenceUpdate:
|
class PresenceUpdate:
|
||||||
|
|
@ -222,9 +221,6 @@ if ANDROID: # !can add ios in future
|
||||||
self.ws.close()
|
self.ws.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if not ANDROID:
|
if not ANDROID:
|
||||||
# installing pypresence
|
# installing pypresence
|
||||||
def get_module():
|
def get_module():
|
||||||
|
|
@ -276,7 +272,6 @@ def get_event_loop(force_fresh=False):
|
||||||
file.write(line)
|
file.write(line)
|
||||||
get_module()
|
get_module()
|
||||||
|
|
||||||
|
|
||||||
from pypresence import PipeClosed, DiscordError, DiscordNotFound
|
from pypresence import PipeClosed, DiscordError, DiscordNotFound
|
||||||
from pypresence.utils import get_event_loop
|
from pypresence.utils import get_event_loop
|
||||||
import pypresence
|
import pypresence
|
||||||
|
|
@ -423,7 +418,6 @@ def get_event_loop(force_fresh=False):
|
||||||
# except Exception:
|
# except Exception:
|
||||||
# print_error("failed to update presence", include_exception= True)
|
# print_error("failed to update presence", include_exception= True)
|
||||||
|
|
||||||
|
|
||||||
def _reconnect(self) -> None:
|
def _reconnect(self) -> None:
|
||||||
self.rpc.connect()
|
self.rpc.connect()
|
||||||
self._subscribe_events()
|
self._subscribe_events()
|
||||||
|
|
@ -507,7 +501,8 @@ def get_event_loop(force_fresh=False):
|
||||||
babase.pushcall(
|
babase.pushcall(
|
||||||
babase.Call(
|
babase.Call(
|
||||||
bui.screenmessage,
|
bui.screenmessage,
|
||||||
"Discord: {}{} wants to join!".format(username, discriminator if discriminator != "#0" else ""),
|
"Discord: {}{} wants to join!".format(
|
||||||
|
username, discriminator if discriminator != "#0" else ""),
|
||||||
color=(0.0, 1.0, 0.0),
|
color=(0.0, 1.0, 0.0),
|
||||||
),
|
),
|
||||||
from_other_thread=True,
|
from_other_thread=True,
|
||||||
|
|
@ -535,8 +530,6 @@ class Discordlogin(PopupWindow):
|
||||||
'content-type': "application/json",
|
'content-type': "application/json",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# creates our _root_widget
|
# creates our _root_widget
|
||||||
PopupWindow.__init__(self,
|
PopupWindow.__init__(self,
|
||||||
position=(0.0, 0.0),
|
position=(0.0, 0.0),
|
||||||
|
|
@ -545,7 +538,6 @@ class Discordlogin(PopupWindow):
|
||||||
if _uiscale is babase.UIScale.MEDIUM else 1.0),
|
if _uiscale is babase.UIScale.MEDIUM else 1.0),
|
||||||
bg_color=bg_color)
|
bg_color=bg_color)
|
||||||
|
|
||||||
|
|
||||||
self._cancel_button = bui.buttonwidget(
|
self._cancel_button = bui.buttonwidget(
|
||||||
parent=self.root_widget,
|
parent=self.root_widget,
|
||||||
position=(25, self._height - 40),
|
position=(25, self._height - 40),
|
||||||
|
|
@ -558,16 +550,12 @@ class Discordlogin(PopupWindow):
|
||||||
icon=bui.gettexture('crossOut'),
|
icon=bui.gettexture('crossOut'),
|
||||||
iconscale=1.2)
|
iconscale=1.2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bui.imagewidget(parent=self.root_widget,
|
bui.imagewidget(parent=self.root_widget,
|
||||||
position=(180, self._height - 55),
|
position=(180, self._height - 55),
|
||||||
size=(32 * s, 32 * s),
|
size=(32 * s, 32 * s),
|
||||||
texture=bui.gettexture("discordLogo"),
|
texture=bui.gettexture("discordLogo"),
|
||||||
color=(10 - 0.32, 10 - 0.39, 10 - 0.96))
|
color=(10 - 0.32, 10 - 0.39, 10 - 0.96))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.email_widget = bui.textwidget(parent=self.root_widget,
|
self.email_widget = bui.textwidget(parent=self.root_widget,
|
||||||
text="Email/Phone Number",
|
text="Email/Phone Number",
|
||||||
size=(400, 70),
|
size=(400, 70),
|
||||||
|
|
@ -579,7 +567,6 @@ class Discordlogin(PopupWindow):
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
maxwidth=220)
|
maxwidth=220)
|
||||||
|
|
||||||
|
|
||||||
self.password_widget = bui.textwidget(parent=self.root_widget,
|
self.password_widget = bui.textwidget(parent=self.root_widget,
|
||||||
text="Password",
|
text="Password",
|
||||||
size=(400, 70),
|
size=(400, 70),
|
||||||
|
|
@ -591,7 +578,6 @@ class Discordlogin(PopupWindow):
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
maxwidth=220)
|
maxwidth=220)
|
||||||
|
|
||||||
|
|
||||||
bui.containerwidget(edit=self.root_widget,
|
bui.containerwidget(edit=self.root_widget,
|
||||||
cancel_button=self._cancel_button)
|
cancel_button=self._cancel_button)
|
||||||
|
|
||||||
|
|
@ -617,7 +603,6 @@ class Discordlogin(PopupWindow):
|
||||||
maxwidth=200,
|
maxwidth=200,
|
||||||
color=(1.00, 0.15, 0.15))
|
color=(1.00, 0.15, 0.15))
|
||||||
|
|
||||||
|
|
||||||
self._login_button = bui.buttonwidget(
|
self._login_button = bui.buttonwidget(
|
||||||
parent=self.root_widget,
|
parent=self.root_widget,
|
||||||
position=(120, 65),
|
position=(120, 65),
|
||||||
|
|
@ -640,8 +625,6 @@ class Discordlogin(PopupWindow):
|
||||||
bui.getsound('swish').play()
|
bui.getsound('swish').play()
|
||||||
self._transition_out()
|
self._transition_out()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def backup_2fa_code(self, tickt):
|
def backup_2fa_code(self, tickt):
|
||||||
if babase.do_once():
|
if babase.do_once():
|
||||||
self.email_widget.delete()
|
self.email_widget.delete()
|
||||||
|
|
@ -658,8 +641,6 @@ class Discordlogin(PopupWindow):
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
maxwidth=220)
|
maxwidth=220)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
json_data_2FA = {
|
json_data_2FA = {
|
||||||
"code": bui.textwidget(query=self.backup_2fa_widget),
|
"code": bui.textwidget(query=self.backup_2fa_widget),
|
||||||
"gift_code_sku_id": None,
|
"gift_code_sku_id": None,
|
||||||
|
|
@ -706,8 +687,6 @@ class Discordlogin(PopupWindow):
|
||||||
conn.request("POST", "/api/v9/auth/login", payload, self.headers)
|
conn.request("POST", "/api/v9/auth/login", payload, self.headers)
|
||||||
res = conn.getresponse().read()
|
res = conn.getresponse().read()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
token = json.loads(res)['token'].encode().hex().encode()
|
token = json.loads(res)['token'].encode().hex().encode()
|
||||||
with open(self.path, 'wb') as f:
|
with open(self.path, 'wb') as f:
|
||||||
|
|
@ -719,7 +698,8 @@ class Discordlogin(PopupWindow):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
try:
|
try:
|
||||||
ticket = json.loads(res)['ticket']
|
ticket = json.loads(res)['ticket']
|
||||||
bui.screenmessage("Input your 2FA or Discord Backup code", (0.21, 1.0, 0.20))
|
bui.screenmessage("Input your 2FA or Discord Backup code",
|
||||||
|
(0.21, 1.0, 0.20))
|
||||||
bui.getsound('error').play()
|
bui.getsound('error').play()
|
||||||
self.resp = ticket
|
self.resp = ticket
|
||||||
self.backup_2fa_code(tickt=ticket)
|
self.backup_2fa_code(tickt=ticket)
|
||||||
|
|
@ -736,7 +716,6 @@ class Discordlogin(PopupWindow):
|
||||||
elif self.code == True:
|
elif self.code == True:
|
||||||
self.backup_2fa_code(tickt=self.resp)
|
self.backup_2fa_code(tickt=self.resp)
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.email_widget.delete()
|
self.email_widget.delete()
|
||||||
self.password_widget.delete()
|
self.password_widget.delete()
|
||||||
|
|
@ -748,6 +727,8 @@ class Discordlogin(PopupWindow):
|
||||||
|
|
||||||
|
|
||||||
run_once = False
|
run_once = False
|
||||||
|
|
||||||
|
|
||||||
def get_once_asset():
|
def get_once_asset():
|
||||||
global run_once
|
global run_once
|
||||||
if run_once:
|
if run_once:
|
||||||
|
|
@ -775,6 +756,7 @@ def get_once_asset():
|
||||||
pass
|
pass
|
||||||
run_once = True
|
run_once = True
|
||||||
|
|
||||||
|
|
||||||
def get_class():
|
def get_class():
|
||||||
if ANDROID:
|
if ANDROID:
|
||||||
return PresenceUpdate()
|
return PresenceUpdate()
|
||||||
|
|
@ -999,4 +981,3 @@ class DiscordRP(babase.Plugin):
|
||||||
)
|
)
|
||||||
if ANDROID and Path(f"{getcwd()}/token.txt").exists():
|
if ANDROID and Path(f"{getcwd()}/token.txt").exists():
|
||||||
self.rpc_thread.presence()
|
self.rpc_thread.presence()
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue