Skip to content

Commit 3ec1043

Browse files
committed
Merge branch 'main' into ProtectTheSecond
2 parents c49218e + 6abdea5 commit 3ec1043

62 files changed

Lines changed: 2012 additions & 1440 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[flake8]
2-
ignore = DCO010, DCO023, E203, E501, E712, F401, F403, F821, W503
2+
ignore = DCO010, DCO023, DOC503, DOC602, DOC603, E203, E501, E712, F401, F403, F821, W503
33
style = google
44
skip-checking-short-docstrings = False

.pylintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ disable=C0103,
7575
R0914,
7676
R0915,
7777
R0916,
78+
R0917,
7879
W0201,
7980
W0231,
8081
W0406,

Pipfile

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,36 @@ verify_ssl = true
55

66
[packages]
77
aiocron = "==1.8"
8-
bidict = "==0.22.1"
9-
black = "==24.4.2"
8+
bidict = "==0.23.1"
9+
black = "==25.1.0"
1010
dateparser = "1.2.0"
11-
"discord.py" = "==2.4.0"
12-
emoji = "==2.11.1"
11+
"discord.py" = "==2.5.2"
12+
emoji = "==2.14.1"
1313
expiringdict = "==1.2.2"
14-
flake8 = "==7.1.0"
14+
flake8 = "==7.2.0"
1515
flake8-annotations = "==3.1.1"
16-
flake8-bugbear = "==24.4.26"
17-
flake8-docstrings-complete = "==1.3.0"
16+
flake8-bugbear = "==24.12.12"
17+
flake8-docstrings-complete = "==1.4.1"
1818
flake8-modern-annotations = "==1.6.0"
1919
flake8-variables-names = "==0.0.6"
2020
gino = "==1.0.1"
21-
gitpython = "==3.1.43"
22-
hypothesis = "==6.108.3"
23-
ib3 = "==0.2.0"
24-
inflect = "==7.3.1"
25-
irc = "==20.1.0"
26-
isort = "==5.13.2"
21+
gitpython = "==3.1.44"
22+
hypothesis = "==6.131.9"
23+
inflect = "==7.5.0"
24+
irc = "==20.5.0"
25+
isort = "==6.0.1"
2726
munch = "==4.0.0"
2827
typing_extensions = "==4.8.0"
29-
pip = "==24.1.1"
30-
pipenv = "==2024.0.1"
31-
pydantic = "==2.7.0"
32-
pydoclint = "==0.4.1"
33-
pylint = "==3.1.0"
28+
pip = "==25.1"
29+
pipenv = "==2025.0.1"
30+
pydantic = "==2.9.2"
31+
pydoclint = "==0.6.6"
32+
pylint = "==3.3.6"
3433
pynacl = "==1.5.0"
35-
pytest = "==8.2.2"
36-
pytest-asyncio = "==0.23.7"
34+
pytest = "==8.3.5"
35+
pytest-asyncio = "==0.26.0"
3736
pyyaml = "==6.0.1"
38-
unidecode = "==1.3.8"
37+
unidecode = "==1.4.0"
3938

4039
[requires]
4140
python_version = "3.11"

Pipfile.lock

Lines changed: 1039 additions & 827 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

techsupport_bot/bot.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class TechSupportBot(commands.Bot):
3939
allowed_mentions (discord.AllowedMentions): What the bot is, or is not,
4040
allowed to mention
4141
42-
Attrs:
42+
Attributes:
4343
CONFIG_PATH (str): The hard coded path to the yaml config file
4444
EXTENSIONS_DIR_NAME (str): The hardcoded folder for commands
4545
EXTENSIONS_DIR (str): The list of all files in the EXTENSIONS_DIR_NAME folder
@@ -918,7 +918,7 @@ async def interaction_check(self: Self, interaction: discord.Interaction) -> boo
918918
await self.slash_command_log(interaction)
919919

