Fixed a shitty bug that filled the HD of the host machine..
Showing
2 changed files
with
8 additions
and
6 deletions
... | @@ -22,10 +22,6 @@ muted_until = datetime.datetime.now() | ... | @@ -22,10 +22,6 @@ muted_until = datetime.datetime.now() |
22 | 22 | ||
23 | client = discord.Client() | 23 | client = discord.Client() |
24 | 24 | ||
25 | json_data=open(credentials).read() | ||
26 | creds = json.loads(json_data) | ||
27 | client.login(creds['username'], creds['password']) | ||
28 | |||
29 | def leaders(xs, top=20): | 25 | def leaders(xs, top=20): |
30 | counts = defaultdict(int) | 26 | counts = defaultdict(int) |
31 | for x in xs: | 27 | for x in xs: |
... | @@ -615,8 +611,14 @@ def on_ready(): | ... | @@ -615,8 +611,14 @@ def on_ready(): |
615 | print(client.user.id) | 611 | print(client.user.id) |
616 | print('------') | 612 | print('------') |
617 | 613 | ||
618 | while 1: | 614 | retries = 0 |
615 | while retries < 1000: | ||
619 | try: | 616 | try: |
617 | json_data=open(credentials).read() | ||
618 | creds = json.loads(json_data) | ||
619 | client.login(creds['username'], creds['password']) | ||
620 | |||
620 | client.run() | 621 | client.run() |
621 | except: | 622 | except: |
622 | print("Shit I crashed") | 623 | retries += 1 |
624 | print("Shit I crashed: Retry %s" % (retries,)) | ... | ... |
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment