Skip to content

Commit

Permalink
FINALLY CHANGED TO USING TOKENS!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
samclane committed Feb 11, 2019
1 parent 9b32370 commit 4cc88f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions default.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[LoginInfo]
Username = None
Password = None
Token = None

[Keybinds]
mute = pause
7 changes: 3 additions & 4 deletions main.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class DiscordListener:
if not os.path.isfile("config.ini"):
copyfile("default.ini", "config.ini")
self.config.read("config.ini")
self.username = self.config['LoginInfo']['Username']
self.password = self.config['LoginInfo']['Password']
self.token = self.config['LoginInfo']['Token']

self.port = self.get_arduino_port()
self.ser = serial.Serial(self.port, timeout=0)
Expand Down Expand Up @@ -98,10 +97,10 @@ class DiscordListener:
self.sched.enter(REFRESH_RATE, 1, self.update_status)

def attempt_login(self):
logging.info("Attempting to log in as {}".format(self.username))
logging.info("Attempting to log in with token {}".format(self.token))
if self.threads.get("client_thread"):
self.client.logout()
client_thread = threading.Thread(target=self.client.run, args=(self.username, self.password), daemon=True)
client_thread = threading.Thread(target=self.client.run, args=(self.token,), kwargs={"bot": False}, daemon=True)
client_thread.start()
self.threads["client_thread"] = client_thread
logging.info("Login successful!")
Expand Down

0 comments on commit 4cc88f3

Please sign in to comment.