- Clean up extra reference keeping
- bump minor version
This commit is contained in:
parent
2d67b2527f
commit
d70328d2df
3 changed files with 16 additions and 26 deletions
|
|
@ -39,12 +39,8 @@ class DiscordConnector:
|
||||||
communicates to get voice & text info to display
|
communicates to get voice & text info to display
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, discover, text_settings, voice_settings, text_overlay, voice_overlay):
|
def __init__(self, discover):
|
||||||
self.discover = discover
|
self.discover = discover
|
||||||
self.text_settings = text_settings
|
|
||||||
self.text_overlay = text_overlay
|
|
||||||
self.voice_settings = voice_settings
|
|
||||||
self.voice_overlay = voice_overlay
|
|
||||||
self.websocket = None
|
self.websocket = None
|
||||||
self.access_token = "none"
|
self.access_token = "none"
|
||||||
self.oauth_token = "207646673902501888"
|
self.oauth_token = "207646673902501888"
|
||||||
|
|
@ -246,7 +242,7 @@ class DiscordConnector:
|
||||||
if "lastspoken" not in user and "lastspoken" in olduser:
|
if "lastspoken" not in user and "lastspoken" in olduser:
|
||||||
user["lastspoken"] = olduser["lastspoken"]
|
user["lastspoken"] = olduser["lastspoken"]
|
||||||
if olduser["avatar"] != user["avatar"]:
|
if olduser["avatar"] != user["avatar"]:
|
||||||
self.voice_overlay.delete_avatar(user["id"])
|
self.discover.voice_overlay.delete_avatar(user["id"])
|
||||||
if "lastspoken" not in user: # Still nothing?
|
if "lastspoken" not in user: # Still nothing?
|
||||||
user["lastspoken"] = 0 # EEEEPOOCH EEEEEPOCH! BELIEVE MEEEE
|
user["lastspoken"] = 0 # EEEEPOOCH EEEEEPOCH! BELIEVE MEEEE
|
||||||
if "speaking" not in user:
|
if "speaking" not in user:
|
||||||
|
|
@ -346,14 +342,14 @@ class DiscordConnector:
|
||||||
elif j["cmd"] == "GET_GUILDS":
|
elif j["cmd"] == "GET_GUILDS":
|
||||||
for guild in j["data"]["guilds"]:
|
for guild in j["data"]["guilds"]:
|
||||||
self.guilds[guild["id"]] = guild
|
self.guilds[guild["id"]] = guild
|
||||||
if len(self.voice_settings.guild_ids) == 0 or guild["id"] in self.voice_settings.guild_ids:
|
if len(self.discover.settings.voice_settings.guild_ids) == 0 or guild["id"] in self.discover.settings.voice_settings.guild_ids:
|
||||||
self.req_channels(guild["id"])
|
self.req_channels(guild["id"])
|
||||||
return
|
return
|
||||||
elif j["cmd"] == "GET_GUILD":
|
elif j["cmd"] == "GET_GUILD":
|
||||||
# We currently only get here because of a "CHANNEL_CREATE" event. Stupidly long winded way around
|
# We currently only get here because of a "CHANNEL_CREATE" event. Stupidly long winded way around
|
||||||
if j["data"]:
|
if j["data"]:
|
||||||
guild = j["data"]
|
guild = j["data"]
|
||||||
if len(self.voice_settings.guild_ids) == 0 or guild["id"] in self.voice_settings.guild_ids:
|
if len(self.discover.settings.voice_settings.guild_ids) == 0 or guild["id"] in self.discover.settings.voice_settings.guild_ids:
|
||||||
self.req_channels(guild["id"])
|
self.req_channels(guild["id"])
|
||||||
return
|
return
|
||||||
elif j["cmd"] == "GET_CHANNELS":
|
elif j["cmd"] == "GET_CHANNELS":
|
||||||
|
|
@ -364,8 +360,8 @@ class DiscordConnector:
|
||||||
self.channels[channel["id"]] = channel
|
self.channels[channel["id"]] = channel
|
||||||
if channel["type"] == 2:
|
if channel["type"] == 2:
|
||||||
self.req_channel_details(channel["id"])
|
self.req_channel_details(channel["id"])
|
||||||
if j["nonce"] == self.text_settings.get_guild():
|
if j["nonce"] == self.discover.settings.text_settings.get_guild():
|
||||||
self.text_settings.set_channels(j["data"]["channels"])
|
self.discover.settings.text_settings.set_channels(j["data"]["channels"])
|
||||||
self.check_guilds()
|
self.check_guilds()
|
||||||
return
|
return
|
||||||
elif j["cmd"] == "SUBSCRIBE":
|
elif j["cmd"] == "SUBSCRIBE":
|
||||||
|
|
@ -420,7 +416,7 @@ class DiscordConnector:
|
||||||
Check if all of the guilds contain a channel
|
Check if all of the guilds contain a channel
|
||||||
"""
|
"""
|
||||||
for guild in self.guilds.values():
|
for guild in self.guilds.values():
|
||||||
if len(self.voice_settings.guild_ids) > 0 and guild["id"] in self.voice_settings.guild_ids and "channels" not in guild:
|
if len(self.discover.settings.voice_settings.guild_ids) > 0 and guild["id"] in self.discover.settings.voice_settings.guild_ids and "channels" not in guild:
|
||||||
return
|
return
|
||||||
|
|
||||||
def on_connected(self):
|
def on_connected(self):
|
||||||
|
|
@ -431,7 +427,7 @@ class DiscordConnector:
|
||||||
self.find_user()
|
self.find_user()
|
||||||
if self.current_text:
|
if self.current_text:
|
||||||
self.start_listening_text(self.current_text)
|
self.start_listening_text(self.current_text)
|
||||||
|
|
||||||
def on_error(self, error):
|
def on_error(self, error):
|
||||||
"""
|
"""
|
||||||
Called when an error has occured
|
Called when an error has occured
|
||||||
|
|
@ -704,20 +700,20 @@ class DiscordConnector:
|
||||||
newlist = []
|
newlist = []
|
||||||
for userid in self.in_room:
|
for userid in self.in_room:
|
||||||
newlist.append(self.userlist[userid])
|
newlist.append(self.userlist[userid])
|
||||||
self.voice_overlay.set_user_list(newlist, self.list_altered)
|
self.discover.voice_overlay.set_user_list(newlist, self.list_altered)
|
||||||
self.voice_overlay.set_connection(self.last_connection)
|
self.discover.voice_overlay.set_connection(self.last_connection)
|
||||||
self.list_altered = False
|
self.list_altered = False
|
||||||
# Update text list
|
# Update text list
|
||||||
if self.text_overlay.popup_style:
|
if self.discover.text_overlay.popup_style:
|
||||||
self.text_altered = True
|
self.text_altered = True
|
||||||
if self.text_altered:
|
if self.text_altered:
|
||||||
self.text_overlay.set_text_list(self.text, self.text_altered)
|
self.discover.text_overlay.set_text_list(self.text, self.text_altered)
|
||||||
self.text_altered = False
|
self.text_altered = False
|
||||||
# Update guilds
|
# Update guilds
|
||||||
self.text_settings.set_guilds(self.guilds)
|
self.discover.settings.text_settings.set_guilds(self.guilds)
|
||||||
# Check for changed channel
|
# Check for changed channel
|
||||||
if self.authed:
|
if self.authed:
|
||||||
self.set_text_channel(self.text_settings.get_channel())
|
self.set_text_channel(self.discover.settings.text_settings.get_channel())
|
||||||
|
|
||||||
if len(self.rate_limited_channels) > 0:
|
if len(self.rate_limited_channels) > 0:
|
||||||
guild = self.rate_limited_channels.pop()
|
guild = self.rate_limited_channels.pop()
|
||||||
|
|
|
||||||
|
|
@ -68,13 +68,7 @@ class Discover:
|
||||||
|
|
||||||
self.create_gui()
|
self.create_gui()
|
||||||
|
|
||||||
self.connection = DiscordConnector(
|
self.connection = DiscordConnector( self )
|
||||||
self,
|
|
||||||
self.settings.text_settings,
|
|
||||||
self.settings.voice_settings,
|
|
||||||
self.text_overlay,
|
|
||||||
self.voice_overlay
|
|
||||||
)
|
|
||||||
|
|
||||||
self.settings.text_settings.add_connector(self.connection)
|
self.settings.text_settings.add_connector(self.connection)
|
||||||
self.connection.connect()
|
self.connection.connect()
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -9,7 +9,7 @@ setup(
|
||||||
name='discover-overlay',
|
name='discover-overlay',
|
||||||
author='trigg',
|
author='trigg',
|
||||||
author_email='',
|
author_email='',
|
||||||
version='0.5.3',
|
version='0.5.4',
|
||||||
description='Voice chat overlay',
|
description='Voice chat overlay',
|
||||||
long_description=readme(),
|
long_description=readme(),
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue