Skip to content

Commit 09abf0c

Browse files
authored
Merge branch 'main' into DebugCommand
2 parents 7e0e005 + 495cb01 commit 09abf0c

61 files changed

Lines changed: 1914 additions & 1453 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.

default.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ POSTGRES_DB_NAME=
22
POSTGRES_DB_PASSWORD=
33
POSTGRES_DB_USER=
44
DEBUG=
5+
CONFIG_YML=./config.yml

techsupport_bot/bot.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ 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
4646
FUNCTIONS_DIR_NAME (str):The hardcoded folder for functions
4747
FUNCTIONS_DIR (str):The list of all files in the FUNCTIONS_DIR_NAME folder
4848
"""
4949

50-
CONFIG_PATH: str = "./config.yml"
50+
CONFIG_PATH: str = os.environ.get("CONFIG_YML", "./config.yml")
5151
EXTENSIONS_DIR_NAME: str = "commands"
5252
EXTENSIONS_DIR: str = (
5353
f"{os.path.join(os.path.dirname(__file__))}/{EXTENSIONS_DIR_NAME}"
@@ -915,7 +915,7 @@ async def interaction_check(self: Self, interaction: discord.Interaction) -> boo
915915
await self.slash_command_log(interaction)
916916

917917
await self.logger.send_log(
918-
message="Checking if prefix command can run",
918+
message="Checking if slash command can run",
919919
level=LogLevel.DEBUG,
920920
context=LogContext(guild=interaction.guild, channel=interaction.channel),
921921
console_only=True,
@@ -1042,22 +1042,30 @@ async def can_run(
10421042
# IRC Stuff
10431043

10441044
async def start_irc(self: Self) -> None:
1045-
"""Starts the IRC connection in a seperate thread"""
1046-
irc_config = self.file_config.api.irc
1045+
"""Starts the IRC bot in a separate thread."""
10471046
main_loop = asyncio.get_running_loop()
1047+
irc_config = self.file_config.api.irc
10481048

1049-
irc_bot = ircrelay.IRCBot(
1049+
# Create the bot instance
1050+
irc_bot = ircrelay.relay.IRCBot(
10501051
loop=main_loop,
10511052
server=irc_config.server,
10521053
port=irc_config.port,
10531054
channels=irc_config.channels,
10541055
username=irc_config.name,
10551056
password=irc_config.password,
10561057
)
1058+
10571059
self.irc = irc_bot
10581060

1059-
irc_thread = threading.Thread(target=irc_bot.start)
1061+
def run_in_thread() -> None:
1062+
"""Run the IRC bot in a separate thread."""
1063+
irc_bot.start_bot()
1064+
1065+
# Start the bot in a new thread
10601066
await self.logger.send_log(
1061-
message="Logging in to IRC", level=LogLevel.INFO, console_only=True
1067+
message="Logging into IRC", level=LogLevel.INFO, console_only=True
10621068
)
1063-
irc_thread.start()
1069+
1070+
bot_thread = threading.Thread(target=run_in_thread)
1071+
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
@@ -16,5 +16,6 @@
1616
from .linter import *
1717
from .listen import *
1818
from .mock import *
19+
from .relay import *
1920
from .roll import *
2021
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")

0 commit comments

Comments
 (0)