Skip to content

Commit

Permalink
Remove online indicator code because it was written by AI (#87)
Browse files Browse the repository at this point in the history
* Remove AI code
* Rephrase
  • Loading branch information
mak448a authored Nov 15, 2024
1 parent f8439db commit 1606820
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 111 deletions.
18 changes: 9 additions & 9 deletions src/discord_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def load_token() -> None:

def validate_token() -> bool:
"""
Checks whether the token is valid or not.
Checks for a valid token.
Returns:
bool: True if the token is valid, False otherwise.
Expand Down Expand Up @@ -71,7 +71,7 @@ def validate_token() -> bool:

def get_messages(channel_id: int, limit: int = 100) -> dict[int, list]:
"""
Retrives messages from a specified channel.
Retrives messages from the specified channel.
Args:
channel_id (int): A channel ID.
Expand Down Expand Up @@ -113,7 +113,7 @@ def get_messages(channel_id: int, limit: int = 100) -> dict[int, list]:

def send_message(msg, channel) -> None:
"""
Sends a message to a given channel.
Sends a message to the specified channel.
Args:
msg (str): The message to send.
Expand All @@ -132,10 +132,10 @@ def send_message(msg, channel) -> None:

def get_friends() -> list[DiscordFriend]:
"""
Returns the list of friends of the current user.
Returns the current user's friends.
Returns:
list: The friends of the current user.
list: The current user's friends.
"""

r = requests.get(f"{api_base}/users/@me/relationships", headers=headers)
Expand All @@ -148,7 +148,7 @@ def get_channel_from_id(user_id: int) -> DiscordChannel:
Get the DM channel for a user.
Args:
user_id (int): A user ID.
user_id (int): The user's ID.
Returns:
DiscordChannel: The user's DM channel.
Expand All @@ -167,7 +167,7 @@ def get_guilds() -> list[DiscordGuild]:
Returns all the guilds (aka servers) the current user is in.
Returns:
list[DiscordGuild]: Guilds the current user is in.
list[DiscordGuild]: The user's guilds.
"""

r = requests.get(f"{api_base}/users/@me/guilds", headers=headers)
Expand All @@ -180,7 +180,7 @@ def get_guild_channels(guild_id: int) -> list[DiscordChannel]:
Returns all channels in a guild.
Args:
guild_id (int): The ID of a guild the current user is in.
guild_id (int): The guild's ID.
Returns:
list[DiscordChannel]: The channels in the guild.
Expand Down Expand Up @@ -247,7 +247,7 @@ def send_typing(channel: int) -> None:
Sends a typing indicator to a channel.
Args:
channel (int): The discord channel to send the typing indicator to
channel (int): The channel to send the typing indicator
Returns:
None
Expand Down
94 changes: 0 additions & 94 deletions src/discord_status.py

This file was deleted.

4 changes: 0 additions & 4 deletions src/login.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from PySide6.QtWidgets import QMainWindow
from ui import login_ui
from discord_integration import login, load_token
from discord_status import keep_online
import platformdirs


Expand Down Expand Up @@ -53,9 +52,6 @@ def switch(self):
# Load the token
load_token()

# Open a connection to Discord to add the online indicator
keep_online()

# Switch the page to the chat page
self.switcher.setCurrentIndex(self.switcher.currentIndex() + 1)
else:
Expand Down
4 changes: 0 additions & 4 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
UpdateMessagesWorker,
)
import discord_integration
import discord_status

# UI imports
from ui.main_ui import Ui_MainWindow
Expand Down Expand Up @@ -158,9 +157,6 @@ def _update_text(self, messages: dict) -> None:
)

def setup(self):
if auth:
discord_status.keep_online()

self.connect_signal_slots()

self.ui.lineEdit.setFocus()
Expand Down

0 comments on commit 1606820

Please sign in to comment.