Skip to content

Commit 1606820

Browse files
authored
Remove online indicator code because it was written by AI (#87)
* Remove AI code * Rephrase
1 parent f8439db commit 1606820

File tree

4 files changed

+9
-111
lines changed

4 files changed

+9
-111
lines changed

src/discord_integration.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def load_token() -> None:
3434

3535
def validate_token() -> bool:
3636
"""
37-
Checks whether the token is valid or not.
37+
Checks for a valid token.
3838
3939
Returns:
4040
bool: True if the token is valid, False otherwise.
@@ -71,7 +71,7 @@ def validate_token() -> bool:
7171

7272
def get_messages(channel_id: int, limit: int = 100) -> dict[int, list]:
7373
"""
74-
Retrives messages from a specified channel.
74+
Retrives messages from the specified channel.
7575
7676
Args:
7777
channel_id (int): A channel ID.
@@ -113,7 +113,7 @@ def get_messages(channel_id: int, limit: int = 100) -> dict[int, list]:
113113

114114
def send_message(msg, channel) -> None:
115115
"""
116-
Sends a message to a given channel.
116+
Sends a message to the specified channel.
117117
118118
Args:
119119
msg (str): The message to send.
@@ -132,10 +132,10 @@ def send_message(msg, channel) -> None:
132132

133133
def get_friends() -> list[DiscordFriend]:
134134
"""
135-
Returns the list of friends of the current user.
135+
Returns the current user's friends.
136136
137137
Returns:
138-
list: The friends of the current user.
138+
list: The current user's friends.
139139
"""
140140

141141
r = requests.get(f"{api_base}/users/@me/relationships", headers=headers)
@@ -148,7 +148,7 @@ def get_channel_from_id(user_id: int) -> DiscordChannel:
148148
Get the DM channel for a user.
149149
150150
Args:
151-
user_id (int): A user ID.
151+
user_id (int): The user's ID.
152152
153153
Returns:
154154
DiscordChannel: The user's DM channel.
@@ -167,7 +167,7 @@ def get_guilds() -> list[DiscordGuild]:
167167
Returns all the guilds (aka servers) the current user is in.
168168
169169
Returns:
170-
list[DiscordGuild]: Guilds the current user is in.
170+
list[DiscordGuild]: The user's guilds.
171171
"""
172172

173173
r = requests.get(f"{api_base}/users/@me/guilds", headers=headers)
@@ -180,7 +180,7 @@ def get_guild_channels(guild_id: int) -> list[DiscordChannel]:
180180
Returns all channels in a guild.
181181
182182
Args:
183-
guild_id (int): The ID of a guild the current user is in.
183+
guild_id (int): The guild's ID.
184184
185185
Returns:
186186
list[DiscordChannel]: The channels in the guild.
@@ -247,7 +247,7 @@ def send_typing(channel: int) -> None:
247247
Sends a typing indicator to a channel.
248248
249249
Args:
250-
channel (int): The discord channel to send the typing indicator to
250+
channel (int): The channel to send the typing indicator
251251
252252
Returns:
253253
None

src/discord_status.py

Lines changed: 0 additions & 94 deletions
This file was deleted.

src/login.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from PySide6.QtWidgets import QMainWindow
22
from ui import login_ui
33
from discord_integration import login, load_token
4-
from discord_status import keep_online
54
import platformdirs
65

76

@@ -53,9 +52,6 @@ def switch(self):
5352
# Load the token
5453
load_token()
5554

56-
# Open a connection to Discord to add the online indicator
57-
keep_online()
58-
5955
# Switch the page to the chat page
6056
self.switcher.setCurrentIndex(self.switcher.currentIndex() + 1)
6157
else:

src/main.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
UpdateMessagesWorker,
2020
)
2121
import discord_integration
22-
import discord_status
2322

2423
# UI imports
2524
from ui.main_ui import Ui_MainWindow
@@ -158,9 +157,6 @@ def _update_text(self, messages: dict) -> None:
158157
)
159158

160159
def setup(self):
161-
if auth:
162-
discord_status.keep_online()
163-
164160
self.connect_signal_slots()
165161

166162
self.ui.lineEdit.setFocus()

0 commit comments

Comments
 (0)