920920
await self.logger.send_log(
921-
message="Checking if prefix command can run",
921+
message="Checking if slash command can run",
922922
level=LogLevel.DEBUG,
923923
context=LogContext(guild=interaction.guild, channel=interaction.channel),
924924
console_only=True,
@@ -1045,22 +1045,30 @@ async def can_run(
10451045
# IRC Stuff
10461046

10471047
async def start_irc(self: Self) -> None:
1048-
"""Starts the IRC connection in a seperate thread"""
1049-
irc_config = self.file_config.api.irc
1048+
"""Starts the IRC bot in a separate thread."""
10501049
main_loop = asyncio.get_running_loop()
1050+
irc_config = self.file_config.api.irc
10511051

1052-
irc_bot = ircrelay.IRCBot(
1052+
# Create the bot instance
1053+
irc_bot = ircrelay.relay.IRCBot(
10531054
loop=main_loop,
10541055
server=irc_config.server,
10551056
port=irc_config.port,
10561057
channels=irc_config.channels,
10571058
username=irc_config.name,
10581059
password=irc_config.password,
10591060
)
1061+
10601062
self.irc = irc_bot
10611063

1062-
irc_thread = threading.Thread(target=irc_bot.start)
1064+
def run_in_thread() -> None:
1065+
"""Run the IRC bot in a separate thread."""
1066+
irc_bot.start_bot()
1067+
1068+
# Start the bot in a new thread
10631069
await self.logger.send_log(
1064-
message="Logging in to IRC", level=LogLevel.INFO, console_only=True
1070+
message="Logging into IRC", level=LogLevel.INFO, console_only=True
10651071
)
1066-
irc_thread.start()
1072+
1073+
bot_thread = threading.Thread(target=run_in_thread)
1074+
bot_thread.start()

techsupport_bot/botlogging/common.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ class LogLevel(Enum):
1212
"""This is a way to map log levels to strings, and have the easy ability
1313
to dynamically add or remove log levels
1414
15-
Attrs:
15+
Attributes:
1616
DEBUG (str): Representation of debug
1717
INFO (str): Representation of info
1818
WARNING (str): Representation of warning
1919
ERROR (str): Representation of error
2020
"""
2121

22-
DEBUG = "debug"
23-
INFO = "info"
24-
WARNING = "warning"
25-
ERROR = "error"
22+
DEBUG: str = "debug"
23+
INFO: str = "info"
24+
WARNING: str = "warning"
25+
ERROR: str = "error"
2626

2727

2828
@dataclass
2929
class LogContext:
3030
"""A very simple class to store a few contextual items about the log
3131
This is used to determine if some guild settings means the log shouldn't be logged
3232
33-
Attrs:
33+
Attributes:
3434
guild (discord.Guild | None): The guild the log occured with. Optional
35-
channel (discord.abc.Messageble | None): The channel, DM, thread,
35+
channel (discord.abc.Messageable | None): The channel, DM, thread,
3636
or other messagable the log occured in
3737
"""
3838

techsupport_bot/botlogging/embed.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ class LogEmbed(discord.Embed):
1515
Args:
1616
message (str): The message to log. Will become the description of an embed
1717
18-
Attrs:
18+
Attributes:
1919
title (str): The title of the embed
2020
color (discord.Color): The color of the embed
2121
"""
2222

23-
title = None
24-
color = None
23+
title: str = None
24+
color: discord.Color = None
2525

2626
def __init__(self: Self, message: str) -> None:
2727
super().__init__(
@@ -49,46 +49,46 @@ def modify_embed(self: Self, embed: discord.Embed) -> discord.Embed:
4949
class InfoEmbed(LogEmbed):
5050
"""Embed for info level log events.
5151
52-
Attrs:
52+
Attributes:
5353
title (str): The title of the embed
5454
color (discord.Color): The color of the embed
5555
"""
5656

57-
title = "info"
58-
color = discord.Color.green()
57+
title: str = "info"
58+
color: discord.Color = discord.Color.green()
5959

6060

6161
class DebugEmbed(LogEmbed):
6262
"""Embed for debug level log events.
6363
64-
Attrs:
64+
Attributes:
6565
title (str): The title of the embed
6666
color (discord.Color): The color of the embed
6767
"""
6868

69-
title = "debug"
70-
color = discord.Color.dark_green()
69+
title: str = "debug"
70+
color: discord.Color = discord.Color.dark_green()
7171

7272

7373
class WarningEmbed(LogEmbed):
7474
"""Embed for warning level log events.
7575
76-
Attrs:
76+
Attributes:
7777
title (str): The title of the embed
7878
color (discord.Color): The color of the embed
7979
"""
8080

81-
title = "warning"
82-
color = discord.Color.gold()
81+
title: str = "warning"
82+
color: discord.Color = discord.Color.gold()
8383

8484

8585
class ErrorEmbed(LogEmbed):
8686
"""Embed for error level log events.
8787
88-
Attrs:
88+
Attributes:
8989
title (str): The title of the embed
9090
color (discord.Color): The color of the embed
9191
"""
9292

93-
title = "error"
94-
color = discord.Color.red()
93+
title: str = "error"
94+
color: discord.Color = discord.Color.red()

techsupport_bot/commands/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818
from .mock import *
1919
from .moderator import *
2020
from .modlog import *
21+
from .relay import *
2122
from .roll import *
2223
from .wyr import *

techsupport_bot/commands/animal.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ async def setup(bot: bot.TechSupportBot) -> None:
2424
class Animals(cogs.BaseCog):
2525
"""The class for the animals commands
2626
27-
Attrs:
27+
Attributes:
2828
CAT_API_URL (str): The URL for the cat API
2929
DOG_API_URL (str): The URL for the dog API
3030
FOX_API_URL (str): The URL for the fox API
3131
FROG_API_URL (str): The URL for the frog API
3232
"""
3333

34-
CAT_API_URL = "https://api.thecatapi.com/v1/images/search?limit=1&api_key={}"
35-
DOG_API_URL = "https://dog.ceo/api/breeds/image/random"
36-
FOX_API_URL = "https://randomfox.ca/floof/"
37-
FROG_API_URL = "https://frogs.media/api/random"
34+
CAT_API_URL: str = "https://api.thecatapi.com/v1/images/search?limit=1&api_key={}"
35+
DOG_API_URL: str = "https://dog.ceo/api/breeds/image/random"
36+
FOX_API_URL: str = "https://randomfox.ca/floof/"
37+
FROG_API_URL: str = "https://frogs.media/api/random"
3838

3939
@auxiliary.with_typing
4040
@commands.command(name="cat", brief="Gets a cat", description="Gets a cat")

techsupport_bot/commands/application.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ class ApplicationStatus(Enum):
2020
"""Static string mapping of all status
2121
This is so the database can always be consistent
2222
23-
Attrs:
23+
Attributes:
2424
PENDING (str): The string representation for pending
2525
APPROVED (str): The string representation for approved
2626
DENIED (str): The string representation for denied
2727
REJECTED (str): The string representation for rejected
2828
"""
2929

30-
PENDING = "pending"
31-
APPROVED = "approved"
32-
DENIED = "denied"
33-
REJECTED = "rejected"
30+
PENDING: str = "pending"
31+
APPROVED: str = "approved"
32+
DENIED: str = "denied"
33+
REJECTED: str = "rejected"
3434

3535

3636
async def setup(bot: bot.TechSupportBot) -> None:
@@ -198,11 +198,11 @@ async def wait(self: Self, config: munch.Munch, guild: discord.Guild) -> None:
198198
class ApplicationManager(cogs.LoopCog):
199199
"""This cog is responsible for the majority of functions in the application system
200200
201-
Attrs:
201+
Attributes:
202202
application_group (app_commands.Group): The group for the /application commands
203203
"""
204204

205-
application_group = app_commands.Group(
205+
application_group: app_commands.Group = app_commands.Group(
206206
name="application", description="...", extras={"module": "application"}
207207
)
208208

@@ -557,7 +557,7 @@ async def start_application(self: Self, interaction: discord.Interaction) -> Non
557557
)
558558

559559
await interaction.followup.send(
560-
f"Your application has been recieved, {interaction.user.display_name}!",
560+
f"Your application has been received, {interaction.user.display_name}!",
561561
ephemeral=True,
562562
)
563563

0 commit comments

Comments
 (0)