Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Commit

Permalink
1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Aethese authored Mar 20, 2021
1 parent dadd72e commit 856d1bd
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@

class log:
def error(text: str):
clear()
print('\n[Error] {}\nPlease report this error on the Switchence GitHub issue page if this error happens consistently'.format(text))
time.sleep(5)
webbrowser.open('https://github.com/Aethese/Switchence/issues/', new=2, autoraise=True)
time.sleep(600)
sys.exit()

def info(text: str):
print('\n[Info] {}\nThis program will now close in 1 minute'.format(text))
clear()
print('[Info] {}\nThis program will now close in 1 minute'.format(text))
time.sleep(60)
sys.exit()

def warning(text: str):
print('\n[WARNING] {}'.format(text))
print('\n[WARNING] {}\n'.format(text))

def clear():
os.system('cls' if os.name =='nt' else 'clear')
clear()

id = '803309090696724554'
version = None
Expand Down Expand Up @@ -44,7 +50,7 @@ def warning(text: str):
configjson = {}
configjson['config'] = [{
"sw-code": "",
"version": "1.1.1",
"version": "1.1.2",
"update-notifier": True,
"fname": False
}]
Expand Down Expand Up @@ -162,8 +168,7 @@ def changeUpdateNotifier():
log.error('Couldn\'t change update-notifier setting | {}'.format(error))
log.info('Update notifier set to FALSE. Rerun the program to use it with the new settings')

def changeFNameSetting(): # might have a feature in the future where you can type in the full names for the app too
log.warning('If you have full game names on, you still have to type in the shortened name for the app to work!')
def changeFNameSetting():
k = input('Your current setting is set to: {}. What do you want to change it to ("full" for full game names, "short" for shortened game names)? '.format(configfname))
if k == 'full' or k == 'f':
try:
Expand Down Expand Up @@ -212,17 +217,15 @@ def changeFNameSetting(): # might have a feature in the future where you can typ
sys.exit()
elif x == 'update notifier' or x == 'update-notifier' or x == 'un' or x == 'u-n':
changeUpdateNotifier()
elif x == 'change-name' or x =='change name' or x == 'c-n' or x == 'c n':
elif x == 'change-name' or x =='change name' or x == 'c-n' or x == 'cn':
changeFNameSetting()

y = input('Do you want to show your friend code "SW-{}" (you can change this by typing "change")? '.format(sw))
y = y.lower()

if y == 'yes' or y == 'y':
if sw == '' or sw == None:
print('Friend code not set. Rerun the program and change your friend code to your friend code')
time.sleep(5)
sys.exit()
log.info('Friend code not set. Rerun the program and change your friend code to your friend code')
elif y == 'change' or y == 'c':
c = input('What is your new friend code (just type the numbers)? ')
b = input('Is "SW-{}" correct? '.format(c))
Expand All @@ -246,27 +249,29 @@ def changeFNameSetting(): # might have a feature in the future where you can typ
try:
for n in games['games']:
z = n['name']
o = n['fname']
if z == x:
chosenOne = z
break
elif o.lower() == x:
chosenOne = o
break
else:
log.info('The game you specified is not in the current game list')
except Exception as error:
log.error('Can\'t find the game ({}) the user specified (1) | {}'.format(x, error))

try:
for i in games['games']:
if i['name'] == chosenOne:
if i['name'] == chosenOne or i['fname'] == chosenOne:
name = i['name']
img = i['img']
fname = i['fname']
if y == 'yes' or y == 'y':
changePresence(True, chosenOne, img, fname)
break
elif y == 'no' or y == 'n':
changePresence(False, chosenOne, img, fname)
changePresence(True, name, img, fname)
break
else:
changePresence(False, chosenOne, img, fname)
changePresence(False, name, img, fname)
break
except Exception as error:
log.error('Can\'t find the game ({}) specified (2) | {}'.format(chosenOne, error))
Expand Down

0 comments on commit 856d1bd

Please sign in to comment.