From e458d3a8a636a133dee53d05a8a799d023dcfd93 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:33:49 +0000 Subject: [PATCH 01/13] Bump pydoclint from 0.4.1 to 0.5.6 Bumps [pydoclint](https://github.com/jsh9/pydoclint) from 0.4.1 to 0.5.6. - [Release notes](https://github.com/jsh9/pydoclint/releases) - [Changelog](https://github.com/jsh9/pydoclint/blob/main/CHANGELOG.md) - [Commits](https://github.com/jsh9/pydoclint/compare/0.4.1...0.5.6) --- updated-dependencies: - dependency-name: pydoclint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Pipfile | 2 +- Pipfile.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Pipfile b/Pipfile index 24483520..f4239222 100644 --- a/Pipfile +++ b/Pipfile @@ -29,7 +29,7 @@ typing_extensions = "==4.8.0" pip = "==24.1.2" pipenv = "==2024.0.1" pydantic = "==2.8.2" -pydoclint = "==0.4.1" +pydoclint = "==0.5.6" pylint = "==3.2.6" pynacl = "==1.5.0" pytest = "==8.3.1" diff --git a/Pipfile.lock b/Pipfile.lock index 399ee8be..91bbbfbd 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "9e8ec7097b35f17e7f9113affa151956360bcbd62640faf7cde844b24850c4fe" + "sha256": "cdf8a57383490b0e566fe0673f6461e15d33f09daac68c5599b5971cf70ece1e" }, "pipfile-spec": 6, "requires": { @@ -364,11 +364,11 @@ }, "docstring-parser-fork": { "hashes": [ - "sha256:59d3b00d42ba9f4e229a7df7e1f6fc742845f88a1190973cc33ba336a5405425", - "sha256:88098ae01b0909b241954ad2c50c0c29ec2292223366a540bfd68332be8fd595" + "sha256:0be85ad00cb25bf5beeb673e46e777facf0f47552fa3a7570d120ef7e3374401", + "sha256:95b23cc5092af85080c716a6da68360f5ae4fcffa75f4a3aca5e539783cbcc3d" ], "markers": "python_version >= '3.7' and python_version < '4.0'", - "version": "==0.0.8" + "version": "==0.0.9" }, "emoji": { "hashes": [ @@ -967,12 +967,12 @@ }, "pydoclint": { "hashes": [ - "sha256:4e32fdf0a47a2199377617f09af0a82a2157f80543026f919a17112a396e752f", - "sha256:d39ed26a793203afadb1917011710fbf258ac3dddcd79b53212e0a2107221643" + "sha256:903a33a25504df85b200d3a3f1207688de208890b79730ceb6045978864ba7c9", + "sha256:991d336a8058d482e581f55e0b140c5757ce11d2baa2d2fca94b8f678c03831b" ], "index": "pypi", "markers": "python_version >= '3.8'", - "version": "==0.4.1" + "version": "==0.5.6" }, "pyflakes": { "hashes": [ From 15fbe52642387631d17d1565f9296b644cb13c44 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Thu, 25 Jul 2024 14:38:09 -0400 Subject: [PATCH 02/13] Test --- techsupport_bot/ui/pagination.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/techsupport_bot/ui/pagination.py b/techsupport_bot/ui/pagination.py index 681cf0fd..874290f7 100644 --- a/techsupport_bot/ui/pagination.py +++ b/techsupport_bot/ui/pagination.py @@ -14,7 +14,7 @@ class PaginateView(discord.ui.View): To use this, call the send function. Everything else is automatic - Attrs: + Attributes: current_page (int): The current page number the user is on data (list[str | discord.Embed]): The list of data for the pages timeout (int): The timeout till the buttons dissapear without interaction @@ -22,9 +22,9 @@ class PaginateView(discord.ui.View): """ current_page: int = 1 - data = None - timeout = 120 - message = "" + data: list[str | discord.Embed] = None + timeout: int = 120 + message: discord.Message = "" def add_page_numbers(self: Self) -> None: """A simple function to add page numbers to embed footer""" From 4f09d754c0703aeb5c31387baf6cc7c8f92b2bb0 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Thu, 25 Jul 2024 14:40:06 -0400 Subject: [PATCH 03/13] Test 2 --- techsupport_bot/ui/confirm.py | 2 +- techsupport_bot/ui/vote_creation.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/techsupport_bot/ui/confirm.py b/techsupport_bot/ui/confirm.py index 6dc31736..9aaf6445 100644 --- a/techsupport_bot/ui/confirm.py +++ b/techsupport_bot/ui/confirm.py @@ -12,7 +12,7 @@ class ConfirmResponse(Enum): """A class to define the 3 responses - Attrs: + Attributes: CONFIRMED (int): The original author clicked the "confirm" button DENIED (int): The original author clicked the "cancel" button TIMEOUT (int): No buttons were pressed in the timeout range diff --git a/techsupport_bot/ui/vote_creation.py b/techsupport_bot/ui/vote_creation.py index ef232fc5..0d401fba 100644 --- a/techsupport_bot/ui/vote_creation.py +++ b/techsupport_bot/ui/vote_creation.py @@ -17,13 +17,13 @@ class VoteCreation(discord.ui.Modal, title="Staff voting"): vote_reason (discord.TextInput): The main body of the vote """ - vote_short = discord.ui.TextInput( + vote_short: discord.TextInput = discord.ui.TextInput( label="What are you starting a vote for?", style=discord.TextStyle.short, required=True, max_length=94, ) - vote_reason = discord.ui.TextInput( + vote_reason: discord.TextInput = discord.ui.TextInput( label="Describe your vote", style=discord.TextStyle.paragraph, required=True, From 0a28035345d84f55f178b2c126221567af08af44 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Thu, 25 Jul 2024 14:43:36 -0400 Subject: [PATCH 04/13] Rename attrs to attributes --- techsupport_bot/bot.py | 2 +- techsupport_bot/botlogging/common.py | 4 +-- techsupport_bot/botlogging/embed.py | 10 +++---- techsupport_bot/commands/animal.py | 2 +- techsupport_bot/commands/application.py | 4 +-- techsupport_bot/commands/burn.py | 2 +- techsupport_bot/commands/chatgpt.py | 2 +- techsupport_bot/commands/conch.py | 2 +- techsupport_bot/commands/duck.py | 2 +- techsupport_bot/commands/emoji.py | 2 +- techsupport_bot/commands/extension.py | 2 +- techsupport_bot/commands/factoids.py | 6 ++-- techsupport_bot/commands/giphy.py | 2 +- techsupport_bot/commands/github.py | 2 +- techsupport_bot/commands/google.py | 2 +- techsupport_bot/commands/grab.py | 2 +- techsupport_bot/commands/hangman.py | 2 +- techsupport_bot/commands/help.py | 2 +- techsupport_bot/commands/hug.py | 2 +- techsupport_bot/commands/ipinfo.py | 2 +- techsupport_bot/commands/iss.py | 2 +- techsupport_bot/commands/joke.py | 2 +- techsupport_bot/commands/kanye.py | 2 +- techsupport_bot/commands/lenny.py | 2 +- techsupport_bot/commands/news.py | 4 +-- techsupport_bot/commands/poll.py | 4 +-- techsupport_bot/commands/protect.py | 2 +- techsupport_bot/commands/relay.py | 2 +- techsupport_bot/commands/role.py | 2 +- techsupport_bot/commands/roll.py | 2 +- techsupport_bot/commands/rules.py | 2 +- techsupport_bot/commands/spotify.py | 2 +- techsupport_bot/commands/translate.py | 2 +- techsupport_bot/commands/urban.py | 2 +- techsupport_bot/commands/who.py | 2 +- techsupport_bot/commands/winerror.py | 4 +-- techsupport_bot/commands/wolfram.py | 2 +- techsupport_bot/commands/xkcd.py | 2 +- techsupport_bot/core/cogs.py | 6 ++-- techsupport_bot/core/custom_errors.py | 2 +- techsupport_bot/core/databases.py | 28 +++++++++---------- techsupport_bot/ircrelay/irc.py | 2 +- .../commands_tests/test_extensions_wyr.py | 2 +- techsupport_bot/ui/application.py | 2 +- techsupport_bot/ui/appnotice.py | 2 +- techsupport_bot/ui/confirm.py | 6 ++-- techsupport_bot/ui/vote_creation.py | 2 +- 47 files changed, 75 insertions(+), 75 deletions(-) diff --git a/techsupport_bot/bot.py b/techsupport_bot/bot.py index 9909e9ed..b4413f4b 100644 --- a/techsupport_bot/bot.py +++ b/techsupport_bot/bot.py @@ -39,7 +39,7 @@ class TechSupportBot(commands.Bot): allowed_mentions (discord.AllowedMentions): What the bot is, or is not, allowed to mention - Attrs: + Attributes: CONFIG_PATH (str): The hard coded path to the yaml config file EXTENSIONS_DIR_NAME (str): The hardcoded folder for commands EXTENSIONS_DIR (str): The list of all files in the EXTENSIONS_DIR_NAME folder diff --git a/techsupport_bot/botlogging/common.py b/techsupport_bot/botlogging/common.py index 3e4e25b9..815145f2 100644 --- a/techsupport_bot/botlogging/common.py +++ b/techsupport_bot/botlogging/common.py @@ -12,7 +12,7 @@ class LogLevel(Enum): """This is a way to map log levels to strings, and have the easy ability to dynamically add or remove log levels - Attrs: + Attributes: DEBUG (str): Representation of debug INFO (str): Representation of info WARNING (str): Representation of warning @@ -30,7 +30,7 @@ class LogContext: """A very simple class to store a few contextual items about the log This is used to determine if some guild settings means the log shouldn't be logged - Attrs: + Attributes: guild (discord.Guild | None): The guild the log occured with. Optional channel (discord.abc.Messageble | None): The channel, DM, thread, or other messagable the log occured in diff --git a/techsupport_bot/botlogging/embed.py b/techsupport_bot/botlogging/embed.py index c24122bc..8ebe6e03 100644 --- a/techsupport_bot/botlogging/embed.py +++ b/techsupport_bot/botlogging/embed.py @@ -15,7 +15,7 @@ class LogEmbed(discord.Embed): Args: message (str): The message to log. Will become the description of an embed - Attrs: + Attributes: title (str): The title of the embed color (discord.Color): The color of the embed """ @@ -49,7 +49,7 @@ def modify_embed(self: Self, embed: discord.Embed) -> discord.Embed: class InfoEmbed(LogEmbed): """Embed for info level log events. - Attrs: + Attributes: title (str): The title of the embed color (discord.Color): The color of the embed """ @@ -61,7 +61,7 @@ class InfoEmbed(LogEmbed): class DebugEmbed(LogEmbed): """Embed for debug level log events. - Attrs: + Attributes: title (str): The title of the embed color (discord.Color): The color of the embed """ @@ -73,7 +73,7 @@ class DebugEmbed(LogEmbed): class WarningEmbed(LogEmbed): """Embed for warning level log events. - Attrs: + Attributes: title (str): The title of the embed color (discord.Color): The color of the embed """ @@ -85,7 +85,7 @@ class WarningEmbed(LogEmbed): class ErrorEmbed(LogEmbed): """Embed for error level log events. - Attrs: + Attributes: title (str): The title of the embed color (discord.Color): The color of the embed """ diff --git a/techsupport_bot/commands/animal.py b/techsupport_bot/commands/animal.py index 9e288b23..e2f8794d 100644 --- a/techsupport_bot/commands/animal.py +++ b/techsupport_bot/commands/animal.py @@ -24,7 +24,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Animals(cogs.BaseCog): """The class for the animals commands - Attrs: + Attributes: CAT_API_URL (str): The URL for the cat API DOG_API_URL (str): The URL for the dog API FOX_API_URL (str): The URL for the fox API diff --git a/techsupport_bot/commands/application.py b/techsupport_bot/commands/application.py index 06190bbf..6dcb2578 100644 --- a/techsupport_bot/commands/application.py +++ b/techsupport_bot/commands/application.py @@ -20,7 +20,7 @@ class ApplicationStatus(Enum): """Static string mapping of all status This is so the database can always be consistent - Attrs: + Attributes: PENDING (str): The string representation for pending APPROVED (str): The string representation for approved DENIED (str): The string representation for denied @@ -198,7 +198,7 @@ async def wait(self: Self, config: munch.Munch, guild: discord.Guild) -> None: class ApplicationManager(cogs.LoopCog): """This cog is responsible for the majority of functions in the application system - Attrs: + Attributes: application_group (app_commands.Group): The group for the /application commands """ diff --git a/techsupport_bot/commands/burn.py b/techsupport_bot/commands/burn.py index fceed45b..fb8fbf89 100644 --- a/techsupport_bot/commands/burn.py +++ b/techsupport_bot/commands/burn.py @@ -29,7 +29,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Burn(cogs.BaseCog): """Class for Burn command on the discord bot. - Attrs: + Attributes: PHRASES (list[str]): The list of phrases to pick from """ diff --git a/techsupport_bot/commands/chatgpt.py b/techsupport_bot/commands/chatgpt.py index 55e35a4e..cc1ff0bf 100644 --- a/techsupport_bot/commands/chatgpt.py +++ b/techsupport_bot/commands/chatgpt.py @@ -48,7 +48,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class ChatGPT(cogs.BaseCog): """Main extension class - Attrs: + Attributes: API_URL (str): The URL for the openai API SYSTEM_PROMPT (dict[str, str]): The default starting prompt for chatGPT """ diff --git a/techsupport_bot/commands/conch.py b/techsupport_bot/commands/conch.py index 7256e3f4..fa731e08 100644 --- a/techsupport_bot/commands/conch.py +++ b/techsupport_bot/commands/conch.py @@ -29,7 +29,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class MagicConch(cogs.BaseCog): """Class to create the conch command for discord bot. - Attrs: + Attributes: RESPONSES (list[str]): The list of random responses for the 8 ball PIC_URL (str): The direct URL for the picture to put in embeds diff --git a/techsupport_bot/commands/duck.py b/techsupport_bot/commands/duck.py index 3dddd060..32fcb804 100644 --- a/techsupport_bot/commands/duck.py +++ b/techsupport_bot/commands/duck.py @@ -93,7 +93,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class DuckHunt(cogs.LoopCog): """Class for the actual duck commands - Attrs: + Attributes: DUCK_PIC_URL (str): The picture for the duck BEFRIEND_URL (str): The picture for the befriend target KILL_URL (str): The picture for the kill target diff --git a/techsupport_bot/commands/emoji.py b/techsupport_bot/commands/emoji.py index 8e815383..91afe9a5 100644 --- a/techsupport_bot/commands/emoji.py +++ b/techsupport_bot/commands/emoji.py @@ -31,7 +31,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Emojis(cogs.BaseCog): """Class for all the emoji commands - Attrs: + Attributes: KEY_MAP (dict[str,str]): Some manual mappings from character to emoji """ diff --git a/techsupport_bot/commands/extension.py b/techsupport_bot/commands/extension.py index 1f6d1f7c..192f7f03 100644 --- a/techsupport_bot/commands/extension.py +++ b/techsupport_bot/commands/extension.py @@ -37,7 +37,7 @@ class ExtensionControl(cogs.BaseCog): """ The class that holds the extension commands - Attrs: + Attributes: extension_app_command_group (app_commands.Group): The group for the /extension commands """ diff --git a/techsupport_bot/commands/factoids.py b/techsupport_bot/commands/factoids.py index 91a3c910..1f5228df 100644 --- a/techsupport_bot/commands/factoids.py +++ b/techsupport_bot/commands/factoids.py @@ -168,7 +168,7 @@ class CalledFactoid: """A class to allow keeping the original factoid name in tact Without having to call the database lookup function every time - Attrs: + Attributes: original_call_str (str): The original name the user provided for a factoid factoid_db_entry (bot.models.Factoid): The database entry for the original factoid """ @@ -181,7 +181,7 @@ class Properties(Enum): """ This enum is for the new factoid all to be able to handle dynamic properties - Attrs: + Attributes: HIDDEN (str): Representation of hidden DISABLED (str): Representation of disabled RESTRICTED (str): Representation of restricted @@ -198,7 +198,7 @@ class FactoidManager(cogs.MatchCog): """ Manages all factoid features - Attrs: + Attributes: CRON_REGEX (str): The regex to check if a cronjob is correct factoid_app_group (app_commands.Group): Group for /factoid commands """ diff --git a/techsupport_bot/commands/giphy.py b/techsupport_bot/commands/giphy.py index 47e8c050..a7df7f3c 100644 --- a/techsupport_bot/commands/giphy.py +++ b/techsupport_bot/commands/giphy.py @@ -35,7 +35,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Giphy(cogs.BaseCog): """Class for the giphy extension. - Attrs: + Attributes: GIPHY_URL (str): The URL for the giphy API SEARCH_LIMIT (int): The max amount of gifs to search for """ diff --git a/techsupport_bot/commands/github.py b/techsupport_bot/commands/github.py index 689db0b5..739a4055 100644 --- a/techsupport_bot/commands/github.py +++ b/techsupport_bot/commands/github.py @@ -50,7 +50,7 @@ class IssueCreator(cogs.BaseCog): """ The class that holds the issue commands - Attrs: + Attributes: GITHUB_API_BASE_URL (str): The URL for the github API """ diff --git a/techsupport_bot/commands/google.py b/techsupport_bot/commands/google.py index 580af192..9bfb4c52 100644 --- a/techsupport_bot/commands/google.py +++ b/techsupport_bot/commands/google.py @@ -47,7 +47,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Googler(cogs.BaseCog): """Class for the google extension for the discord bot. - Attrs: + Attributes: GOOGLE_URL (str): The API URL for google search YOUTUBE_URL (str): The API URL for youtube search ICON_URL (str): The google icon diff --git a/techsupport_bot/commands/grab.py b/techsupport_bot/commands/grab.py index 690621db..27099dad 100644 --- a/techsupport_bot/commands/grab.py +++ b/techsupport_bot/commands/grab.py @@ -71,7 +71,7 @@ async def invalid_channel(ctx: commands.Context) -> bool: class Grabber(cogs.BaseCog): """Class for the actual commands - Attrs: + Attributes: SEARCH_LIMIT (int): The max amount of messages to search when grabbing """ diff --git a/techsupport_bot/commands/hangman.py b/techsupport_bot/commands/hangman.py index b79be7fe..07daa687 100644 --- a/techsupport_bot/commands/hangman.py +++ b/techsupport_bot/commands/hangman.py @@ -37,7 +37,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class HangmanGame: """Class for the game hangman. - Attrs: + Attributes: HANG_PICS (list[str]): The list of hangman pictures FINAL_STEP (int): The last step of the hangman game finished (bool): Determines if the game has been finished or not diff --git a/techsupport_bot/commands/help.py b/techsupport_bot/commands/help.py index edc77f3a..3752f15f 100644 --- a/techsupport_bot/commands/help.py +++ b/techsupport_bot/commands/help.py @@ -21,7 +21,7 @@ class PrintableCommand: """A custom class to store formatted information about a command With a priority on being sortable and searchable - Attrs: + Attributes: prefix (str): The prefix to call the command with name (str): The command name usage (str): The usage hints for the command diff --git a/techsupport_bot/commands/hug.py b/techsupport_bot/commands/hug.py index 6cf5286a..eae1ffe3 100644 --- a/techsupport_bot/commands/hug.py +++ b/techsupport_bot/commands/hug.py @@ -25,7 +25,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Hugger(cogs.BaseCog): """Class to make the hug command. - Attrs: + Attributes: HUGS_SELECTION (list[str]): The list of hug phrases to display ICON_URL (str): The icon to use when hugging diff --git a/techsupport_bot/commands/ipinfo.py b/techsupport_bot/commands/ipinfo.py index 4d46cc51..5d777e1e 100644 --- a/techsupport_bot/commands/ipinfo.py +++ b/techsupport_bot/commands/ipinfo.py @@ -24,7 +24,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class IPInfo(cogs.BaseCog): """Class to add ipinfo geodata to the bot. - Attrs: + Attributes: API_URL (str): The API url for IP info IP_ICON_URL (str): The URL for the IP info icon """ diff --git a/techsupport_bot/commands/iss.py b/techsupport_bot/commands/iss.py index 90d29095..a3a89b88 100644 --- a/techsupport_bot/commands/iss.py +++ b/techsupport_bot/commands/iss.py @@ -24,7 +24,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class ISSLocator(cogs.BaseCog): """Class to locate the ISS at its current position. - Attrs: + Attributes: ISS_URL (str): The API URL to get the location of the ISS GEO_URL (str): The API URL to turn lat/lon to location diff --git a/techsupport_bot/commands/joke.py b/techsupport_bot/commands/joke.py index 4137bf8e..282fd557 100644 --- a/techsupport_bot/commands/joke.py +++ b/techsupport_bot/commands/joke.py @@ -37,7 +37,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Joker(cogs.BaseCog): """Class to make up the joke extension. - Attrs: + Attributes: API_URL (str): The joke API URL """ diff --git a/techsupport_bot/commands/kanye.py b/techsupport_bot/commands/kanye.py index ca8f5fa2..ff491224 100644 --- a/techsupport_bot/commands/kanye.py +++ b/techsupport_bot/commands/kanye.py @@ -51,7 +51,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class KanyeQuotes(cogs.LoopCog): """Class to get the Kanye quotes from the api. - Attrs: + Attributes: API_URL (str): The Kanye API URL KANYE_PICS (list[str]): The list of Kanye pics to pick from randomly """ diff --git a/techsupport_bot/commands/lenny.py b/techsupport_bot/commands/lenny.py index c38efc9f..cfbb990c 100644 --- a/techsupport_bot/commands/lenny.py +++ b/techsupport_bot/commands/lenny.py @@ -25,7 +25,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Lenny(cogs.BaseCog): """Class for lenny extension. - Attrs: + Attributes: LENNYS_SELECTION (list[str]): The list of lenny faces to pick one randomly """ diff --git a/techsupport_bot/commands/news.py b/techsupport_bot/commands/news.py index 9488e741..277efe25 100644 --- a/techsupport_bot/commands/news.py +++ b/techsupport_bot/commands/news.py @@ -71,7 +71,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Category(enum.Enum): """Class to set up categories for the news. - Attrs: + Attributes: BUSINESS (str): The string representation for business ENTERTAINMENT (str): The string representation for entertainment GENERAL (str): The string representation for general @@ -94,7 +94,7 @@ class Category(enum.Enum): class News(cogs.LoopCog): """Class to set up the news extension for the discord bot. - Attrs: + Attributes: API_URL (str): The news API URL """ diff --git a/techsupport_bot/commands/poll.py b/techsupport_bot/commands/poll.py index 23b7c78e..f2b5ba08 100644 --- a/techsupport_bot/commands/poll.py +++ b/techsupport_bot/commands/poll.py @@ -103,7 +103,7 @@ async def validate_data( class ReactionPoller(PollGenerator): """Class to add reactions to the poll generator. - Attrs: + Attributes: OPTION_EMOJIS (list[str]): The list of emojis to react to the message with STOP_EMOJI (str): The stop emoji to reaction to the message with EXAMPLE_DATA (dict[str, str | list[str] | int]): The example poll that the bot can use @@ -313,7 +313,7 @@ async def wait_for_results( class StrawPoller(PollGenerator): """Class to create a straw poll from discord. - Attrs: + Attributes: EXAMPLE_DATA (dict[str, str | list[str]]): The example poll that the bot can use API_URL (str): The strawpoll API URL diff --git a/techsupport_bot/commands/protect.py b/techsupport_bot/commands/protect.py index 7707919d..38e6ba17 100644 --- a/techsupport_bot/commands/protect.py +++ b/techsupport_bot/commands/protect.py @@ -147,7 +147,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Protector(cogs.MatchCog): """Class for the protector command. - Attrs: + Attributes: ALERT_ICON_URL (str): The icon for the alert messages CLIPBOARD_ICON_URL (str): The icon for the paste messages CHARS_PER_NEWLINE (int): The arbitrary length of a line diff --git a/techsupport_bot/commands/relay.py b/techsupport_bot/commands/relay.py index 481b0ff9..9340183e 100644 --- a/techsupport_bot/commands/relay.py +++ b/techsupport_bot/commands/relay.py @@ -42,7 +42,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class DiscordToIRC(cogs.MatchCog): """The discord side of the relay - Attrs: + Attributes: mapping (bidict): The dict that holds the IRC and discord mappings """ diff --git a/techsupport_bot/commands/role.py b/techsupport_bot/commands/role.py index a04f280b..8c1f5010 100644 --- a/techsupport_bot/commands/role.py +++ b/techsupport_bot/commands/role.py @@ -56,7 +56,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class RoleGiver(cogs.BaseCog): """The main class for the role commands - Attrs: + Attributes: role_group (app_commands.Group): The group for the /role commands Args: diff --git a/techsupport_bot/commands/roll.py b/techsupport_bot/commands/roll.py index d53a0be4..a729b1a8 100644 --- a/techsupport_bot/commands/roll.py +++ b/techsupport_bot/commands/roll.py @@ -25,7 +25,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Roller(cogs.BaseCog): """Class for the roll command for the extension. - Attrs: + Attributes: ICON_URL (str): The URL for the dice icon """ diff --git a/techsupport_bot/commands/rules.py b/techsupport_bot/commands/rules.py index d2af7492..a33ea914 100644 --- a/techsupport_bot/commands/rules.py +++ b/techsupport_bot/commands/rules.py @@ -28,7 +28,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Rules(cogs.BaseCog): """Class to define the rules for the extension. - Attrs: + Attributes: RULE_ICON_URL (str): The icon to use for the rules """ diff --git a/techsupport_bot/commands/spotify.py b/techsupport_bot/commands/spotify.py index e121ac84..2b67314e 100644 --- a/techsupport_bot/commands/spotify.py +++ b/techsupport_bot/commands/spotify.py @@ -38,7 +38,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Spotify(cogs.BaseCog): """Class for setting up the Spotify extension. - Attrs: + Attributes: AUTH_URL: The URL for the authentication API for spotify API_URL: The URL for the search spotify API diff --git a/techsupport_bot/commands/translate.py b/techsupport_bot/commands/translate.py index be4e01ee..5151d0de 100644 --- a/techsupport_bot/commands/translate.py +++ b/techsupport_bot/commands/translate.py @@ -23,7 +23,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Translator(cogs.BaseCog): """Class to set up the translate extension. - Attrs: + Attributes: API_URL (str): The translated API URL """ diff --git a/techsupport_bot/commands/urban.py b/techsupport_bot/commands/urban.py index a5960ecc..a34eaf78 100644 --- a/techsupport_bot/commands/urban.py +++ b/techsupport_bot/commands/urban.py @@ -35,7 +35,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class UrbanDictionary(cogs.BaseCog): """Class for setting up the urban dictionary extension. - Attrs: + Attributes: BASE_URL (str): The base API URL for urban dict SEE_MORE_URL (str): The URL to link to search results from the API ICON_URL (str): The urban dict icon URL diff --git a/techsupport_bot/commands/who.py b/techsupport_bot/commands/who.py index f26d1bd7..b6f84b5a 100644 --- a/techsupport_bot/commands/who.py +++ b/techsupport_bot/commands/who.py @@ -64,7 +64,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Who(cogs.BaseCog): """Class to set up who for the extension. - Attrs: + Attributes: notes (app_commands.Group): The group for the /note commands """ diff --git a/techsupport_bot/commands/winerror.py b/techsupport_bot/commands/winerror.py index be34294c..537c850c 100644 --- a/techsupport_bot/commands/winerror.py +++ b/techsupport_bot/commands/winerror.py @@ -30,7 +30,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Error: """The data to pull for the error. - Attrs: + Attributes: name (str): the name of the error source (str): the header file where the error is from description (str): the description of the error @@ -46,7 +46,7 @@ class ErrorCategory: """A category of errors, based on how the error was found This contains the name of the category and a list of errors - Attrs: + Attributes: name (str): The name of the category of errors errors (list[Error]): The list of errors in the category diff --git a/techsupport_bot/commands/wolfram.py b/techsupport_bot/commands/wolfram.py index f7be3510..9a89fa02 100644 --- a/techsupport_bot/commands/wolfram.py +++ b/techsupport_bot/commands/wolfram.py @@ -35,7 +35,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Wolfram(cogs.BaseCog): """Class to set up the wolfram extension. - Attrs: + Attributes: API_URL (str): The API URL for wolfram ICON_URL (str): The URL for the wolfram icon diff --git a/techsupport_bot/commands/xkcd.py b/techsupport_bot/commands/xkcd.py index a27d4072..4b10afda 100644 --- a/techsupport_bot/commands/xkcd.py +++ b/techsupport_bot/commands/xkcd.py @@ -26,7 +26,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class XKCD(cogs.BaseCog): """Class to create the xkcd for the extension. - Attrs: + Attributes: MOST_RECENT_API_URL (str): The URL for the most recent comic SPECIFIC_API_URL (str): The URL for a given number comic diff --git a/techsupport_bot/core/cogs.py b/techsupport_bot/core/cogs.py index 3f94a619..ce05c080 100644 --- a/techsupport_bot/core/cogs.py +++ b/techsupport_bot/core/cogs.py @@ -18,7 +18,7 @@ class BaseCog(commands.Cog): """The base cog to use when making extensions. - Attrs: + Attributes: COG_TYPE (str): The string representation for the type of cog KEEP_COG_ON_FAILURE (bool): Whether or not to keep the cog loaded if there was an error @@ -97,7 +97,7 @@ class MatchCog(BaseCog): This makes the process of handling events simpler for development. - Attrs: + Attributes: COG_TYPE (str): The string representation for the type of cog """ @@ -182,7 +182,7 @@ class LoopCog(BaseCog): This currently doesn't utilize the tasks library. - Attrs: + Attributes: COG_TYPE (str): The string representation for the type of cog DEFAULT_WAIT (int): The default time to sleep for TRACKER_WAIT (int): The time to wait before looking for new channels diff --git a/techsupport_bot/core/custom_errors.py b/techsupport_bot/core/custom_errors.py index 372c283c..bc23cb1a 100644 --- a/techsupport_bot/core/custom_errors.py +++ b/techsupport_bot/core/custom_errors.py @@ -70,7 +70,7 @@ def __init__(self: Self, wait: int) -> None: class ErrorResponse: """Object for generating a custom error message from an exception. - Attrs: + Attributes: DEFAULT_MESSAGE (str): The default error message for unclassified errors Args: diff --git a/techsupport_bot/core/databases.py b/techsupport_bot/core/databases.py index 6b342fba..32e82994 100644 --- a/techsupport_bot/core/databases.py +++ b/techsupport_bot/core/databases.py @@ -23,7 +23,7 @@ class Applications(bot.db.Model): """The postgres table for applications Currenty used in application.py - Attrs: + Attributes: __tablename__ (str): The name of the table in postgres pk (int): The automatic primary key guild_id (str): The string of the guild ID the application is in @@ -52,7 +52,7 @@ class ApplicationBans(bot.db.Model): """The postgres table for users banned from applications Currently used in application.py and who.py - Attrs: + Attributes: __tablename__ (str): The name of the table in postgres pk (int): The automatic primary key guild_id (str): The string of the guild ID the applicant is banned in @@ -69,7 +69,7 @@ class DuckUser(bot.db.Model): """The postgres table for ducks Currently used in duck.py - Attrs: + Attributes: __tablename__ (str): The name of the table in postgres pk (int): The automatic primary key author_id (str): The string representation of the ID of the user @@ -94,7 +94,7 @@ class Factoid(bot.db.Model): """The postgres table for factoids Currently used in factoid.py - Attrs: + Attributes: __tablename__ (str): The name of the table in postgres factoid_id (int): The primary key of the factoid name (str): The name of the factoid @@ -127,7 +127,7 @@ class FactoidJob(bot.db.Model): """The postgres table for factoid loops Currently used in factoid.py - Attrs: + Attributes: __tablename__ (str): The name of the table in postgres job_id (int): The primary key, ID of the job factoid (int): The primary key of the linked factoid @@ -148,7 +148,7 @@ class Grab(bot.db.Model): """The postgres table for grabs Currently used in grab.py - Attrs: + Attributes: __tablename__ (str): The name of the table in postgres pk (int): The primary key for this database author_id (str): The ID of the author of the original grab message @@ -173,7 +173,7 @@ class IRCChannelMapping(bot.db.Model): """The postgres table for IRC->discord maps Currently used in relay.py - Attrs: + Attributes: __tablename__ (str): The name of the table in postgres map_id (int): The primary key for the database guild_id (str): The guild where the discord channel exists at @@ -191,7 +191,7 @@ class ModmailBan(bot.db.Model): """The postgres table for modmail bans Currently used in modmail.py - Attrs: + Attributes: __tablename__ (str): The name of the table in postgres user_id (str): The ID of the user banned from modmail """ @@ -203,7 +203,7 @@ class UserNote(bot.db.Model): """The postgres table for notes Currently used in who.py - Attrs: + Attributes: __tablename__ (str): The name of the table in postgres pk (int): The primary key for this database user_id (str): The user ID that has a note @@ -226,7 +226,7 @@ class Warning(bot.db.Model): """The postgres table for warnings Currently used in protect.py and who.py - Attrs: + Attributes: __tablename__ (str): The name of the table in postgres pk (int): The primary key for the database user_id (str): The user who got warned @@ -246,7 +246,7 @@ class Config(bot.db.Model): """The postgres table for guild config Currently used nearly everywhere - Attrs: + Attributes: __tablename__ (str): The name of the table in postgres pk (int): The primary key for the database guild_id (str): The ID of the guild this config is for @@ -264,7 +264,7 @@ class Listener(bot.db.Model): """The postgres table for listeners Currently used in listen.py - Attrs: + Attributes: __tablename__ (str): The name of the table in postgres pk (int): The primary key for the database src_id (str): The source channel for the listener @@ -280,7 +280,7 @@ class Rule(bot.db.Model): """The postgres table for rules Currently used in rules.py - Attrs: + Attributes: __tablename__ (str): The name of the table in postgres pk (int): The primary key for the database guild_id (str): The ID of the guild that these rules are for @@ -296,7 +296,7 @@ class Votes(bot.db.Model): """The postgres table for votes Currently used in voting.py - Attrs: + Attributes: __tablename__ (str): The name of the table in postgres vote_id (int): The primary key of the vote guild_id (str): The guild the vote belongs to diff --git a/techsupport_bot/ircrelay/irc.py b/techsupport_bot/ircrelay/irc.py index 13b6b0f2..eaa1ff41 100644 --- a/techsupport_bot/ircrelay/irc.py +++ b/techsupport_bot/ircrelay/irc.py @@ -21,7 +21,7 @@ class IRCBot(ib3.auth.SASL, irc.bot.SingleServerIRCBot): """The IRC bot class. This is the class that runs the entire IRC side of the bot The class to start the entire IRC bot - Attrs: + Attributes: irc_cog (commands.relay.DiscordToIRC): The discord cog for the relay, to allow communication between loop (asyncio.AbstractEventLoop): The discord bots event loop diff --git a/techsupport_bot/tests/commands_tests/test_extensions_wyr.py b/techsupport_bot/tests/commands_tests/test_extensions_wyr.py index da411798..7ea1a94e 100644 --- a/techsupport_bot/tests/commands_tests/test_extensions_wyr.py +++ b/techsupport_bot/tests/commands_tests/test_extensions_wyr.py @@ -96,7 +96,7 @@ async def test_wyr_command_send(self: Self) -> None: class Test_Get_Question: """A set of tests to test the get_question function - Attrs: + Attributes: sample_resource (str): A set of same questions for doing unit tests """ diff --git a/techsupport_bot/ui/application.py b/techsupport_bot/ui/application.py index 9ba68985..9ba674f3 100644 --- a/techsupport_bot/ui/application.py +++ b/techsupport_bot/ui/application.py @@ -12,7 +12,7 @@ class Application(discord.ui.Modal, title="Staff interest form"): """The class contianing the modal and all variables for it This must be sent as a response to an interaction, cannot be from a prefix command - Attrs: + Attributes: background (discord.ui.TextInput): The background question for the application reason (discord.ui.TextInput): The reason question for the application """ diff --git a/techsupport_bot/ui/appnotice.py b/techsupport_bot/ui/appnotice.py index 02df029f..67db84cd 100644 --- a/techsupport_bot/ui/appnotice.py +++ b/techsupport_bot/ui/appnotice.py @@ -10,7 +10,7 @@ class AppNotice(discord.ui.View): """The view containing a button and message encouraging users to apply - Attrs: + Attributes: ICON (str): The Icon for the application reminder """ diff --git a/techsupport_bot/ui/confirm.py b/techsupport_bot/ui/confirm.py index 9aaf6445..2aa5e721 100644 --- a/techsupport_bot/ui/confirm.py +++ b/techsupport_bot/ui/confirm.py @@ -18,9 +18,9 @@ class ConfirmResponse(Enum): TIMEOUT (int): No buttons were pressed in the timeout range """ - CONFIRMED = auto() - DENIED = auto() - TIMEOUT = auto() + CONFIRMED: int = auto() + DENIED: int = auto() + TIMEOUT: int = auto() class Confirm(discord.ui.View): diff --git a/techsupport_bot/ui/vote_creation.py b/techsupport_bot/ui/vote_creation.py index 0d401fba..823054a7 100644 --- a/techsupport_bot/ui/vote_creation.py +++ b/techsupport_bot/ui/vote_creation.py @@ -12,7 +12,7 @@ class VoteCreation(discord.ui.Modal, title="Staff voting"): """The class contianing the modal and all variables for it This must be sent as a response to an interaction, cannot be from a prefix command - Attrs: + Attributes: vote_short (discord.TextInput): The title to make the forum thread for the vote vote_reason (discord.TextInput): The main body of the vote """ From 68ce9cda40167cd7c656dabe96d0130eee2018ce Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:31:27 -0400 Subject: [PATCH 05/13] Formatting --- techsupport_bot/botlogging/common.py | 10 ++++----- techsupport_bot/botlogging/embed.py | 20 +++++++++--------- techsupport_bot/commands/__init__.py | 1 + techsupport_bot/commands/animal.py | 8 +++---- techsupport_bot/commands/application.py | 2 +- techsupport_bot/commands/burn.py | 2 +- techsupport_bot/commands/chatgpt.py | 4 ++-- techsupport_bot/commands/conch.py | 4 ++-- techsupport_bot/commands/duck.py | 14 ++++++++----- techsupport_bot/commands/emoji.py | 2 +- techsupport_bot/commands/extension.py | 2 +- techsupport_bot/commands/factoids.py | 12 +++++------ techsupport_bot/commands/giphy.py | 4 ++-- techsupport_bot/commands/github.py | 2 +- techsupport_bot/commands/google.py | 8 ++++--- techsupport_bot/commands/grab.py | 2 +- techsupport_bot/commands/hangman.py | 4 ++-- techsupport_bot/commands/hug.py | 4 ++-- techsupport_bot/commands/ipinfo.py | 4 ++-- techsupport_bot/commands/iss.py | 4 ++-- techsupport_bot/commands/joke.py | 2 +- techsupport_bot/commands/kanye.py | 4 ++-- techsupport_bot/commands/lenny.py | 2 +- techsupport_bot/commands/news.py | 14 ++++++------- techsupport_bot/commands/poll.py | 6 +++--- techsupport_bot/commands/protect.py | 6 +++--- techsupport_bot/commands/relay.py | 2 +- techsupport_bot/commands/role.py | 2 +- techsupport_bot/commands/roll.py | 4 +++- techsupport_bot/commands/rules.py | 2 +- techsupport_bot/commands/translate.py | 2 +- techsupport_bot/commands/urban.py | 6 +++--- techsupport_bot/commands/wolfram.py | 6 ++++-- techsupport_bot/commands/xkcd.py | 4 ++-- techsupport_bot/core/cogs.py | 6 +++--- techsupport_bot/core/custom_errors.py | 2 +- techsupport_bot/core/databases.py | 21 +++++++------------ techsupport_bot/ircrelay/irc.py | 15 ++++++------- .../commands_tests/test_extensions_wyr.py | 2 +- techsupport_bot/ui/application.py | 4 ++-- techsupport_bot/ui/appnotice.py | 4 +++- 41 files changed, 118 insertions(+), 111 deletions(-) diff --git a/techsupport_bot/botlogging/common.py b/techsupport_bot/botlogging/common.py index 815145f2..bc231716 100644 --- a/techsupport_bot/botlogging/common.py +++ b/techsupport_bot/botlogging/common.py @@ -19,10 +19,10 @@ class LogLevel(Enum): ERROR (str): Representation of error """ - DEBUG = "debug" - INFO = "info" - WARNING = "warning" - ERROR = "error" + DEBUG: str = "debug" + INFO: str = "info" + WARNING: str = "warning" + ERROR: str = "error" @dataclass @@ -32,7 +32,7 @@ class LogContext: Attributes: guild (discord.Guild | None): The guild the log occured with. Optional - channel (discord.abc.Messageble | None): The channel, DM, thread, + channel (discord.abc.Messageable | None): The channel, DM, thread, or other messagable the log occured in """ diff --git a/techsupport_bot/botlogging/embed.py b/techsupport_bot/botlogging/embed.py index 8ebe6e03..c941eb93 100644 --- a/techsupport_bot/botlogging/embed.py +++ b/techsupport_bot/botlogging/embed.py @@ -20,8 +20,8 @@ class LogEmbed(discord.Embed): color (discord.Color): The color of the embed """ - title = None - color = None + title: str = None + color: discord.Color = None def __init__(self: Self, message: str) -> None: super().__init__( @@ -54,8 +54,8 @@ class InfoEmbed(LogEmbed): color (discord.Color): The color of the embed """ - title = "info" - color = discord.Color.green() + title: str = "info" + color: discord.Color = discord.Color.green() class DebugEmbed(LogEmbed): @@ -66,8 +66,8 @@ class DebugEmbed(LogEmbed): color (discord.Color): The color of the embed """ - title = "debug" - color = discord.Color.dark_green() + title: str = "debug" + color: discord.Color = discord.Color.dark_green() class WarningEmbed(LogEmbed): @@ -78,8 +78,8 @@ class WarningEmbed(LogEmbed): color (discord.Color): The color of the embed """ - title = "warning" - color = discord.Color.gold() + title: str = "warning" + color: discord.Color = discord.Color.gold() class ErrorEmbed(LogEmbed): @@ -90,5 +90,5 @@ class ErrorEmbed(LogEmbed): color (discord.Color): The color of the embed """ - title = "error" - color = discord.Color.red() + title: str = "error" + color: discord.Color = discord.Color.red() diff --git a/techsupport_bot/commands/__init__.py b/techsupport_bot/commands/__init__.py index ab0153aa..ac6cbd26 100644 --- a/techsupport_bot/commands/__init__.py +++ b/techsupport_bot/commands/__init__.py @@ -16,5 +16,6 @@ from .linter import * from .listen import * from .mock import * +from .relay import * from .roll import * from .wyr import * diff --git a/techsupport_bot/commands/animal.py b/techsupport_bot/commands/animal.py index e2f8794d..9062b583 100644 --- a/techsupport_bot/commands/animal.py +++ b/techsupport_bot/commands/animal.py @@ -31,10 +31,10 @@ class Animals(cogs.BaseCog): FROG_API_URL (str): The URL for the frog API """ - CAT_API_URL = "https://api.thecatapi.com/v1/images/search?limit=1&api_key={}" - DOG_API_URL = "https://dog.ceo/api/breeds/image/random" - FOX_API_URL = "https://randomfox.ca/floof/" - FROG_API_URL = "https://frogs.media/api/random" + CAT_API_URL: str = "https://api.thecatapi.com/v1/images/search?limit=1&api_key={}" + DOG_API_URL: str = "https://dog.ceo/api/breeds/image/random" + FOX_API_URL: str = "https://randomfox.ca/floof/" + FROG_API_URL: str = "https://frogs.media/api/random" @auxiliary.with_typing @commands.command(name="cat", brief="Gets a cat", description="Gets a cat") diff --git a/techsupport_bot/commands/application.py b/techsupport_bot/commands/application.py index 6dcb2578..8005029b 100644 --- a/techsupport_bot/commands/application.py +++ b/techsupport_bot/commands/application.py @@ -202,7 +202,7 @@ class ApplicationManager(cogs.LoopCog): application_group (app_commands.Group): The group for the /application commands """ - application_group = app_commands.Group( + application_group: app_commands.Group = app_commands.Group( name="application", description="...", extras={"module": "application"} ) diff --git a/techsupport_bot/commands/burn.py b/techsupport_bot/commands/burn.py index fb8fbf89..8d0c3b46 100644 --- a/techsupport_bot/commands/burn.py +++ b/techsupport_bot/commands/burn.py @@ -33,7 +33,7 @@ class Burn(cogs.BaseCog): PHRASES (list[str]): The list of phrases to pick from """ - PHRASES = [ + PHRASES: list[str] = [ "Sick BURN!", "Someone is going to need ointment for that BURN!", "Fire! Call 911! Someone just got BURNED!", diff --git a/techsupport_bot/commands/chatgpt.py b/techsupport_bot/commands/chatgpt.py index cc1ff0bf..8628af51 100644 --- a/techsupport_bot/commands/chatgpt.py +++ b/techsupport_bot/commands/chatgpt.py @@ -53,7 +53,7 @@ class ChatGPT(cogs.BaseCog): SYSTEM_PROMPT (dict[str, str]): The default starting prompt for chatGPT """ - API_URL = "https://api.openai.com/v1/chat/completions" + API_URL: str = "https://api.openai.com/v1/chat/completions" async def preconfig(self: Self) -> None: """Sets up the dict""" @@ -62,7 +62,7 @@ async def preconfig(self: Self) -> None: max_age_seconds=3600, ) - SYSTEM_PROMPT = [ + SYSTEM_PROMPT: dict[str, str] = [ { "role": "system", "content": ( diff --git a/techsupport_bot/commands/conch.py b/techsupport_bot/commands/conch.py index fa731e08..a574e53b 100644 --- a/techsupport_bot/commands/conch.py +++ b/techsupport_bot/commands/conch.py @@ -35,7 +35,7 @@ class MagicConch(cogs.BaseCog): """ - RESPONSES = [ + RESPONSES: list[str] = [ "As I see it, yes.", "Ask again later.", "Better not tell you now.", @@ -57,7 +57,7 @@ class MagicConch(cogs.BaseCog): "Yes - definitely.", "You may rely on it.", ] - PIC_URL = "https://i.imgur.com/vdvGrsR.png" + PIC_URL: str = "https://i.imgur.com/vdvGrsR.png" def format_question(self: Self, question: str) -> str: """This formats a question properly. It will crop it if needed, and add a "?" to the end diff --git a/techsupport_bot/commands/duck.py b/techsupport_bot/commands/duck.py index 32fcb804..1f7cdfe2 100644 --- a/techsupport_bot/commands/duck.py +++ b/techsupport_bot/commands/duck.py @@ -101,14 +101,18 @@ class DuckHunt(cogs.LoopCog): CHANNELS_KEY (str): The config item for the channels that the duck hunt should run """ - DUCK_PIC_URL = "https://cdn.icon-icons.com/icons2/1446/PNG/512/22276duck_98782.png" - BEFRIEND_URL = ( + DUCK_PIC_URL: str = ( + "https://cdn.icon-icons.com/icons2/1446/PNG/512/22276duck_98782.png" + ) + BEFRIEND_URL: str = ( "https://cdn.icon-icons.com/icons2/603/PNG/512/" + "heart_love_valentines_relationship_dating_date_icon-icons.com_55985.png" ) - KILL_URL = "https://cdn.icon-icons.com/icons2/1919/PNG/512/huntingtarget_122049.png" - ON_START = False - CHANNELS_KEY = "hunt_channels" + KILL_URL: str = ( + "https://cdn.icon-icons.com/icons2/1919/PNG/512/huntingtarget_122049.png" + ) + ON_START: bool = False + CHANNELS_KEY: str = "hunt_channels" async def loop_preconfig(self: Self) -> None: """Preconfig for cooldowns""" diff --git a/techsupport_bot/commands/emoji.py b/techsupport_bot/commands/emoji.py index 91afe9a5..56d496d7 100644 --- a/techsupport_bot/commands/emoji.py +++ b/techsupport_bot/commands/emoji.py @@ -35,7 +35,7 @@ class Emojis(cogs.BaseCog): KEY_MAP (dict[str,str]): Some manual mappings from character to emoji """ - KEY_MAP = {"?": "question", "!": "exclamation"} + KEY_MAP: dict[str, str] = {"?": "question", "!": "exclamation"} @classmethod def emoji_from_char(cls: Self, char: str) -> str: diff --git a/techsupport_bot/commands/extension.py b/techsupport_bot/commands/extension.py index 192f7f03..7891a58d 100644 --- a/techsupport_bot/commands/extension.py +++ b/techsupport_bot/commands/extension.py @@ -41,7 +41,7 @@ class ExtensionControl(cogs.BaseCog): extension_app_command_group (app_commands.Group): The group for the /extension commands """ - extension_app_command_group = app_commands.Group( + extension_app_command_group: app_commands.Group = app_commands.Group( name="extension", description="...", extras={"module": "extension"} ) diff --git a/techsupport_bot/commands/factoids.py b/techsupport_bot/commands/factoids.py index 1f5228df..d8261863 100644 --- a/techsupport_bot/commands/factoids.py +++ b/techsupport_bot/commands/factoids.py @@ -188,10 +188,10 @@ class Properties(Enum): PROTECTED (str): Representation of protected """ - HIDDEN = "hidden" - DISABLED = "disabled" - RESTRICTED = "restricted" - PROTECTED = "protected" + HIDDEN: str = "hidden" + DISABLED: str = "disabled" + RESTRICTED: str = "restricted" + PROTECTED: str = "protected" class FactoidManager(cogs.MatchCog): @@ -203,13 +203,13 @@ class FactoidManager(cogs.MatchCog): factoid_app_group (app_commands.Group): Group for /factoid commands """ - CRON_REGEX = ( + CRON_REGEX: str = ( r"^((\*|([0-5]?\d|\*\/\d+)(-([0-5]?\d))?)(,\s*(\*|([0-5]?\d|\*\/\d+)(-([0-5]" + r"?\d))?)){0,59}\s+){4}(\*|([0-7]?\d|\*(\/[1-9]|[1-5]\d)|mon|tue|wed|thu|fri|sat|sun" + r")|\*\/[1-9])$" ) - factoid_app_group = app_commands.Group( + factoid_app_group: app_commands.Group = app_commands.Group( name="factoid", description="Command Group for the Factoids Extension" ) diff --git a/techsupport_bot/commands/giphy.py b/techsupport_bot/commands/giphy.py index a7df7f3c..9f2b276a 100644 --- a/techsupport_bot/commands/giphy.py +++ b/techsupport_bot/commands/giphy.py @@ -40,8 +40,8 @@ class Giphy(cogs.BaseCog): SEARCH_LIMIT (int): The max amount of gifs to search for """ - GIPHY_URL = "http://api.giphy.com/v1/gifs/search?q={}&api_key={}&limit={}" - SEARCH_LIMIT = 10 + GIPHY_URL: str = "http://api.giphy.com/v1/gifs/search?q={}&api_key={}&limit={}" + SEARCH_LIMIT: int = 10 @staticmethod def parse_url(url: str) -> str: diff --git a/techsupport_bot/commands/github.py b/techsupport_bot/commands/github.py index 739a4055..e0e34f55 100644 --- a/techsupport_bot/commands/github.py +++ b/techsupport_bot/commands/github.py @@ -55,7 +55,7 @@ class IssueCreator(cogs.BaseCog): """ - GITHUB_API_BASE_URL = "https://api.github.com" + GITHUB_API_BASE_URL: str = "https://api.github.com" @commands.check(auxiliary.bot_admin_check_context) @auxiliary.with_typing diff --git a/techsupport_bot/commands/google.py b/techsupport_bot/commands/google.py index 9bfb4c52..75db5fac 100644 --- a/techsupport_bot/commands/google.py +++ b/techsupport_bot/commands/google.py @@ -53,9 +53,11 @@ class Googler(cogs.BaseCog): ICON_URL (str): The google icon """ - GOOGLE_URL = "https://www.googleapis.com/customsearch/v1" - YOUTUBE_URL = "https://www.googleapis.com/youtube/v3/search?part=id&maxResults=10" - ICON_URL = ( + GOOGLE_URL: str = "https://www.googleapis.com/customsearch/v1" + YOUTUBE_URL: str = ( + "https://www.googleapis.com/youtube/v3/search?part=id&maxResults=10" + ) + ICON_URL: str = ( "https://cdn.icon-icons.com/icons2/673/PNG/512/Google_icon-icons.com_60497.png" ) diff --git a/techsupport_bot/commands/grab.py b/techsupport_bot/commands/grab.py index 27099dad..1d278a85 100644 --- a/techsupport_bot/commands/grab.py +++ b/techsupport_bot/commands/grab.py @@ -75,7 +75,7 @@ class Grabber(cogs.BaseCog): SEARCH_LIMIT (int): The max amount of messages to search when grabbing """ - SEARCH_LIMIT = 20 + SEARCH_LIMIT: int = 20 @auxiliary.with_typing @commands.guild_only() diff --git a/techsupport_bot/commands/hangman.py b/techsupport_bot/commands/hangman.py index 07daa687..12300e9c 100644 --- a/techsupport_bot/commands/hangman.py +++ b/techsupport_bot/commands/hangman.py @@ -50,7 +50,7 @@ class HangmanGame: ValueError: A valid alphabetic word wasn't provided """ - HANG_PICS = [ + HANG_PICS: list[str] = [ """ +---+ | | @@ -108,7 +108,7 @@ class HangmanGame: | =========""", ] - FINAL_STEP = len(HANG_PICS) - 1 + FINAL_STEP: int = len(HANG_PICS) - 1 def __init__(self: Self, word: str) -> None: if not word or "_" in word or not word.isalpha(): diff --git a/techsupport_bot/commands/hug.py b/techsupport_bot/commands/hug.py index eae1ffe3..29b157cb 100644 --- a/techsupport_bot/commands/hug.py +++ b/techsupport_bot/commands/hug.py @@ -31,7 +31,7 @@ class Hugger(cogs.BaseCog): """ - HUGS_SELECTION = [ + HUGS_SELECTION: list[str] = [ "{user_giving_hug} hugs {user_to_hug} forever and ever and ever", "{user_giving_hug} wraps arms around {user_to_hug} and clings forever", "{user_giving_hug} hugs {user_to_hug} and gives their hair a sniff", @@ -45,7 +45,7 @@ class Hugger(cogs.BaseCog): "{user_giving_hug} smothers {user_to_hug} with a loving hug", "{user_giving_hug} squeezes {user_to_hug} to death", ] - ICON_URL = ( + ICON_URL: str = ( "https://cdn.icon-icons.com/icons2/1648/PNG/512/10022huggingface_110042.png" ) diff --git a/techsupport_bot/commands/ipinfo.py b/techsupport_bot/commands/ipinfo.py index 5d777e1e..2f147aa8 100644 --- a/techsupport_bot/commands/ipinfo.py +++ b/techsupport_bot/commands/ipinfo.py @@ -29,8 +29,8 @@ class IPInfo(cogs.BaseCog): IP_ICON_URL (str): The URL for the IP info icon """ - API_URL = "https://ipinfo.io" - IP_ICON_URL = ( + API_URL: str = "https://ipinfo.io" + IP_ICON_URL: str = ( "https://cdn.icon-icons.com/icons2/1858/PNG/512/" "iconfinder-dedicatedipaddress-4263513_117864.png" ) diff --git a/techsupport_bot/commands/iss.py b/techsupport_bot/commands/iss.py index a3a89b88..e79f1ef3 100644 --- a/techsupport_bot/commands/iss.py +++ b/techsupport_bot/commands/iss.py @@ -30,8 +30,8 @@ class ISSLocator(cogs.BaseCog): """ - ISS_URL = "http://api.open-notify.org/iss-now.json" - GEO_URL = "https://geocode.xyz/{},{}?geoit=json" + ISS_URL: str = "http://api.open-notify.org/iss-now.json" + GEO_URL: str = "https://geocode.xyz/{},{}?geoit=json" @auxiliary.with_typing @commands.command( diff --git a/techsupport_bot/commands/joke.py b/techsupport_bot/commands/joke.py index 282fd557..4e8f0d5c 100644 --- a/techsupport_bot/commands/joke.py +++ b/techsupport_bot/commands/joke.py @@ -42,7 +42,7 @@ class Joker(cogs.BaseCog): """ - API_URL = "https://v2.jokeapi.dev/joke/Any" + API_URL: str = "https://v2.jokeapi.dev/joke/Any" async def call_api( self: Self, ctx: commands.Context, config: munch.Munch diff --git a/techsupport_bot/commands/kanye.py b/techsupport_bot/commands/kanye.py index ff491224..66e21e34 100644 --- a/techsupport_bot/commands/kanye.py +++ b/techsupport_bot/commands/kanye.py @@ -56,8 +56,8 @@ class KanyeQuotes(cogs.LoopCog): KANYE_PICS (list[str]): The list of Kanye pics to pick from randomly """ - API_URL = "https://api.kanye.rest" - KANYE_PICS = [ + API_URL: str = "https://api.kanye.rest" + KANYE_PICS: list[str] = [ "https://i.imgur.com/ITmTXGz.jpg", "https://i.imgur.com/o8BkPrL.jpg", "https://i.imgur.com/sA5qP3F.jpg", diff --git a/techsupport_bot/commands/lenny.py b/techsupport_bot/commands/lenny.py index cfbb990c..672449a4 100644 --- a/techsupport_bot/commands/lenny.py +++ b/techsupport_bot/commands/lenny.py @@ -30,7 +30,7 @@ class Lenny(cogs.BaseCog): """ - LENNYS_SELECTION = [ + LENNYS_SELECTION: list[str] = [ "( ͡° ͜ʖ ͡°)", "( ͠° ͟ʖ ͡°)", "( ͡ʘ ͜ʖ ͡ʘ)", diff --git a/techsupport_bot/commands/news.py b/techsupport_bot/commands/news.py index 277efe25..5f55aba5 100644 --- a/techsupport_bot/commands/news.py +++ b/techsupport_bot/commands/news.py @@ -82,13 +82,13 @@ class Category(enum.Enum): """ - BUSINESS = "business" - ENTERTAINMENT = "entertainment" - GENERAL = "general" - HEALTH = "health" - SCIENCE = "science" - SPORTS = "sports" - TECH = "technology" + BUSINESS: str = "business" + ENTERTAINMENT: str = "entertainment" + GENERAL: str = "general" + HEALTH: str = "health" + SCIENCE: str = "science" + SPORTS: str = "sports" + TECH: str = "technology" class News(cogs.LoopCog): diff --git a/techsupport_bot/commands/poll.py b/techsupport_bot/commands/poll.py index f2b5ba08..cff9c2ad 100644 --- a/techsupport_bot/commands/poll.py +++ b/techsupport_bot/commands/poll.py @@ -110,9 +110,9 @@ class ReactionPoller(PollGenerator): """ - OPTION_EMOJIS = ["one", "two", "three", "four", "five"] - STOP_EMOJI = "\u26d4" - EXAMPLE_DATA = { + OPTION_EMOJIS: list[str] = ["one", "two", "three", "four", "five"] + STOP_EMOJI: str = "\u26d4" + EXAMPLE_DATA: dict[str, str | list[str] | int] = { "question": "Best ice cream?", "options": ["Chocolate", "Vanilla", "Strawberry", "Cookie Dough", "Other..."], "timeout": 60, diff --git a/techsupport_bot/commands/protect.py b/techsupport_bot/commands/protect.py index 38e6ba17..0a9515ec 100644 --- a/techsupport_bot/commands/protect.py +++ b/techsupport_bot/commands/protect.py @@ -154,14 +154,14 @@ class Protector(cogs.MatchCog): """ - ALERT_ICON_URL = ( + ALERT_ICON_URL: str = ( "https://cdn.icon-icons.com/icons2/2063/PNG/512/" + "alert_danger_warning_notification_icon_124692.png" ) - CLIPBOARD_ICON_URL = ( + CLIPBOARD_ICON_URL: str = ( "https://icon-icons.com/icons2/203/PNG/128/diagram-30_24487.png" ) - CHARS_PER_NEWLINE = 80 + CHARS_PER_NEWLINE: int = 80 async def preconfig(self: Self) -> None: """Method to preconfig the protect.""" diff --git a/techsupport_bot/commands/relay.py b/techsupport_bot/commands/relay.py index 9340183e..dc79bcc5 100644 --- a/techsupport_bot/commands/relay.py +++ b/techsupport_bot/commands/relay.py @@ -47,7 +47,7 @@ class DiscordToIRC(cogs.MatchCog): """ - mapping = None # bidict - discord:irc + mapping: bidict = None # bidict - discord:irc async def preconfig(self: Self) -> None: """The preconfig setup for the discord side diff --git a/techsupport_bot/commands/role.py b/techsupport_bot/commands/role.py index 8c1f5010..3a7c7300 100644 --- a/techsupport_bot/commands/role.py +++ b/techsupport_bot/commands/role.py @@ -72,7 +72,7 @@ def __init__(self: Self, bot: bot.TechSupportBot) -> None: ) self.bot.tree.add_command(self.ctx_menu) - role_group = app_commands.Group(name="role", description="...") + role_group: app_commands.Group = app_commands.Group(name="role", description="...") async def preconfig(self: Self) -> None: """This setups the global lock on the role command, to avoid conflicts""" diff --git a/techsupport_bot/commands/roll.py b/techsupport_bot/commands/roll.py index a729b1a8..bdab039e 100644 --- a/techsupport_bot/commands/roll.py +++ b/techsupport_bot/commands/roll.py @@ -30,7 +30,9 @@ class Roller(cogs.BaseCog): """ - ICON_URL = "https://cdn.icon-icons.com/icons2/1465/PNG/512/678gamedice_100992.png" + ICON_URL: str = ( + "https://cdn.icon-icons.com/icons2/1465/PNG/512/678gamedice_100992.png" + ) @auxiliary.with_typing @commands.command( diff --git a/techsupport_bot/commands/rules.py b/techsupport_bot/commands/rules.py index a33ea914..6fff45a2 100644 --- a/techsupport_bot/commands/rules.py +++ b/techsupport_bot/commands/rules.py @@ -33,7 +33,7 @@ class Rules(cogs.BaseCog): """ - RULE_ICON_URL = ( + RULE_ICON_URL: str = ( "https://cdn.icon-icons.com/icons2/907/PNG" "/512/balance-scale-of-justice_icon-icons.com_70554.png" ) diff --git a/techsupport_bot/commands/translate.py b/techsupport_bot/commands/translate.py index 5151d0de..36e72eb8 100644 --- a/techsupport_bot/commands/translate.py +++ b/techsupport_bot/commands/translate.py @@ -28,7 +28,7 @@ class Translator(cogs.BaseCog): """ - API_URL = "https://api.mymemory.translated.net/get?q={}&langpair={}|{}" + API_URL: str = "https://api.mymemory.translated.net/get?q={}&langpair={}|{}" @auxiliary.with_typing @commands.command( diff --git a/techsupport_bot/commands/urban.py b/techsupport_bot/commands/urban.py index a34eaf78..6f54edd4 100644 --- a/techsupport_bot/commands/urban.py +++ b/techsupport_bot/commands/urban.py @@ -42,9 +42,9 @@ class UrbanDictionary(cogs.BaseCog): """ - BASE_URL = "http://api.urbandictionary.com/v0/define?term=" - SEE_MORE_URL = "https://www.urbandictionary.com/define.php?term=" - ICON_URL = "https://cdn.icon-icons.com/icons2/114/PNG/512/dictionary_19159.png" + BASE_URL: str = "http://api.urbandictionary.com/v0/define?term=" + SEE_MORE_URL: str = "https://www.urbandictionary.com/define.php?term=" + ICON_URL: str = "https://cdn.icon-icons.com/icons2/114/PNG/512/dictionary_19159.png" @auxiliary.with_typing @commands.command( diff --git a/techsupport_bot/commands/wolfram.py b/techsupport_bot/commands/wolfram.py index 9a89fa02..08c9dddc 100644 --- a/techsupport_bot/commands/wolfram.py +++ b/techsupport_bot/commands/wolfram.py @@ -41,8 +41,10 @@ class Wolfram(cogs.BaseCog): """ - API_URL = "http://api.wolframalpha.com/v1/result?appid={}&i={}" - ICON_URL = "https://cdn.icon-icons.com/icons2/2107/PNG/512/file_type_wolfram_icon_130071.png" + API_URL: str = "http://api.wolframalpha.com/v1/result?appid={}&i={}" + ICON_URL: str = ( + "https://cdn.icon-icons.com/icons2/2107/PNG/512/file_type_wolfram_icon_130071.png" + ) @auxiliary.with_typing @commands.command( diff --git a/techsupport_bot/commands/xkcd.py b/techsupport_bot/commands/xkcd.py index 4b10afda..987d3ffa 100644 --- a/techsupport_bot/commands/xkcd.py +++ b/techsupport_bot/commands/xkcd.py @@ -32,8 +32,8 @@ class XKCD(cogs.BaseCog): """ - MOST_RECENT_API_URL = "https://xkcd.com/info.0.json" - SPECIFIC_API_URL = "https://xkcd.com/%s/info.0.json" + MOST_RECENT_API_URL: str = "https://xkcd.com/info.0.json" + SPECIFIC_API_URL: str = "https://xkcd.com/%s/info.0.json" @commands.group( brief="xkcd extension parent", diff --git a/techsupport_bot/core/cogs.py b/techsupport_bot/core/cogs.py index ce05c080..004ae8cc 100644 --- a/techsupport_bot/core/cogs.py +++ b/techsupport_bot/core/cogs.py @@ -29,8 +29,8 @@ class BaseCog(commands.Cog): if it needs to be different than the file name """ - COG_TYPE = "Base" - KEEP_COG_ON_FAILURE = False + COG_TYPE: str = "Base" + KEEP_COG_ON_FAILURE: bool = False def __init__( self: Self, @@ -101,7 +101,7 @@ class MatchCog(BaseCog): COG_TYPE (str): The string representation for the type of cog """ - COG_TYPE = "Match" + COG_TYPE: str = "Match" @commands.Cog.listener() async def on_message(self: Self, message: discord.Message) -> None: diff --git a/techsupport_bot/core/custom_errors.py b/techsupport_bot/core/custom_errors.py index bc23cb1a..f90f7f00 100644 --- a/techsupport_bot/core/custom_errors.py +++ b/techsupport_bot/core/custom_errors.py @@ -79,7 +79,7 @@ class ErrorResponse: dont_print_trace (bool): If true, the stack trace generated will not be logged """ - DEFAULT_MESSAGE = "I ran into an error processing your command" + DEFAULT_MESSAGE: str = "I ran into an error processing your command" def __init__( self: Self, diff --git a/techsupport_bot/core/databases.py b/techsupport_bot/core/databases.py index 32e82994..c30239fb 100644 --- a/techsupport_bot/core/databases.py +++ b/techsupport_bot/core/databases.py @@ -24,7 +24,6 @@ class Applications(bot.db.Model): Currenty used in application.py Attributes: - __tablename__ (str): The name of the table in postgres pk (int): The automatic primary key guild_id (str): The string of the guild ID the application is in applicant_name (str): The name of the user who submitted the app @@ -53,7 +52,6 @@ class ApplicationBans(bot.db.Model): Currently used in application.py and who.py Attributes: - __tablename__ (str): The name of the table in postgres pk (int): The automatic primary key guild_id (str): The string of the guild ID the applicant is banned in applicant_id (str): The string representation of the ID of the user @@ -70,7 +68,6 @@ class DuckUser(bot.db.Model): Currently used in duck.py Attributes: - __tablename__ (str): The name of the table in postgres pk (int): The automatic primary key author_id (str): The string representation of the ID of the user guild_id (str): The string of the guild ID the duckuser has participated in @@ -95,7 +92,6 @@ class Factoid(bot.db.Model): Currently used in factoid.py Attributes: - __tablename__ (str): The name of the table in postgres factoid_id (int): The primary key of the factoid name (str): The name of the factoid guild (str): The string guild ID for the guild that the factoid is in @@ -128,7 +124,6 @@ class FactoidJob(bot.db.Model): Currently used in factoid.py Attributes: - __tablename__ (str): The name of the table in postgres job_id (int): The primary key, ID of the job factoid (int): The primary key of the linked factoid channel (str): The channel this loop needs to run in @@ -149,7 +144,6 @@ class Grab(bot.db.Model): Currently used in grab.py Attributes: - __tablename__ (str): The name of the table in postgres pk (int): The primary key for this database author_id (str): The ID of the author of the original grab message channel (str): The channel the message was grabbed from @@ -174,7 +168,6 @@ class IRCChannelMapping(bot.db.Model): Currently used in relay.py Attributes: - __tablename__ (str): The name of the table in postgres map_id (int): The primary key for the database guild_id (str): The guild where the discord channel exists at discord_channel_id (str): The ID of the discord channel @@ -182,6 +175,7 @@ class IRCChannelMapping(bot.db.Model): """ __tablename__ = "ircchannelmap" + map_id = bot.db.Column(bot.db.Integer, primary_key=True) guild_id = bot.db.Column(bot.db.String, default=None) discord_channel_id = bot.db.Column(bot.db.String, default=None) @@ -192,11 +186,11 @@ class ModmailBan(bot.db.Model): Currently used in modmail.py Attributes: - __tablename__ (str): The name of the table in postgres user_id (str): The ID of the user banned from modmail """ __tablename__ = "modmail_bans" + user_id = bot.db.Column(bot.db.String, default=None, primary_key=True) class UserNote(bot.db.Model): @@ -204,7 +198,6 @@ class UserNote(bot.db.Model): Currently used in who.py Attributes: - __tablename__ (str): The name of the table in postgres pk (int): The primary key for this database user_id (str): The user ID that has a note guild_id (str): The guild ID that the note belongs to @@ -227,7 +220,6 @@ class Warning(bot.db.Model): Currently used in protect.py and who.py Attributes: - __tablename__ (str): The name of the table in postgres pk (int): The primary key for the database user_id (str): The user who got warned guild_id (str): The guild this warn occured in @@ -236,6 +228,7 @@ class Warning(bot.db.Model): """ __tablename__ = "warnings" + pk = bot.db.Column(bot.db.Integer, primary_key=True) user_id = bot.db.Column(bot.db.String) guild_id = bot.db.Column(bot.db.String) @@ -247,7 +240,6 @@ class Config(bot.db.Model): Currently used nearly everywhere Attributes: - __tablename__ (str): The name of the table in postgres pk (int): The primary key for the database guild_id (str): The ID of the guild this config is for config (str): The config text @@ -255,6 +247,7 @@ class Config(bot.db.Model): """ __tablename__ = "guild_config" + pk = bot.db.Column(bot.db.Integer, primary_key=True) guild_id = bot.db.Column(bot.db.String) config = bot.db.Column(bot.db.String) @@ -265,13 +258,13 @@ class Listener(bot.db.Model): Currently used in listen.py Attributes: - __tablename__ (str): The name of the table in postgres pk (int): The primary key for the database src_id (str): The source channel for the listener dst_id (str): The destination channel for the listener """ __tablename__ = "listeners" + pk = bot.db.Column(bot.db.Integer, primary_key=True) src_id = bot.db.Column(bot.db.String) dst_id = bot.db.Column(bot.db.String) @@ -281,13 +274,13 @@ class Rule(bot.db.Model): Currently used in rules.py Attributes: - __tablename__ (str): The name of the table in postgres pk (int): The primary key for the database guild_id (str): The ID of the guild that these rules are for rules (str): The json representation of the rules """ __tablename__ = "guild_rules" + pk = bot.db.Column(bot.db.Integer, primary_key=True) guild_id = bot.db.Column(bot.db.String) rules = bot.db.Column(bot.db.String) @@ -297,7 +290,6 @@ class Votes(bot.db.Model): Currently used in voting.py Attributes: - __tablename__ (str): The name of the table in postgres vote_id (int): The primary key of the vote guild_id (str): The guild the vote belongs to message_id (str): The ID of the message the vote is in @@ -317,6 +309,7 @@ class Votes(bot.db.Model): """ __tablename__ = "voting" + vote_id = bot.db.Column(bot.db.Integer, primary_key=True) guild_id = bot.db.Column(bot.db.String) message_id = bot.db.Column(bot.db.String) diff --git a/techsupport_bot/ircrelay/irc.py b/techsupport_bot/ircrelay/irc.py index eaa1ff41..725f8d36 100644 --- a/techsupport_bot/ircrelay/irc.py +++ b/techsupport_bot/ircrelay/irc.py @@ -9,6 +9,7 @@ import threading from typing import Self +import commands import discord import ib3.auth import irc.bot @@ -40,13 +41,13 @@ class IRCBot(ib3.auth.SASL, irc.bot.SingleServerIRCBot): password (str): The password of the IRC bot account """ - irc_cog = None - loop = None - console = logging.getLogger("root") - IRC_BOLD = "" - connection = None - join_thread = None - ready = False + irc_cog: commands.relay.DiscordToIRC = None + loop: asyncio.AbstractEventLoop = None + console: logging.Logger = logging.getLogger("root") + IRC_BOLD: str = "" + connection: irc.client.ServerConnection = None + join_thread: threading.Timer = None + ready: bool = False def __init__( self: Self, diff --git a/techsupport_bot/tests/commands_tests/test_extensions_wyr.py b/techsupport_bot/tests/commands_tests/test_extensions_wyr.py index 7ea1a94e..d1649039 100644 --- a/techsupport_bot/tests/commands_tests/test_extensions_wyr.py +++ b/techsupport_bot/tests/commands_tests/test_extensions_wyr.py @@ -100,7 +100,7 @@ class Test_Get_Question: sample_resource (str): A set of same questions for doing unit tests """ - sample_resource = '"q1o1" || "q1o2"\n"q2o1" || "q2o2"' + sample_resource: str = '"q1o1" || "q1o2"\n"q2o1" || "q2o2"' def test_any_question(self: Self) -> None: """Ensure that get_question gets any question""" diff --git a/techsupport_bot/ui/application.py b/techsupport_bot/ui/application.py index 9ba674f3..8474a00a 100644 --- a/techsupport_bot/ui/application.py +++ b/techsupport_bot/ui/application.py @@ -17,14 +17,14 @@ class Application(discord.ui.Modal, title="Staff interest form"): reason (discord.ui.TextInput): The reason question for the application """ - background = discord.ui.TextInput( + background: discord.ui.TextInput = discord.ui.TextInput( label="Do you have any IT or programming experience?", style=discord.TextStyle.long, required=True, max_length=300, ) - reason = discord.ui.TextInput( + reason: discord.ui.TextInput = discord.ui.TextInput( label="Why do you want to help here?", style=discord.TextStyle.long, required=True, diff --git a/techsupport_bot/ui/appnotice.py b/techsupport_bot/ui/appnotice.py index 67db84cd..d35bb34b 100644 --- a/techsupport_bot/ui/appnotice.py +++ b/techsupport_bot/ui/appnotice.py @@ -14,7 +14,9 @@ class AppNotice(discord.ui.View): ICON (str): The Icon for the application reminder """ - ICON = "https://icon-icons.com/downloadimage.php?id=14692&root=80/PNG/256/&file=help_15418.png" + ICON: str = ( + "https://icon-icons.com/downloadimage.php?id=14692&root=80/PNG/256/&file=help_15418.png" + ) async def send(self: Self, channel: discord.abc.Messageable, message: str) -> None: """The entry point to this function, will send a message to the given channel From 83c017ed555f87e639157f1ffcd91441bcf05c40 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:38:36 -0400 Subject: [PATCH 06/13] Formatting --- techsupport_bot/commands/application.py | 8 +- techsupport_bot/commands/hangman.py | 2 - techsupport_bot/commands/news.py | 2 +- techsupport_bot/commands/poll.py | 4 +- techsupport_bot/commands/who.py | 2 +- techsupport_bot/core/databases.py | 180 +++++++++++++----------- 6 files changed, 105 insertions(+), 93 deletions(-) diff --git a/techsupport_bot/commands/application.py b/techsupport_bot/commands/application.py index 8005029b..186f5d5c 100644 --- a/techsupport_bot/commands/application.py +++ b/techsupport_bot/commands/application.py @@ -27,10 +27,10 @@ class ApplicationStatus(Enum): REJECTED (str): The string representation for rejected """ - PENDING = "pending" - APPROVED = "approved" - DENIED = "denied" - REJECTED = "rejected" + PENDING: str = "pending" + APPROVED: str = "approved" + DENIED: str = "denied" + REJECTED: str = "rejected" async def setup(bot: bot.TechSupportBot) -> None: diff --git a/techsupport_bot/commands/hangman.py b/techsupport_bot/commands/hangman.py index 12300e9c..7f8d9496 100644 --- a/techsupport_bot/commands/hangman.py +++ b/techsupport_bot/commands/hangman.py @@ -40,8 +40,6 @@ class HangmanGame: Attributes: HANG_PICS (list[str]): The list of hangman pictures FINAL_STEP (int): The last step of the hangman game - finished (bool): Determines if the game has been finished or not - failed (bool): Determines if the players failed to guess the word Args: word (str): The word to start the game with diff --git a/techsupport_bot/commands/news.py b/techsupport_bot/commands/news.py index 5f55aba5..a5959526 100644 --- a/techsupport_bot/commands/news.py +++ b/techsupport_bot/commands/news.py @@ -99,7 +99,7 @@ class News(cogs.LoopCog): """ - API_URL = "http://newsapi.org/v2/top-headlines?apiKey={}&country={}" + API_URL: str = "http://newsapi.org/v2/top-headlines?apiKey={}&country={}" async def preconfig(self: Self) -> None: """Sets up the list of valid categories in a class wide variable""" diff --git a/techsupport_bot/commands/poll.py b/techsupport_bot/commands/poll.py index cff9c2ad..49f06d4d 100644 --- a/techsupport_bot/commands/poll.py +++ b/techsupport_bot/commands/poll.py @@ -319,11 +319,11 @@ class StrawPoller(PollGenerator): """ - EXAMPLE_DATA = { + EXAMPLE_DATA: dict[str, str | list[str]] = { "question": "Best ice cream?", "options": ["Chocolate", "Vanilla", "Strawberry", "Cookie Dough", "Other..."], } - API_URL = "https://strawpoll.com/api/poll" + API_URL: str = "https://strawpoll.com/api/poll" @commands.group( brief="Executes a strawpoll command", diff --git a/techsupport_bot/commands/who.py b/techsupport_bot/commands/who.py index b6f84b5a..36a7a14d 100644 --- a/techsupport_bot/commands/who.py +++ b/techsupport_bot/commands/who.py @@ -69,7 +69,7 @@ class Who(cogs.BaseCog): """ - notes = app_commands.Group( + notes: app_commands.Group = app_commands.Group( name="note", description="Command Group for the Notes Extension" ) diff --git a/techsupport_bot/core/databases.py b/techsupport_bot/core/databases.py index c30239fb..c56ff24f 100644 --- a/techsupport_bot/core/databases.py +++ b/techsupport_bot/core/databases.py @@ -31,19 +31,19 @@ class Applications(bot.db.Model): application_status (str): The string representation of the status background (str): The answer to the background question of the application reason (str): The answer to the reason question of the application - application_time (datetime): The time the application was submitted + application_time (datetime.datetime): The time the application was submitted """ __tablename__ = "applications" - pk = bot.db.Column(bot.db.Integer, primary_key=True, autoincrement=True) - guild_id = bot.db.Column(bot.db.String) - applicant_name = bot.db.Column(bot.db.String) - applicant_id = bot.db.Column(bot.db.String) - application_status = bot.db.Column(bot.db.String) - background = bot.db.Column(bot.db.String) - reason = bot.db.Column(bot.db.String) - application_time = bot.db.Column( + pk: int = bot.db.Column(bot.db.Integer, primary_key=True, autoincrement=True) + guild_id: str = bot.db.Column(bot.db.String) + applicant_name: str = bot.db.Column(bot.db.String) + applicant_id: str = bot.db.Column(bot.db.String) + application_status: str = bot.db.Column(bot.db.String) + background: str = bot.db.Column(bot.db.String) + reason: str = bot.db.Column(bot.db.String) + application_time: datetime.datetime = bot.db.Column( bot.db.DateTime, default=datetime.datetime.utcnow ) @@ -59,9 +59,9 @@ class ApplicationBans(bot.db.Model): __tablename__ = "appbans" - pk = bot.db.Column(bot.db.Integer, primary_key=True, autoincrement=True) - guild_id = bot.db.Column(bot.db.String) - applicant_id = bot.db.Column(bot.db.String) + pk: int = bot.db.Column(bot.db.Integer, primary_key=True, autoincrement=True) + guild_id: str = bot.db.Column(bot.db.String) + applicant_id: str = bot.db.Column(bot.db.String) class DuckUser(bot.db.Model): """The postgres table for ducks @@ -79,13 +79,15 @@ class DuckUser(bot.db.Model): __tablename__ = "duckusers" - pk = bot.db.Column(bot.db.Integer, primary_key=True, autoincrement=True) - author_id = bot.db.Column(bot.db.String) - guild_id = bot.db.Column(bot.db.String) - befriend_count = bot.db.Column(bot.db.Integer, default=0) - kill_count = bot.db.Column(bot.db.Integer, default=0) - updated = bot.db.Column(bot.db.DateTime, default=datetime.datetime.utcnow) - speed_record = bot.db.Column(bot.db.Float, default=80.0) + pk: int = bot.db.Column(bot.db.Integer, primary_key=True, autoincrement=True) + author_id: str = bot.db.Column(bot.db.String) + guild_id: str = bot.db.Column(bot.db.String) + befriend_count: int = bot.db.Column(bot.db.Integer, default=0) + kill_count: int = bot.db.Column(bot.db.Integer, default=0) + updated: datetime.datetime = bot.db.Column( + bot.db.DateTime, default=datetime.datetime.utcnow + ) + speed_record: float = bot.db.Column(bot.db.Float, default=80.0) class Factoid(bot.db.Model): """The postgres table for factoids @@ -107,17 +109,19 @@ class Factoid(bot.db.Model): __tablename__ = "factoids" - factoid_id = bot.db.Column(bot.db.Integer, primary_key=True) - name = bot.db.Column(bot.db.String) - guild = bot.db.Column(bot.db.String) - message = bot.db.Column(bot.db.String) - time = bot.db.Column(bot.db.DateTime, default=datetime.datetime.utcnow) - embed_config = bot.db.Column(bot.db.String, default=None) - hidden = bot.db.Column(bot.db.Boolean, default=False) - protected = bot.db.Column(bot.db.Boolean, default=False) - disabled = bot.db.Column(bot.db.Boolean, default=False) - restricted = bot.db.Column(bot.db.Boolean, default=False) - alias = bot.db.Column(bot.db.String, default=None) + factoid_id: int = bot.db.Column(bot.db.Integer, primary_key=True) + name: str = bot.db.Column(bot.db.String) + guild: str = bot.db.Column(bot.db.String) + message: str = bot.db.Column(bot.db.String) + time: datetime.datetime = bot.db.Column( + bot.db.DateTime, default=datetime.datetime.utcnow + ) + embed_config: str = bot.db.Column(bot.db.String, default=None) + hidden: bool = bot.db.Column(bot.db.Boolean, default=False) + protected: bool = bot.db.Column(bot.db.Boolean, default=False) + disabled: bool = bot.db.Column(bot.db.Boolean, default=False) + restricted: bool = bot.db.Column(bot.db.Boolean, default=False) + alias: str = bot.db.Column(bot.db.String, default=None) class FactoidJob(bot.db.Model): """The postgres table for factoid loops @@ -132,12 +136,12 @@ class FactoidJob(bot.db.Model): __tablename__ = "factoid_jobs" - job_id = bot.db.Column(bot.db.Integer, primary_key=True) - factoid = bot.db.Column( + job_id: int = bot.db.Column(bot.db.Integer, primary_key=True) + factoid: int = bot.db.Column( bot.db.Integer, bot.db.ForeignKey("factoids.factoid_id") ) - channel = bot.db.Column(bot.db.String) - cron = bot.db.Column(bot.db.String) + channel: str = bot.db.Column(bot.db.String) + cron: str = bot.db.Column(bot.db.String) class Grab(bot.db.Model): """The postgres table for grabs @@ -155,13 +159,15 @@ class Grab(bot.db.Model): __tablename__ = "grabs" - pk = bot.db.Column(bot.db.Integer, primary_key=True) - author_id = bot.db.Column(bot.db.String) - channel = bot.db.Column(bot.db.String) - guild = bot.db.Column(bot.db.String) - message = bot.db.Column(bot.db.String) - time = bot.db.Column(bot.db.DateTime, default=datetime.datetime.utcnow) - nsfw = bot.db.Column(bot.db.Boolean, default=False) + pk: int = bot.db.Column(bot.db.Integer, primary_key=True) + author_id: str = bot.db.Column(bot.db.String) + channel: str = bot.db.Column(bot.db.String) + guild: str = bot.db.Column(bot.db.String) + message: str = bot.db.Column(bot.db.String) + time: datetime.datetime = bot.db.Column( + bot.db.DateTime, default=datetime.datetime.utcnow + ) + nsfw: bool = bot.db.Column(bot.db.Boolean, default=False) class IRCChannelMapping(bot.db.Model): """The postgres table for IRC->discord maps @@ -176,10 +182,10 @@ class IRCChannelMapping(bot.db.Model): __tablename__ = "ircchannelmap" - map_id = bot.db.Column(bot.db.Integer, primary_key=True) - guild_id = bot.db.Column(bot.db.String, default=None) - discord_channel_id = bot.db.Column(bot.db.String, default=None) - irc_channel_id = bot.db.Column(bot.db.String, default=None) + map_id: int = bot.db.Column(bot.db.Integer, primary_key=True) + guild_id: str = bot.db.Column(bot.db.String, default=None) + discord_channel_id: str = bot.db.Column(bot.db.String, default=None) + irc_channel_id: str = bot.db.Column(bot.db.String, default=None) class ModmailBan(bot.db.Model): """The postgres table for modmail bans @@ -191,7 +197,7 @@ class ModmailBan(bot.db.Model): __tablename__ = "modmail_bans" - user_id = bot.db.Column(bot.db.String, default=None, primary_key=True) + user_id: str = bot.db.Column(bot.db.String, default=None, primary_key=True) class UserNote(bot.db.Model): """The postgres table for notes @@ -208,12 +214,14 @@ class UserNote(bot.db.Model): __tablename__ = "usernote" - pk = bot.db.Column(bot.db.Integer, primary_key=True, autoincrement=True) - user_id = bot.db.Column(bot.db.String) - guild_id = bot.db.Column(bot.db.String) - updated = bot.db.Column(bot.db.DateTime, default=datetime.datetime.utcnow) - author_id = bot.db.Column(bot.db.String) - body = bot.db.Column(bot.db.String) + pk: int = bot.db.Column(bot.db.Integer, primary_key=True, autoincrement=True) + user_id: str = bot.db.Column(bot.db.String) + guild_id: str = bot.db.Column(bot.db.String) + updated: datetime.datetime = bot.db.Column( + bot.db.DateTime, default=datetime.datetime.utcnow + ) + author_id: str = bot.db.Column(bot.db.String) + body: str = bot.db.Column(bot.db.String) class Warning(bot.db.Model): """The postgres table for warnings @@ -229,11 +237,13 @@ class Warning(bot.db.Model): __tablename__ = "warnings" - pk = bot.db.Column(bot.db.Integer, primary_key=True) - user_id = bot.db.Column(bot.db.String) - guild_id = bot.db.Column(bot.db.String) - reason = bot.db.Column(bot.db.String) - time = bot.db.Column(bot.db.DateTime, default=datetime.datetime.utcnow) + pk: int = bot.db.Column(bot.db.Integer, primary_key=True) + user_id: str = bot.db.Column(bot.db.String) + guild_id: str = bot.db.Column(bot.db.String) + reason: str = bot.db.Column(bot.db.String) + time: datetime.datetime = bot.db.Column( + bot.db.DateTime, default=datetime.datetime.utcnow + ) class Config(bot.db.Model): """The postgres table for guild config @@ -248,10 +258,12 @@ class Config(bot.db.Model): __tablename__ = "guild_config" - pk = bot.db.Column(bot.db.Integer, primary_key=True) - guild_id = bot.db.Column(bot.db.String) - config = bot.db.Column(bot.db.String) - update_time = bot.db.Column(bot.db.DateTime, default=datetime.datetime.utcnow) + pk: int = bot.db.Column(bot.db.Integer, primary_key=True) + guild_id: str = bot.db.Column(bot.db.String) + config: str = bot.db.Column(bot.db.String) + update_time: datetime.datetime = bot.db.Column( + bot.db.DateTime, default=datetime.datetime.utcnow + ) class Listener(bot.db.Model): """The postgres table for listeners @@ -265,9 +277,9 @@ class Listener(bot.db.Model): __tablename__ = "listeners" - pk = bot.db.Column(bot.db.Integer, primary_key=True) - src_id = bot.db.Column(bot.db.String) - dst_id = bot.db.Column(bot.db.String) + pk: int = bot.db.Column(bot.db.Integer, primary_key=True) + src_id: str = bot.db.Column(bot.db.String) + dst_id: str = bot.db.Column(bot.db.String) class Rule(bot.db.Model): """The postgres table for rules @@ -281,9 +293,9 @@ class Rule(bot.db.Model): __tablename__ = "guild_rules" - pk = bot.db.Column(bot.db.Integer, primary_key=True) - guild_id = bot.db.Column(bot.db.String) - rules = bot.db.Column(bot.db.String) + pk: int = bot.db.Column(bot.db.Integer, primary_key=True) + guild_id: str = bot.db.Column(bot.db.String) + rules: str = bot.db.Column(bot.db.String) class Votes(bot.db.Model): """The postgres table for votes @@ -310,22 +322,24 @@ class Votes(bot.db.Model): __tablename__ = "voting" - vote_id = bot.db.Column(bot.db.Integer, primary_key=True) - guild_id = bot.db.Column(bot.db.String) - message_id = bot.db.Column(bot.db.String) - thread_id = bot.db.Column(bot.db.String) - vote_owner_id = bot.db.Column(bot.db.String) - vote_description = bot.db.Column(bot.db.String) - vote_ids_yes = bot.db.Column(bot.db.String, default="") - vote_ids_no = bot.db.Column(bot.db.String, default="") - vote_ids_all = bot.db.Column(bot.db.String, default="") - votes_yes = bot.db.Column(bot.db.Integer, default=0) - votes_no = bot.db.Column(bot.db.Integer, default=0) - votes_total = bot.db.Column(bot.db.Integer, default=0) - start_time = bot.db.Column(bot.db.DateTime, default=datetime.datetime.utcnow) - vote_active = bot.db.Column(bot.db.Boolean, default=True) - blind = bot.db.Column(bot.db.Boolean, default=False) - anonymous = bot.db.Column(bot.db.Boolean, default=False) + vote_id: int = bot.db.Column(bot.db.Integer, primary_key=True) + guild_id: str = bot.db.Column(bot.db.String) + message_id: str = bot.db.Column(bot.db.String) + thread_id: str = bot.db.Column(bot.db.String) + vote_owner_id: str = bot.db.Column(bot.db.String) + vote_description: str = bot.db.Column(bot.db.String) + vote_ids_yes: str = bot.db.Column(bot.db.String, default="") + vote_ids_no: str = bot.db.Column(bot.db.String, default="") + vote_ids_all: str = bot.db.Column(bot.db.String, default="") + votes_yes: int = bot.db.Column(bot.db.Integer, default=0) + votes_no: int = bot.db.Column(bot.db.Integer, default=0) + votes_total: int = bot.db.Column(bot.db.Integer, default=0) + start_time: datetime.datetime = bot.db.Column( + bot.db.DateTime, default=datetime.datetime.utcnow + ) + vote_active: bool = bot.db.Column(bot.db.Boolean, default=True) + blind: bool = bot.db.Column(bot.db.Boolean, default=False) + anonymous: bool = bot.db.Column(bot.db.Boolean, default=False) bot.models.Applications = Applications bot.models.AppBans = ApplicationBans From edf5e7091dd29b7cff1c1bb6c15fabe9c38973f1 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:42:41 -0400 Subject: [PATCH 07/13] Formatting --- techsupport_bot/commands/hangman.py | 2 ++ techsupport_bot/core/databases.py | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/techsupport_bot/commands/hangman.py b/techsupport_bot/commands/hangman.py index 7f8d9496..12300e9c 100644 --- a/techsupport_bot/commands/hangman.py +++ b/techsupport_bot/commands/hangman.py @@ -40,6 +40,8 @@ class HangmanGame: Attributes: HANG_PICS (list[str]): The list of hangman pictures FINAL_STEP (int): The last step of the hangman game + finished (bool): Determines if the game has been finished or not + failed (bool): Determines if the players failed to guess the word Args: word (str): The word to start the game with diff --git a/techsupport_bot/core/databases.py b/techsupport_bot/core/databases.py index c56ff24f..9caf9564 100644 --- a/techsupport_bot/core/databases.py +++ b/techsupport_bot/core/databases.py @@ -73,7 +73,7 @@ class DuckUser(bot.db.Model): guild_id (str): The string of the guild ID the duckuser has participated in befriend_count (int): The amount of ducks the user has befriended kill_count (int): The amount of ducks the user has killed - updated (datetime): The last time the duck user interacted with a duck + updated (datetime.datetime): The last time the duck user interacted with a duck speed_record (float): The fastest this user has killed or friended a duck """ @@ -98,7 +98,7 @@ class Factoid(bot.db.Model): name (str): The name of the factoid guild (str): The string guild ID for the guild that the factoid is in message (str): The string message of the factoid - time (datetime): When the factoid was created NOT edited + time (datetime.datetime): When the factoid was created NOT edited embed_config (str): The json of the factoid hidden (bool): If the factoid should be hidden or not protected (bool): If the factoid should be protected @@ -153,7 +153,7 @@ class Grab(bot.db.Model): channel (str): The channel the message was grabbed from guild (str): The guild the message was grabbed from message (str): The string contents of the message - time (datetime): The time the message was grabbed + time (datetime.datetime): The time the message was grabbed nsfw (bool): Whether the message was grabbed in an NSFW channel """ @@ -207,7 +207,7 @@ class UserNote(bot.db.Model): pk (int): The primary key for this database user_id (str): The user ID that has a note guild_id (str): The guild ID that the note belongs to - updated (datetime): The time the note was created on + updated (datetime.datetime): The time the note was created on author_id (str): The author of the note body (str): The contents of the note """ @@ -232,7 +232,7 @@ class Warning(bot.db.Model): user_id (str): The user who got warned guild_id (str): The guild this warn occured in reason (str): The reason for the warn - time (datetime): The time the warning was given + time (datetime.datetime): The time the warning was given """ __tablename__ = "warnings" @@ -253,7 +253,7 @@ class Config(bot.db.Model): pk (int): The primary key for the database guild_id (str): The ID of the guild this config is for config (str): The config text - update_time (datetime): The time the config was last updated + update_time (datetime.datetime): The time the config was last updated """ __tablename__ = "guild_config" @@ -314,7 +314,7 @@ class Votes(bot.db.Model): votes_yes (int): The number of votes for yes votes_no (int): The number of votes for no votes_total (int): The number of votes - start_time (datetime): The start time of the vote + start_time (datetime.datetime): The start time of the vote vote_active (bool): If the vote is current active or not blind (bool): If the vote needs to be blind anonymous (bool): If the vote needs to be anonymous From de3fd9a1e8fbf5fddb6541bd4b9018b8b5f1f91d Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:45:49 -0400 Subject: [PATCH 08/13] formatting --- techsupport_bot/commands/hangman.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/techsupport_bot/commands/hangman.py b/techsupport_bot/commands/hangman.py index 12300e9c..04c44f6d 100644 --- a/techsupport_bot/commands/hangman.py +++ b/techsupport_bot/commands/hangman.py @@ -40,8 +40,8 @@ class HangmanGame: Attributes: HANG_PICS (list[str]): The list of hangman pictures FINAL_STEP (int): The last step of the hangman game - finished (bool): Determines if the game has been finished or not - failed (bool): Determines if the players failed to guess the word + finished: Determines if the game has been finished or not + failed: Determines if the players failed to guess the word Args: word (str): The word to start the game with From bd4812d7c772e7b2af9b6c902a92f94b8f4f3245 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:47:04 -0400 Subject: [PATCH 09/13] Back to attrs --- techsupport_bot/bot.py | 2 +- techsupport_bot/botlogging/common.py | 4 +-- techsupport_bot/botlogging/embed.py | 10 +++---- techsupport_bot/commands/animal.py | 2 +- techsupport_bot/commands/application.py | 4 +-- techsupport_bot/commands/burn.py | 2 +- techsupport_bot/commands/chatgpt.py | 2 +- techsupport_bot/commands/conch.py | 2 +- techsupport_bot/commands/duck.py | 2 +- techsupport_bot/commands/emoji.py | 2 +- techsupport_bot/commands/extension.py | 2 +- techsupport_bot/commands/factoids.py | 6 ++-- techsupport_bot/commands/giphy.py | 2 +- techsupport_bot/commands/github.py | 2 +- techsupport_bot/commands/google.py | 2 +- techsupport_bot/commands/grab.py | 2 +- techsupport_bot/commands/hangman.py | 6 ++-- techsupport_bot/commands/help.py | 2 +- techsupport_bot/commands/hug.py | 2 +- techsupport_bot/commands/ipinfo.py | 2 +- techsupport_bot/commands/iss.py | 2 +- techsupport_bot/commands/joke.py | 2 +- techsupport_bot/commands/kanye.py | 2 +- techsupport_bot/commands/lenny.py | 2 +- techsupport_bot/commands/news.py | 4 +-- techsupport_bot/commands/poll.py | 4 +-- techsupport_bot/commands/protect.py | 2 +- techsupport_bot/commands/relay.py | 2 +- techsupport_bot/commands/role.py | 2 +- techsupport_bot/commands/roll.py | 2 +- techsupport_bot/commands/rules.py | 2 +- techsupport_bot/commands/spotify.py | 2 +- techsupport_bot/commands/translate.py | 2 +- techsupport_bot/commands/urban.py | 2 +- techsupport_bot/commands/who.py | 2 +- techsupport_bot/commands/winerror.py | 4 +-- techsupport_bot/commands/wolfram.py | 2 +- techsupport_bot/commands/xkcd.py | 2 +- techsupport_bot/core/cogs.py | 6 ++-- techsupport_bot/core/custom_errors.py | 2 +- techsupport_bot/core/databases.py | 28 +++++++++---------- techsupport_bot/ircrelay/irc.py | 2 +- .../commands_tests/test_extensions_wyr.py | 2 +- techsupport_bot/ui/application.py | 2 +- techsupport_bot/ui/appnotice.py | 2 +- techsupport_bot/ui/confirm.py | 2 +- techsupport_bot/ui/pagination.py | 2 +- techsupport_bot/ui/vote_creation.py | 2 +- 48 files changed, 76 insertions(+), 76 deletions(-) diff --git a/techsupport_bot/bot.py b/techsupport_bot/bot.py index b4413f4b..9909e9ed 100644 --- a/techsupport_bot/bot.py +++ b/techsupport_bot/bot.py @@ -39,7 +39,7 @@ class TechSupportBot(commands.Bot): allowed_mentions (discord.AllowedMentions): What the bot is, or is not, allowed to mention - Attributes: + Attrs: CONFIG_PATH (str): The hard coded path to the yaml config file EXTENSIONS_DIR_NAME (str): The hardcoded folder for commands EXTENSIONS_DIR (str): The list of all files in the EXTENSIONS_DIR_NAME folder diff --git a/techsupport_bot/botlogging/common.py b/techsupport_bot/botlogging/common.py index bc231716..895c3c39 100644 --- a/techsupport_bot/botlogging/common.py +++ b/techsupport_bot/botlogging/common.py @@ -12,7 +12,7 @@ class LogLevel(Enum): """This is a way to map log levels to strings, and have the easy ability to dynamically add or remove log levels - Attributes: + Attrs: DEBUG (str): Representation of debug INFO (str): Representation of info WARNING (str): Representation of warning @@ -30,7 +30,7 @@ class LogContext: """A very simple class to store a few contextual items about the log This is used to determine if some guild settings means the log shouldn't be logged - Attributes: + Attrs: guild (discord.Guild | None): The guild the log occured with. Optional channel (discord.abc.Messageable | None): The channel, DM, thread, or other messagable the log occured in diff --git a/techsupport_bot/botlogging/embed.py b/techsupport_bot/botlogging/embed.py index c941eb93..9547c8a6 100644 --- a/techsupport_bot/botlogging/embed.py +++ b/techsupport_bot/botlogging/embed.py @@ -15,7 +15,7 @@ class LogEmbed(discord.Embed): Args: message (str): The message to log. Will become the description of an embed - Attributes: + Attrs: title (str): The title of the embed color (discord.Color): The color of the embed """ @@ -49,7 +49,7 @@ def modify_embed(self: Self, embed: discord.Embed) -> discord.Embed: class InfoEmbed(LogEmbed): """Embed for info level log events. - Attributes: + Attrs: title (str): The title of the embed color (discord.Color): The color of the embed """ @@ -61,7 +61,7 @@ class InfoEmbed(LogEmbed): class DebugEmbed(LogEmbed): """Embed for debug level log events. - Attributes: + Attrs: title (str): The title of the embed color (discord.Color): The color of the embed """ @@ -73,7 +73,7 @@ class DebugEmbed(LogEmbed): class WarningEmbed(LogEmbed): """Embed for warning level log events. - Attributes: + Attrs: title (str): The title of the embed color (discord.Color): The color of the embed """ @@ -85,7 +85,7 @@ class WarningEmbed(LogEmbed): class ErrorEmbed(LogEmbed): """Embed for error level log events. - Attributes: + Attrs: title (str): The title of the embed color (discord.Color): The color of the embed """ diff --git a/techsupport_bot/commands/animal.py b/techsupport_bot/commands/animal.py index 9062b583..a8d1da9b 100644 --- a/techsupport_bot/commands/animal.py +++ b/techsupport_bot/commands/animal.py @@ -24,7 +24,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Animals(cogs.BaseCog): """The class for the animals commands - Attributes: + Attrs: CAT_API_URL (str): The URL for the cat API DOG_API_URL (str): The URL for the dog API FOX_API_URL (str): The URL for the fox API diff --git a/techsupport_bot/commands/application.py b/techsupport_bot/commands/application.py index 186f5d5c..58820ec9 100644 --- a/techsupport_bot/commands/application.py +++ b/techsupport_bot/commands/application.py @@ -20,7 +20,7 @@ class ApplicationStatus(Enum): """Static string mapping of all status This is so the database can always be consistent - Attributes: + Attrs: PENDING (str): The string representation for pending APPROVED (str): The string representation for approved DENIED (str): The string representation for denied @@ -198,7 +198,7 @@ async def wait(self: Self, config: munch.Munch, guild: discord.Guild) -> None: class ApplicationManager(cogs.LoopCog): """This cog is responsible for the majority of functions in the application system - Attributes: + Attrs: application_group (app_commands.Group): The group for the /application commands """ diff --git a/techsupport_bot/commands/burn.py b/techsupport_bot/commands/burn.py index 8d0c3b46..d8932a64 100644 --- a/techsupport_bot/commands/burn.py +++ b/techsupport_bot/commands/burn.py @@ -29,7 +29,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Burn(cogs.BaseCog): """Class for Burn command on the discord bot. - Attributes: + Attrs: PHRASES (list[str]): The list of phrases to pick from """ diff --git a/techsupport_bot/commands/chatgpt.py b/techsupport_bot/commands/chatgpt.py index 8628af51..f1379000 100644 --- a/techsupport_bot/commands/chatgpt.py +++ b/techsupport_bot/commands/chatgpt.py @@ -48,7 +48,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class ChatGPT(cogs.BaseCog): """Main extension class - Attributes: + Attrs: API_URL (str): The URL for the openai API SYSTEM_PROMPT (dict[str, str]): The default starting prompt for chatGPT """ diff --git a/techsupport_bot/commands/conch.py b/techsupport_bot/commands/conch.py index a574e53b..9344ed09 100644 --- a/techsupport_bot/commands/conch.py +++ b/techsupport_bot/commands/conch.py @@ -29,7 +29,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class MagicConch(cogs.BaseCog): """Class to create the conch command for discord bot. - Attributes: + Attrs: RESPONSES (list[str]): The list of random responses for the 8 ball PIC_URL (str): The direct URL for the picture to put in embeds diff --git a/techsupport_bot/commands/duck.py b/techsupport_bot/commands/duck.py index 1f7cdfe2..6683a842 100644 --- a/techsupport_bot/commands/duck.py +++ b/techsupport_bot/commands/duck.py @@ -93,7 +93,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class DuckHunt(cogs.LoopCog): """Class for the actual duck commands - Attributes: + Attrs: DUCK_PIC_URL (str): The picture for the duck BEFRIEND_URL (str): The picture for the befriend target KILL_URL (str): The picture for the kill target diff --git a/techsupport_bot/commands/emoji.py b/techsupport_bot/commands/emoji.py index 56d496d7..37f62e84 100644 --- a/techsupport_bot/commands/emoji.py +++ b/techsupport_bot/commands/emoji.py @@ -31,7 +31,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Emojis(cogs.BaseCog): """Class for all the emoji commands - Attributes: + Attrs: KEY_MAP (dict[str,str]): Some manual mappings from character to emoji """ diff --git a/techsupport_bot/commands/extension.py b/techsupport_bot/commands/extension.py index 7891a58d..9ab50b31 100644 --- a/techsupport_bot/commands/extension.py +++ b/techsupport_bot/commands/extension.py @@ -37,7 +37,7 @@ class ExtensionControl(cogs.BaseCog): """ The class that holds the extension commands - Attributes: + Attrs: extension_app_command_group (app_commands.Group): The group for the /extension commands """ diff --git a/techsupport_bot/commands/factoids.py b/techsupport_bot/commands/factoids.py index d8261863..866b3d23 100644 --- a/techsupport_bot/commands/factoids.py +++ b/techsupport_bot/commands/factoids.py @@ -168,7 +168,7 @@ class CalledFactoid: """A class to allow keeping the original factoid name in tact Without having to call the database lookup function every time - Attributes: + Attrs: original_call_str (str): The original name the user provided for a factoid factoid_db_entry (bot.models.Factoid): The database entry for the original factoid """ @@ -181,7 +181,7 @@ class Properties(Enum): """ This enum is for the new factoid all to be able to handle dynamic properties - Attributes: + Attrs: HIDDEN (str): Representation of hidden DISABLED (str): Representation of disabled RESTRICTED (str): Representation of restricted @@ -198,7 +198,7 @@ class FactoidManager(cogs.MatchCog): """ Manages all factoid features - Attributes: + Attrs: CRON_REGEX (str): The regex to check if a cronjob is correct factoid_app_group (app_commands.Group): Group for /factoid commands """ diff --git a/techsupport_bot/commands/giphy.py b/techsupport_bot/commands/giphy.py index 9f2b276a..7b755c0a 100644 --- a/techsupport_bot/commands/giphy.py +++ b/techsupport_bot/commands/giphy.py @@ -35,7 +35,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Giphy(cogs.BaseCog): """Class for the giphy extension. - Attributes: + Attrs: GIPHY_URL (str): The URL for the giphy API SEARCH_LIMIT (int): The max amount of gifs to search for """ diff --git a/techsupport_bot/commands/github.py b/techsupport_bot/commands/github.py index e0e34f55..dcbe4804 100644 --- a/techsupport_bot/commands/github.py +++ b/techsupport_bot/commands/github.py @@ -50,7 +50,7 @@ class IssueCreator(cogs.BaseCog): """ The class that holds the issue commands - Attributes: + Attrs: GITHUB_API_BASE_URL (str): The URL for the github API """ diff --git a/techsupport_bot/commands/google.py b/techsupport_bot/commands/google.py index 75db5fac..b7153553 100644 --- a/techsupport_bot/commands/google.py +++ b/techsupport_bot/commands/google.py @@ -47,7 +47,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Googler(cogs.BaseCog): """Class for the google extension for the discord bot. - Attributes: + Attrs: GOOGLE_URL (str): The API URL for google search YOUTUBE_URL (str): The API URL for youtube search ICON_URL (str): The google icon diff --git a/techsupport_bot/commands/grab.py b/techsupport_bot/commands/grab.py index 1d278a85..b23c25be 100644 --- a/techsupport_bot/commands/grab.py +++ b/techsupport_bot/commands/grab.py @@ -71,7 +71,7 @@ async def invalid_channel(ctx: commands.Context) -> bool: class Grabber(cogs.BaseCog): """Class for the actual commands - Attributes: + Attrs: SEARCH_LIMIT (int): The max amount of messages to search when grabbing """ diff --git a/techsupport_bot/commands/hangman.py b/techsupport_bot/commands/hangman.py index 04c44f6d..58c42ef3 100644 --- a/techsupport_bot/commands/hangman.py +++ b/techsupport_bot/commands/hangman.py @@ -37,11 +37,11 @@ async def setup(bot: bot.TechSupportBot) -> None: class HangmanGame: """Class for the game hangman. - Attributes: + Attrs: HANG_PICS (list[str]): The list of hangman pictures FINAL_STEP (int): The last step of the hangman game - finished: Determines if the game has been finished or not - failed: Determines if the players failed to guess the word + finished : Determines if the game has been finished or not + failed : Determines if the players failed to guess the word Args: word (str): The word to start the game with diff --git a/techsupport_bot/commands/help.py b/techsupport_bot/commands/help.py index 3752f15f..edc77f3a 100644 --- a/techsupport_bot/commands/help.py +++ b/techsupport_bot/commands/help.py @@ -21,7 +21,7 @@ class PrintableCommand: """A custom class to store formatted information about a command With a priority on being sortable and searchable - Attributes: + Attrs: prefix (str): The prefix to call the command with name (str): The command name usage (str): The usage hints for the command diff --git a/techsupport_bot/commands/hug.py b/techsupport_bot/commands/hug.py index 29b157cb..06753a82 100644 --- a/techsupport_bot/commands/hug.py +++ b/techsupport_bot/commands/hug.py @@ -25,7 +25,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Hugger(cogs.BaseCog): """Class to make the hug command. - Attributes: + Attrs: HUGS_SELECTION (list[str]): The list of hug phrases to display ICON_URL (str): The icon to use when hugging diff --git a/techsupport_bot/commands/ipinfo.py b/techsupport_bot/commands/ipinfo.py index 2f147aa8..020f9c27 100644 --- a/techsupport_bot/commands/ipinfo.py +++ b/techsupport_bot/commands/ipinfo.py @@ -24,7 +24,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class IPInfo(cogs.BaseCog): """Class to add ipinfo geodata to the bot. - Attributes: + Attrs: API_URL (str): The API url for IP info IP_ICON_URL (str): The URL for the IP info icon """ diff --git a/techsupport_bot/commands/iss.py b/techsupport_bot/commands/iss.py index e79f1ef3..db25ef24 100644 --- a/techsupport_bot/commands/iss.py +++ b/techsupport_bot/commands/iss.py @@ -24,7 +24,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class ISSLocator(cogs.BaseCog): """Class to locate the ISS at its current position. - Attributes: + Attrs: ISS_URL (str): The API URL to get the location of the ISS GEO_URL (str): The API URL to turn lat/lon to location diff --git a/techsupport_bot/commands/joke.py b/techsupport_bot/commands/joke.py index 4e8f0d5c..ea63d5a0 100644 --- a/techsupport_bot/commands/joke.py +++ b/techsupport_bot/commands/joke.py @@ -37,7 +37,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Joker(cogs.BaseCog): """Class to make up the joke extension. - Attributes: + Attrs: API_URL (str): The joke API URL """ diff --git a/techsupport_bot/commands/kanye.py b/techsupport_bot/commands/kanye.py index 66e21e34..f48c0dfd 100644 --- a/techsupport_bot/commands/kanye.py +++ b/techsupport_bot/commands/kanye.py @@ -51,7 +51,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class KanyeQuotes(cogs.LoopCog): """Class to get the Kanye quotes from the api. - Attributes: + Attrs: API_URL (str): The Kanye API URL KANYE_PICS (list[str]): The list of Kanye pics to pick from randomly """ diff --git a/techsupport_bot/commands/lenny.py b/techsupport_bot/commands/lenny.py index 672449a4..c2f146ec 100644 --- a/techsupport_bot/commands/lenny.py +++ b/techsupport_bot/commands/lenny.py @@ -25,7 +25,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Lenny(cogs.BaseCog): """Class for lenny extension. - Attributes: + Attrs: LENNYS_SELECTION (list[str]): The list of lenny faces to pick one randomly """ diff --git a/techsupport_bot/commands/news.py b/techsupport_bot/commands/news.py index a5959526..652d5830 100644 --- a/techsupport_bot/commands/news.py +++ b/techsupport_bot/commands/news.py @@ -71,7 +71,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Category(enum.Enum): """Class to set up categories for the news. - Attributes: + Attrs: BUSINESS (str): The string representation for business ENTERTAINMENT (str): The string representation for entertainment GENERAL (str): The string representation for general @@ -94,7 +94,7 @@ class Category(enum.Enum): class News(cogs.LoopCog): """Class to set up the news extension for the discord bot. - Attributes: + Attrs: API_URL (str): The news API URL """ diff --git a/techsupport_bot/commands/poll.py b/techsupport_bot/commands/poll.py index 49f06d4d..26303b8b 100644 --- a/techsupport_bot/commands/poll.py +++ b/techsupport_bot/commands/poll.py @@ -103,7 +103,7 @@ async def validate_data( class ReactionPoller(PollGenerator): """Class to add reactions to the poll generator. - Attributes: + Attrs: OPTION_EMOJIS (list[str]): The list of emojis to react to the message with STOP_EMOJI (str): The stop emoji to reaction to the message with EXAMPLE_DATA (dict[str, str | list[str] | int]): The example poll that the bot can use @@ -313,7 +313,7 @@ async def wait_for_results( class StrawPoller(PollGenerator): """Class to create a straw poll from discord. - Attributes: + Attrs: EXAMPLE_DATA (dict[str, str | list[str]]): The example poll that the bot can use API_URL (str): The strawpoll API URL diff --git a/techsupport_bot/commands/protect.py b/techsupport_bot/commands/protect.py index 0a9515ec..447a2d7e 100644 --- a/techsupport_bot/commands/protect.py +++ b/techsupport_bot/commands/protect.py @@ -147,7 +147,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Protector(cogs.MatchCog): """Class for the protector command. - Attributes: + Attrs: ALERT_ICON_URL (str): The icon for the alert messages CLIPBOARD_ICON_URL (str): The icon for the paste messages CHARS_PER_NEWLINE (int): The arbitrary length of a line diff --git a/techsupport_bot/commands/relay.py b/techsupport_bot/commands/relay.py index dc79bcc5..45686ae7 100644 --- a/techsupport_bot/commands/relay.py +++ b/techsupport_bot/commands/relay.py @@ -42,7 +42,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class DiscordToIRC(cogs.MatchCog): """The discord side of the relay - Attributes: + Attrs: mapping (bidict): The dict that holds the IRC and discord mappings """ diff --git a/techsupport_bot/commands/role.py b/techsupport_bot/commands/role.py index 3a7c7300..893ea560 100644 --- a/techsupport_bot/commands/role.py +++ b/techsupport_bot/commands/role.py @@ -56,7 +56,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class RoleGiver(cogs.BaseCog): """The main class for the role commands - Attributes: + Attrs: role_group (app_commands.Group): The group for the /role commands Args: diff --git a/techsupport_bot/commands/roll.py b/techsupport_bot/commands/roll.py index bdab039e..2dabbe87 100644 --- a/techsupport_bot/commands/roll.py +++ b/techsupport_bot/commands/roll.py @@ -25,7 +25,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Roller(cogs.BaseCog): """Class for the roll command for the extension. - Attributes: + Attrs: ICON_URL (str): The URL for the dice icon """ diff --git a/techsupport_bot/commands/rules.py b/techsupport_bot/commands/rules.py index 6fff45a2..22d96243 100644 --- a/techsupport_bot/commands/rules.py +++ b/techsupport_bot/commands/rules.py @@ -28,7 +28,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Rules(cogs.BaseCog): """Class to define the rules for the extension. - Attributes: + Attrs: RULE_ICON_URL (str): The icon to use for the rules """ diff --git a/techsupport_bot/commands/spotify.py b/techsupport_bot/commands/spotify.py index 2b67314e..e121ac84 100644 --- a/techsupport_bot/commands/spotify.py +++ b/techsupport_bot/commands/spotify.py @@ -38,7 +38,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Spotify(cogs.BaseCog): """Class for setting up the Spotify extension. - Attributes: + Attrs: AUTH_URL: The URL for the authentication API for spotify API_URL: The URL for the search spotify API diff --git a/techsupport_bot/commands/translate.py b/techsupport_bot/commands/translate.py index 36e72eb8..ec89ba6d 100644 --- a/techsupport_bot/commands/translate.py +++ b/techsupport_bot/commands/translate.py @@ -23,7 +23,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Translator(cogs.BaseCog): """Class to set up the translate extension. - Attributes: + Attrs: API_URL (str): The translated API URL """ diff --git a/techsupport_bot/commands/urban.py b/techsupport_bot/commands/urban.py index 6f54edd4..92b23ce7 100644 --- a/techsupport_bot/commands/urban.py +++ b/techsupport_bot/commands/urban.py @@ -35,7 +35,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class UrbanDictionary(cogs.BaseCog): """Class for setting up the urban dictionary extension. - Attributes: + Attrs: BASE_URL (str): The base API URL for urban dict SEE_MORE_URL (str): The URL to link to search results from the API ICON_URL (str): The urban dict icon URL diff --git a/techsupport_bot/commands/who.py b/techsupport_bot/commands/who.py index 36a7a14d..bf9631bd 100644 --- a/techsupport_bot/commands/who.py +++ b/techsupport_bot/commands/who.py @@ -64,7 +64,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Who(cogs.BaseCog): """Class to set up who for the extension. - Attributes: + Attrs: notes (app_commands.Group): The group for the /note commands """ diff --git a/techsupport_bot/commands/winerror.py b/techsupport_bot/commands/winerror.py index 537c850c..be34294c 100644 --- a/techsupport_bot/commands/winerror.py +++ b/techsupport_bot/commands/winerror.py @@ -30,7 +30,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Error: """The data to pull for the error. - Attributes: + Attrs: name (str): the name of the error source (str): the header file where the error is from description (str): the description of the error @@ -46,7 +46,7 @@ class ErrorCategory: """A category of errors, based on how the error was found This contains the name of the category and a list of errors - Attributes: + Attrs: name (str): The name of the category of errors errors (list[Error]): The list of errors in the category diff --git a/techsupport_bot/commands/wolfram.py b/techsupport_bot/commands/wolfram.py index 08c9dddc..35b26e4b 100644 --- a/techsupport_bot/commands/wolfram.py +++ b/techsupport_bot/commands/wolfram.py @@ -35,7 +35,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Wolfram(cogs.BaseCog): """Class to set up the wolfram extension. - Attributes: + Attrs: API_URL (str): The API URL for wolfram ICON_URL (str): The URL for the wolfram icon diff --git a/techsupport_bot/commands/xkcd.py b/techsupport_bot/commands/xkcd.py index 987d3ffa..8ff2fd6e 100644 --- a/techsupport_bot/commands/xkcd.py +++ b/techsupport_bot/commands/xkcd.py @@ -26,7 +26,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class XKCD(cogs.BaseCog): """Class to create the xkcd for the extension. - Attributes: + Attrs: MOST_RECENT_API_URL (str): The URL for the most recent comic SPECIFIC_API_URL (str): The URL for a given number comic diff --git a/techsupport_bot/core/cogs.py b/techsupport_bot/core/cogs.py index 004ae8cc..daf3727c 100644 --- a/techsupport_bot/core/cogs.py +++ b/techsupport_bot/core/cogs.py @@ -18,7 +18,7 @@ class BaseCog(commands.Cog): """The base cog to use when making extensions. - Attributes: + Attrs: COG_TYPE (str): The string representation for the type of cog KEEP_COG_ON_FAILURE (bool): Whether or not to keep the cog loaded if there was an error @@ -97,7 +97,7 @@ class MatchCog(BaseCog): This makes the process of handling events simpler for development. - Attributes: + Attrs: COG_TYPE (str): The string representation for the type of cog """ @@ -182,7 +182,7 @@ class LoopCog(BaseCog): This currently doesn't utilize the tasks library. - Attributes: + Attrs: COG_TYPE (str): The string representation for the type of cog DEFAULT_WAIT (int): The default time to sleep for TRACKER_WAIT (int): The time to wait before looking for new channels diff --git a/techsupport_bot/core/custom_errors.py b/techsupport_bot/core/custom_errors.py index f90f7f00..4cd61f62 100644 --- a/techsupport_bot/core/custom_errors.py +++ b/techsupport_bot/core/custom_errors.py @@ -70,7 +70,7 @@ def __init__(self: Self, wait: int) -> None: class ErrorResponse: """Object for generating a custom error message from an exception. - Attributes: + Attrs: DEFAULT_MESSAGE (str): The default error message for unclassified errors Args: diff --git a/techsupport_bot/core/databases.py b/techsupport_bot/core/databases.py index 9caf9564..070f7033 100644 --- a/techsupport_bot/core/databases.py +++ b/techsupport_bot/core/databases.py @@ -23,7 +23,7 @@ class Applications(bot.db.Model): """The postgres table for applications Currenty used in application.py - Attributes: + Attrs: pk (int): The automatic primary key guild_id (str): The string of the guild ID the application is in applicant_name (str): The name of the user who submitted the app @@ -51,7 +51,7 @@ class ApplicationBans(bot.db.Model): """The postgres table for users banned from applications Currently used in application.py and who.py - Attributes: + Attrs: pk (int): The automatic primary key guild_id (str): The string of the guild ID the applicant is banned in applicant_id (str): The string representation of the ID of the user @@ -67,7 +67,7 @@ class DuckUser(bot.db.Model): """The postgres table for ducks Currently used in duck.py - Attributes: + Attrs: pk (int): The automatic primary key author_id (str): The string representation of the ID of the user guild_id (str): The string of the guild ID the duckuser has participated in @@ -93,7 +93,7 @@ class Factoid(bot.db.Model): """The postgres table for factoids Currently used in factoid.py - Attributes: + Attrs: factoid_id (int): The primary key of the factoid name (str): The name of the factoid guild (str): The string guild ID for the guild that the factoid is in @@ -127,7 +127,7 @@ class FactoidJob(bot.db.Model): """The postgres table for factoid loops Currently used in factoid.py - Attributes: + Attrs: job_id (int): The primary key, ID of the job factoid (int): The primary key of the linked factoid channel (str): The channel this loop needs to run in @@ -147,7 +147,7 @@ class Grab(bot.db.Model): """The postgres table for grabs Currently used in grab.py - Attributes: + Attrs: pk (int): The primary key for this database author_id (str): The ID of the author of the original grab message channel (str): The channel the message was grabbed from @@ -173,7 +173,7 @@ class IRCChannelMapping(bot.db.Model): """The postgres table for IRC->discord maps Currently used in relay.py - Attributes: + Attrs: map_id (int): The primary key for the database guild_id (str): The guild where the discord channel exists at discord_channel_id (str): The ID of the discord channel @@ -191,7 +191,7 @@ class ModmailBan(bot.db.Model): """The postgres table for modmail bans Currently used in modmail.py - Attributes: + Attrs: user_id (str): The ID of the user banned from modmail """ @@ -203,7 +203,7 @@ class UserNote(bot.db.Model): """The postgres table for notes Currently used in who.py - Attributes: + Attrs: pk (int): The primary key for this database user_id (str): The user ID that has a note guild_id (str): The guild ID that the note belongs to @@ -227,7 +227,7 @@ class Warning(bot.db.Model): """The postgres table for warnings Currently used in protect.py and who.py - Attributes: + Attrs: pk (int): The primary key for the database user_id (str): The user who got warned guild_id (str): The guild this warn occured in @@ -249,7 +249,7 @@ class Config(bot.db.Model): """The postgres table for guild config Currently used nearly everywhere - Attributes: + Attrs: pk (int): The primary key for the database guild_id (str): The ID of the guild this config is for config (str): The config text @@ -269,7 +269,7 @@ class Listener(bot.db.Model): """The postgres table for listeners Currently used in listen.py - Attributes: + Attrs: pk (int): The primary key for the database src_id (str): The source channel for the listener dst_id (str): The destination channel for the listener @@ -285,7 +285,7 @@ class Rule(bot.db.Model): """The postgres table for rules Currently used in rules.py - Attributes: + Attrs: pk (int): The primary key for the database guild_id (str): The ID of the guild that these rules are for rules (str): The json representation of the rules @@ -301,7 +301,7 @@ class Votes(bot.db.Model): """The postgres table for votes Currently used in voting.py - Attributes: + Attrs: vote_id (int): The primary key of the vote guild_id (str): The guild the vote belongs to message_id (str): The ID of the message the vote is in diff --git a/techsupport_bot/ircrelay/irc.py b/techsupport_bot/ircrelay/irc.py index 725f8d36..6d59555f 100644 --- a/techsupport_bot/ircrelay/irc.py +++ b/techsupport_bot/ircrelay/irc.py @@ -22,7 +22,7 @@ class IRCBot(ib3.auth.SASL, irc.bot.SingleServerIRCBot): """The IRC bot class. This is the class that runs the entire IRC side of the bot The class to start the entire IRC bot - Attributes: + Attrs: irc_cog (commands.relay.DiscordToIRC): The discord cog for the relay, to allow communication between loop (asyncio.AbstractEventLoop): The discord bots event loop diff --git a/techsupport_bot/tests/commands_tests/test_extensions_wyr.py b/techsupport_bot/tests/commands_tests/test_extensions_wyr.py index d1649039..093abf94 100644 --- a/techsupport_bot/tests/commands_tests/test_extensions_wyr.py +++ b/techsupport_bot/tests/commands_tests/test_extensions_wyr.py @@ -96,7 +96,7 @@ async def test_wyr_command_send(self: Self) -> None: class Test_Get_Question: """A set of tests to test the get_question function - Attributes: + Attrs: sample_resource (str): A set of same questions for doing unit tests """ diff --git a/techsupport_bot/ui/application.py b/techsupport_bot/ui/application.py index 8474a00a..155f1c67 100644 --- a/techsupport_bot/ui/application.py +++ b/techsupport_bot/ui/application.py @@ -12,7 +12,7 @@ class Application(discord.ui.Modal, title="Staff interest form"): """The class contianing the modal and all variables for it This must be sent as a response to an interaction, cannot be from a prefix command - Attributes: + Attrs: background (discord.ui.TextInput): The background question for the application reason (discord.ui.TextInput): The reason question for the application """ diff --git a/techsupport_bot/ui/appnotice.py b/techsupport_bot/ui/appnotice.py index d35bb34b..fce26e60 100644 --- a/techsupport_bot/ui/appnotice.py +++ b/techsupport_bot/ui/appnotice.py @@ -10,7 +10,7 @@ class AppNotice(discord.ui.View): """The view containing a button and message encouraging users to apply - Attributes: + Attrs: ICON (str): The Icon for the application reminder """ diff --git a/techsupport_bot/ui/confirm.py b/techsupport_bot/ui/confirm.py index 2aa5e721..a8fd988c 100644 --- a/techsupport_bot/ui/confirm.py +++ b/techsupport_bot/ui/confirm.py @@ -12,7 +12,7 @@ class ConfirmResponse(Enum): """A class to define the 3 responses - Attributes: + Attrs: CONFIRMED (int): The original author clicked the "confirm" button DENIED (int): The original author clicked the "cancel" button TIMEOUT (int): No buttons were pressed in the timeout range diff --git a/techsupport_bot/ui/pagination.py b/techsupport_bot/ui/pagination.py index 874290f7..2b520882 100644 --- a/techsupport_bot/ui/pagination.py +++ b/techsupport_bot/ui/pagination.py @@ -14,7 +14,7 @@ class PaginateView(discord.ui.View): To use this, call the send function. Everything else is automatic - Attributes: + Attrs: current_page (int): The current page number the user is on data (list[str | discord.Embed]): The list of data for the pages timeout (int): The timeout till the buttons dissapear without interaction diff --git a/techsupport_bot/ui/vote_creation.py b/techsupport_bot/ui/vote_creation.py index 823054a7..0d401fba 100644 --- a/techsupport_bot/ui/vote_creation.py +++ b/techsupport_bot/ui/vote_creation.py @@ -12,7 +12,7 @@ class VoteCreation(discord.ui.Modal, title="Staff voting"): """The class contianing the modal and all variables for it This must be sent as a response to an interaction, cannot be from a prefix command - Attributes: + Attrs: vote_short (discord.TextInput): The title to make the forum thread for the vote vote_reason (discord.TextInput): The main body of the vote """ From 5aabe8da22e14129e0da265ef0b167799d1d0ea2 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:52:46 -0400 Subject: [PATCH 10/13] undo --- techsupport_bot/bot.py | 2 +- techsupport_bot/botlogging/common.py | 4 +-- techsupport_bot/botlogging/embed.py | 10 +++---- techsupport_bot/commands/animal.py | 2 +- techsupport_bot/commands/application.py | 4 +-- techsupport_bot/commands/burn.py | 2 +- techsupport_bot/commands/chatgpt.py | 2 +- techsupport_bot/commands/conch.py | 2 +- techsupport_bot/commands/duck.py | 2 +- techsupport_bot/commands/emoji.py | 2 +- techsupport_bot/commands/extension.py | 2 +- techsupport_bot/commands/factoids.py | 6 ++-- techsupport_bot/commands/giphy.py | 2 +- techsupport_bot/commands/github.py | 2 +- techsupport_bot/commands/google.py | 2 +- techsupport_bot/commands/grab.py | 2 +- techsupport_bot/commands/hangman.py | 2 +- techsupport_bot/commands/help.py | 2 +- techsupport_bot/commands/hug.py | 2 +- techsupport_bot/commands/ipinfo.py | 2 +- techsupport_bot/commands/iss.py | 2 +- techsupport_bot/commands/joke.py | 2 +- techsupport_bot/commands/kanye.py | 2 +- techsupport_bot/commands/lenny.py | 2 +- techsupport_bot/commands/news.py | 4 +-- techsupport_bot/commands/poll.py | 4 +-- techsupport_bot/commands/protect.py | 2 +- techsupport_bot/commands/relay.py | 2 +- techsupport_bot/commands/role.py | 2 +- techsupport_bot/commands/roll.py | 2 +- techsupport_bot/commands/rules.py | 2 +- techsupport_bot/commands/spotify.py | 2 +- techsupport_bot/commands/translate.py | 2 +- techsupport_bot/commands/urban.py | 2 +- techsupport_bot/commands/who.py | 2 +- techsupport_bot/commands/winerror.py | 4 +-- techsupport_bot/commands/wolfram.py | 2 +- techsupport_bot/commands/xkcd.py | 2 +- techsupport_bot/core/cogs.py | 6 ++-- techsupport_bot/core/custom_errors.py | 2 +- techsupport_bot/core/databases.py | 28 +++++++++---------- techsupport_bot/ircrelay/irc.py | 2 +- .../commands_tests/test_extensions_wyr.py | 2 +- techsupport_bot/ui/application.py | 2 +- techsupport_bot/ui/appnotice.py | 2 +- techsupport_bot/ui/confirm.py | 2 +- techsupport_bot/ui/pagination.py | 2 +- techsupport_bot/ui/vote_creation.py | 2 +- 48 files changed, 74 insertions(+), 74 deletions(-) diff --git a/techsupport_bot/bot.py b/techsupport_bot/bot.py index 9909e9ed..b4413f4b 100644 --- a/techsupport_bot/bot.py +++ b/techsupport_bot/bot.py @@ -39,7 +39,7 @@ class TechSupportBot(commands.Bot): allowed_mentions (discord.AllowedMentions): What the bot is, or is not, allowed to mention - Attrs: + Attributes: CONFIG_PATH (str): The hard coded path to the yaml config file EXTENSIONS_DIR_NAME (str): The hardcoded folder for commands EXTENSIONS_DIR (str): The list of all files in the EXTENSIONS_DIR_NAME folder diff --git a/techsupport_bot/botlogging/common.py b/techsupport_bot/botlogging/common.py index 895c3c39..bc231716 100644 --- a/techsupport_bot/botlogging/common.py +++ b/techsupport_bot/botlogging/common.py @@ -12,7 +12,7 @@ class LogLevel(Enum): """This is a way to map log levels to strings, and have the easy ability to dynamically add or remove log levels - Attrs: + Attributes: DEBUG (str): Representation of debug INFO (str): Representation of info WARNING (str): Representation of warning @@ -30,7 +30,7 @@ class LogContext: """A very simple class to store a few contextual items about the log This is used to determine if some guild settings means the log shouldn't be logged - Attrs: + Attributes: guild (discord.Guild | None): The guild the log occured with. Optional channel (discord.abc.Messageable | None): The channel, DM, thread, or other messagable the log occured in diff --git a/techsupport_bot/botlogging/embed.py b/techsupport_bot/botlogging/embed.py index 9547c8a6..c941eb93 100644 --- a/techsupport_bot/botlogging/embed.py +++ b/techsupport_bot/botlogging/embed.py @@ -15,7 +15,7 @@ class LogEmbed(discord.Embed): Args: message (str): The message to log. Will become the description of an embed - Attrs: + Attributes: title (str): The title of the embed color (discord.Color): The color of the embed """ @@ -49,7 +49,7 @@ def modify_embed(self: Self, embed: discord.Embed) -> discord.Embed: class InfoEmbed(LogEmbed): """Embed for info level log events. - Attrs: + Attributes: title (str): The title of the embed color (discord.Color): The color of the embed """ @@ -61,7 +61,7 @@ class InfoEmbed(LogEmbed): class DebugEmbed(LogEmbed): """Embed for debug level log events. - Attrs: + Attributes: title (str): The title of the embed color (discord.Color): The color of the embed """ @@ -73,7 +73,7 @@ class DebugEmbed(LogEmbed): class WarningEmbed(LogEmbed): """Embed for warning level log events. - Attrs: + Attributes: title (str): The title of the embed color (discord.Color): The color of the embed """ @@ -85,7 +85,7 @@ class WarningEmbed(LogEmbed): class ErrorEmbed(LogEmbed): """Embed for error level log events. - Attrs: + Attributes: title (str): The title of the embed color (discord.Color): The color of the embed """ diff --git a/techsupport_bot/commands/animal.py b/techsupport_bot/commands/animal.py index a8d1da9b..9062b583 100644 --- a/techsupport_bot/commands/animal.py +++ b/techsupport_bot/commands/animal.py @@ -24,7 +24,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Animals(cogs.BaseCog): """The class for the animals commands - Attrs: + Attributes: CAT_API_URL (str): The URL for the cat API DOG_API_URL (str): The URL for the dog API FOX_API_URL (str): The URL for the fox API diff --git a/techsupport_bot/commands/application.py b/techsupport_bot/commands/application.py index 58820ec9..186f5d5c 100644 --- a/techsupport_bot/commands/application.py +++ b/techsupport_bot/commands/application.py @@ -20,7 +20,7 @@ class ApplicationStatus(Enum): """Static string mapping of all status This is so the database can always be consistent - Attrs: + Attributes: PENDING (str): The string representation for pending APPROVED (str): The string representation for approved DENIED (str): The string representation for denied @@ -198,7 +198,7 @@ async def wait(self: Self, config: munch.Munch, guild: discord.Guild) -> None: class ApplicationManager(cogs.LoopCog): """This cog is responsible for the majority of functions in the application system - Attrs: + Attributes: application_group (app_commands.Group): The group for the /application commands """ diff --git a/techsupport_bot/commands/burn.py b/techsupport_bot/commands/burn.py index d8932a64..8d0c3b46 100644 --- a/techsupport_bot/commands/burn.py +++ b/techsupport_bot/commands/burn.py @@ -29,7 +29,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Burn(cogs.BaseCog): """Class for Burn command on the discord bot. - Attrs: + Attributes: PHRASES (list[str]): The list of phrases to pick from """ diff --git a/techsupport_bot/commands/chatgpt.py b/techsupport_bot/commands/chatgpt.py index f1379000..8628af51 100644 --- a/techsupport_bot/commands/chatgpt.py +++ b/techsupport_bot/commands/chatgpt.py @@ -48,7 +48,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class ChatGPT(cogs.BaseCog): """Main extension class - Attrs: + Attributes: API_URL (str): The URL for the openai API SYSTEM_PROMPT (dict[str, str]): The default starting prompt for chatGPT """ diff --git a/techsupport_bot/commands/conch.py b/techsupport_bot/commands/conch.py index 9344ed09..a574e53b 100644 --- a/techsupport_bot/commands/conch.py +++ b/techsupport_bot/commands/conch.py @@ -29,7 +29,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class MagicConch(cogs.BaseCog): """Class to create the conch command for discord bot. - Attrs: + Attributes: RESPONSES (list[str]): The list of random responses for the 8 ball PIC_URL (str): The direct URL for the picture to put in embeds diff --git a/techsupport_bot/commands/duck.py b/techsupport_bot/commands/duck.py index 6683a842..1f7cdfe2 100644 --- a/techsupport_bot/commands/duck.py +++ b/techsupport_bot/commands/duck.py @@ -93,7 +93,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class DuckHunt(cogs.LoopCog): """Class for the actual duck commands - Attrs: + Attributes: DUCK_PIC_URL (str): The picture for the duck BEFRIEND_URL (str): The picture for the befriend target KILL_URL (str): The picture for the kill target diff --git a/techsupport_bot/commands/emoji.py b/techsupport_bot/commands/emoji.py index 37f62e84..56d496d7 100644 --- a/techsupport_bot/commands/emoji.py +++ b/techsupport_bot/commands/emoji.py @@ -31,7 +31,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Emojis(cogs.BaseCog): """Class for all the emoji commands - Attrs: + Attributes: KEY_MAP (dict[str,str]): Some manual mappings from character to emoji """ diff --git a/techsupport_bot/commands/extension.py b/techsupport_bot/commands/extension.py index 9ab50b31..7891a58d 100644 --- a/techsupport_bot/commands/extension.py +++ b/techsupport_bot/commands/extension.py @@ -37,7 +37,7 @@ class ExtensionControl(cogs.BaseCog): """ The class that holds the extension commands - Attrs: + Attributes: extension_app_command_group (app_commands.Group): The group for the /extension commands """ diff --git a/techsupport_bot/commands/factoids.py b/techsupport_bot/commands/factoids.py index 866b3d23..d8261863 100644 --- a/techsupport_bot/commands/factoids.py +++ b/techsupport_bot/commands/factoids.py @@ -168,7 +168,7 @@ class CalledFactoid: """A class to allow keeping the original factoid name in tact Without having to call the database lookup function every time - Attrs: + Attributes: original_call_str (str): The original name the user provided for a factoid factoid_db_entry (bot.models.Factoid): The database entry for the original factoid """ @@ -181,7 +181,7 @@ class Properties(Enum): """ This enum is for the new factoid all to be able to handle dynamic properties - Attrs: + Attributes: HIDDEN (str): Representation of hidden DISABLED (str): Representation of disabled RESTRICTED (str): Representation of restricted @@ -198,7 +198,7 @@ class FactoidManager(cogs.MatchCog): """ Manages all factoid features - Attrs: + Attributes: CRON_REGEX (str): The regex to check if a cronjob is correct factoid_app_group (app_commands.Group): Group for /factoid commands """ diff --git a/techsupport_bot/commands/giphy.py b/techsupport_bot/commands/giphy.py index 7b755c0a..9f2b276a 100644 --- a/techsupport_bot/commands/giphy.py +++ b/techsupport_bot/commands/giphy.py @@ -35,7 +35,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Giphy(cogs.BaseCog): """Class for the giphy extension. - Attrs: + Attributes: GIPHY_URL (str): The URL for the giphy API SEARCH_LIMIT (int): The max amount of gifs to search for """ diff --git a/techsupport_bot/commands/github.py b/techsupport_bot/commands/github.py index dcbe4804..e0e34f55 100644 --- a/techsupport_bot/commands/github.py +++ b/techsupport_bot/commands/github.py @@ -50,7 +50,7 @@ class IssueCreator(cogs.BaseCog): """ The class that holds the issue commands - Attrs: + Attributes: GITHUB_API_BASE_URL (str): The URL for the github API """ diff --git a/techsupport_bot/commands/google.py b/techsupport_bot/commands/google.py index b7153553..75db5fac 100644 --- a/techsupport_bot/commands/google.py +++ b/techsupport_bot/commands/google.py @@ -47,7 +47,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Googler(cogs.BaseCog): """Class for the google extension for the discord bot. - Attrs: + Attributes: GOOGLE_URL (str): The API URL for google search YOUTUBE_URL (str): The API URL for youtube search ICON_URL (str): The google icon diff --git a/techsupport_bot/commands/grab.py b/techsupport_bot/commands/grab.py index b23c25be..1d278a85 100644 --- a/techsupport_bot/commands/grab.py +++ b/techsupport_bot/commands/grab.py @@ -71,7 +71,7 @@ async def invalid_channel(ctx: commands.Context) -> bool: class Grabber(cogs.BaseCog): """Class for the actual commands - Attrs: + Attributes: SEARCH_LIMIT (int): The max amount of messages to search when grabbing """ diff --git a/techsupport_bot/commands/hangman.py b/techsupport_bot/commands/hangman.py index 58c42ef3..3ea1b509 100644 --- a/techsupport_bot/commands/hangman.py +++ b/techsupport_bot/commands/hangman.py @@ -37,7 +37,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class HangmanGame: """Class for the game hangman. - Attrs: + Attributes: HANG_PICS (list[str]): The list of hangman pictures FINAL_STEP (int): The last step of the hangman game finished : Determines if the game has been finished or not diff --git a/techsupport_bot/commands/help.py b/techsupport_bot/commands/help.py index edc77f3a..3752f15f 100644 --- a/techsupport_bot/commands/help.py +++ b/techsupport_bot/commands/help.py @@ -21,7 +21,7 @@ class PrintableCommand: """A custom class to store formatted information about a command With a priority on being sortable and searchable - Attrs: + Attributes: prefix (str): The prefix to call the command with name (str): The command name usage (str): The usage hints for the command diff --git a/techsupport_bot/commands/hug.py b/techsupport_bot/commands/hug.py index 06753a82..29b157cb 100644 --- a/techsupport_bot/commands/hug.py +++ b/techsupport_bot/commands/hug.py @@ -25,7 +25,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Hugger(cogs.BaseCog): """Class to make the hug command. - Attrs: + Attributes: HUGS_SELECTION (list[str]): The list of hug phrases to display ICON_URL (str): The icon to use when hugging diff --git a/techsupport_bot/commands/ipinfo.py b/techsupport_bot/commands/ipinfo.py index 020f9c27..2f147aa8 100644 --- a/techsupport_bot/commands/ipinfo.py +++ b/techsupport_bot/commands/ipinfo.py @@ -24,7 +24,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class IPInfo(cogs.BaseCog): """Class to add ipinfo geodata to the bot. - Attrs: + Attributes: API_URL (str): The API url for IP info IP_ICON_URL (str): The URL for the IP info icon """ diff --git a/techsupport_bot/commands/iss.py b/techsupport_bot/commands/iss.py index db25ef24..e79f1ef3 100644 --- a/techsupport_bot/commands/iss.py +++ b/techsupport_bot/commands/iss.py @@ -24,7 +24,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class ISSLocator(cogs.BaseCog): """Class to locate the ISS at its current position. - Attrs: + Attributes: ISS_URL (str): The API URL to get the location of the ISS GEO_URL (str): The API URL to turn lat/lon to location diff --git a/techsupport_bot/commands/joke.py b/techsupport_bot/commands/joke.py index ea63d5a0..4e8f0d5c 100644 --- a/techsupport_bot/commands/joke.py +++ b/techsupport_bot/commands/joke.py @@ -37,7 +37,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Joker(cogs.BaseCog): """Class to make up the joke extension. - Attrs: + Attributes: API_URL (str): The joke API URL """ diff --git a/techsupport_bot/commands/kanye.py b/techsupport_bot/commands/kanye.py index f48c0dfd..66e21e34 100644 --- a/techsupport_bot/commands/kanye.py +++ b/techsupport_bot/commands/kanye.py @@ -51,7 +51,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class KanyeQuotes(cogs.LoopCog): """Class to get the Kanye quotes from the api. - Attrs: + Attributes: API_URL (str): The Kanye API URL KANYE_PICS (list[str]): The list of Kanye pics to pick from randomly """ diff --git a/techsupport_bot/commands/lenny.py b/techsupport_bot/commands/lenny.py index c2f146ec..672449a4 100644 --- a/techsupport_bot/commands/lenny.py +++ b/techsupport_bot/commands/lenny.py @@ -25,7 +25,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Lenny(cogs.BaseCog): """Class for lenny extension. - Attrs: + Attributes: LENNYS_SELECTION (list[str]): The list of lenny faces to pick one randomly """ diff --git a/techsupport_bot/commands/news.py b/techsupport_bot/commands/news.py index 652d5830..a5959526 100644 --- a/techsupport_bot/commands/news.py +++ b/techsupport_bot/commands/news.py @@ -71,7 +71,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Category(enum.Enum): """Class to set up categories for the news. - Attrs: + Attributes: BUSINESS (str): The string representation for business ENTERTAINMENT (str): The string representation for entertainment GENERAL (str): The string representation for general @@ -94,7 +94,7 @@ class Category(enum.Enum): class News(cogs.LoopCog): """Class to set up the news extension for the discord bot. - Attrs: + Attributes: API_URL (str): The news API URL """ diff --git a/techsupport_bot/commands/poll.py b/techsupport_bot/commands/poll.py index 26303b8b..49f06d4d 100644 --- a/techsupport_bot/commands/poll.py +++ b/techsupport_bot/commands/poll.py @@ -103,7 +103,7 @@ async def validate_data( class ReactionPoller(PollGenerator): """Class to add reactions to the poll generator. - Attrs: + Attributes: OPTION_EMOJIS (list[str]): The list of emojis to react to the message with STOP_EMOJI (str): The stop emoji to reaction to the message with EXAMPLE_DATA (dict[str, str | list[str] | int]): The example poll that the bot can use @@ -313,7 +313,7 @@ async def wait_for_results( class StrawPoller(PollGenerator): """Class to create a straw poll from discord. - Attrs: + Attributes: EXAMPLE_DATA (dict[str, str | list[str]]): The example poll that the bot can use API_URL (str): The strawpoll API URL diff --git a/techsupport_bot/commands/protect.py b/techsupport_bot/commands/protect.py index 447a2d7e..0a9515ec 100644 --- a/techsupport_bot/commands/protect.py +++ b/techsupport_bot/commands/protect.py @@ -147,7 +147,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Protector(cogs.MatchCog): """Class for the protector command. - Attrs: + Attributes: ALERT_ICON_URL (str): The icon for the alert messages CLIPBOARD_ICON_URL (str): The icon for the paste messages CHARS_PER_NEWLINE (int): The arbitrary length of a line diff --git a/techsupport_bot/commands/relay.py b/techsupport_bot/commands/relay.py index 45686ae7..dc79bcc5 100644 --- a/techsupport_bot/commands/relay.py +++ b/techsupport_bot/commands/relay.py @@ -42,7 +42,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class DiscordToIRC(cogs.MatchCog): """The discord side of the relay - Attrs: + Attributes: mapping (bidict): The dict that holds the IRC and discord mappings """ diff --git a/techsupport_bot/commands/role.py b/techsupport_bot/commands/role.py index 893ea560..3a7c7300 100644 --- a/techsupport_bot/commands/role.py +++ b/techsupport_bot/commands/role.py @@ -56,7 +56,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class RoleGiver(cogs.BaseCog): """The main class for the role commands - Attrs: + Attributes: role_group (app_commands.Group): The group for the /role commands Args: diff --git a/techsupport_bot/commands/roll.py b/techsupport_bot/commands/roll.py index 2dabbe87..bdab039e 100644 --- a/techsupport_bot/commands/roll.py +++ b/techsupport_bot/commands/roll.py @@ -25,7 +25,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Roller(cogs.BaseCog): """Class for the roll command for the extension. - Attrs: + Attributes: ICON_URL (str): The URL for the dice icon """ diff --git a/techsupport_bot/commands/rules.py b/techsupport_bot/commands/rules.py index 22d96243..6fff45a2 100644 --- a/techsupport_bot/commands/rules.py +++ b/techsupport_bot/commands/rules.py @@ -28,7 +28,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Rules(cogs.BaseCog): """Class to define the rules for the extension. - Attrs: + Attributes: RULE_ICON_URL (str): The icon to use for the rules """ diff --git a/techsupport_bot/commands/spotify.py b/techsupport_bot/commands/spotify.py index e121ac84..2b67314e 100644 --- a/techsupport_bot/commands/spotify.py +++ b/techsupport_bot/commands/spotify.py @@ -38,7 +38,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Spotify(cogs.BaseCog): """Class for setting up the Spotify extension. - Attrs: + Attributes: AUTH_URL: The URL for the authentication API for spotify API_URL: The URL for the search spotify API diff --git a/techsupport_bot/commands/translate.py b/techsupport_bot/commands/translate.py index ec89ba6d..36e72eb8 100644 --- a/techsupport_bot/commands/translate.py +++ b/techsupport_bot/commands/translate.py @@ -23,7 +23,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Translator(cogs.BaseCog): """Class to set up the translate extension. - Attrs: + Attributes: API_URL (str): The translated API URL """ diff --git a/techsupport_bot/commands/urban.py b/techsupport_bot/commands/urban.py index 92b23ce7..6f54edd4 100644 --- a/techsupport_bot/commands/urban.py +++ b/techsupport_bot/commands/urban.py @@ -35,7 +35,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class UrbanDictionary(cogs.BaseCog): """Class for setting up the urban dictionary extension. - Attrs: + Attributes: BASE_URL (str): The base API URL for urban dict SEE_MORE_URL (str): The URL to link to search results from the API ICON_URL (str): The urban dict icon URL diff --git a/techsupport_bot/commands/who.py b/techsupport_bot/commands/who.py index bf9631bd..36a7a14d 100644 --- a/techsupport_bot/commands/who.py +++ b/techsupport_bot/commands/who.py @@ -64,7 +64,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Who(cogs.BaseCog): """Class to set up who for the extension. - Attrs: + Attributes: notes (app_commands.Group): The group for the /note commands """ diff --git a/techsupport_bot/commands/winerror.py b/techsupport_bot/commands/winerror.py index be34294c..537c850c 100644 --- a/techsupport_bot/commands/winerror.py +++ b/techsupport_bot/commands/winerror.py @@ -30,7 +30,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Error: """The data to pull for the error. - Attrs: + Attributes: name (str): the name of the error source (str): the header file where the error is from description (str): the description of the error @@ -46,7 +46,7 @@ class ErrorCategory: """A category of errors, based on how the error was found This contains the name of the category and a list of errors - Attrs: + Attributes: name (str): The name of the category of errors errors (list[Error]): The list of errors in the category diff --git a/techsupport_bot/commands/wolfram.py b/techsupport_bot/commands/wolfram.py index 35b26e4b..08c9dddc 100644 --- a/techsupport_bot/commands/wolfram.py +++ b/techsupport_bot/commands/wolfram.py @@ -35,7 +35,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class Wolfram(cogs.BaseCog): """Class to set up the wolfram extension. - Attrs: + Attributes: API_URL (str): The API URL for wolfram ICON_URL (str): The URL for the wolfram icon diff --git a/techsupport_bot/commands/xkcd.py b/techsupport_bot/commands/xkcd.py index 8ff2fd6e..987d3ffa 100644 --- a/techsupport_bot/commands/xkcd.py +++ b/techsupport_bot/commands/xkcd.py @@ -26,7 +26,7 @@ async def setup(bot: bot.TechSupportBot) -> None: class XKCD(cogs.BaseCog): """Class to create the xkcd for the extension. - Attrs: + Attributes: MOST_RECENT_API_URL (str): The URL for the most recent comic SPECIFIC_API_URL (str): The URL for a given number comic diff --git a/techsupport_bot/core/cogs.py b/techsupport_bot/core/cogs.py index daf3727c..004ae8cc 100644 --- a/techsupport_bot/core/cogs.py +++ b/techsupport_bot/core/cogs.py @@ -18,7 +18,7 @@ class BaseCog(commands.Cog): """The base cog to use when making extensions. - Attrs: + Attributes: COG_TYPE (str): The string representation for the type of cog KEEP_COG_ON_FAILURE (bool): Whether or not to keep the cog loaded if there was an error @@ -97,7 +97,7 @@ class MatchCog(BaseCog): This makes the process of handling events simpler for development. - Attrs: + Attributes: COG_TYPE (str): The string representation for the type of cog """ @@ -182,7 +182,7 @@ class LoopCog(BaseCog): This currently doesn't utilize the tasks library. - Attrs: + Attributes: COG_TYPE (str): The string representation for the type of cog DEFAULT_WAIT (int): The default time to sleep for TRACKER_WAIT (int): The time to wait before looking for new channels diff --git a/techsupport_bot/core/custom_errors.py b/techsupport_bot/core/custom_errors.py index 4cd61f62..f90f7f00 100644 --- a/techsupport_bot/core/custom_errors.py +++ b/techsupport_bot/core/custom_errors.py @@ -70,7 +70,7 @@ def __init__(self: Self, wait: int) -> None: class ErrorResponse: """Object for generating a custom error message from an exception. - Attrs: + Attributes: DEFAULT_MESSAGE (str): The default error message for unclassified errors Args: diff --git a/techsupport_bot/core/databases.py b/techsupport_bot/core/databases.py index 070f7033..9caf9564 100644 --- a/techsupport_bot/core/databases.py +++ b/techsupport_bot/core/databases.py @@ -23,7 +23,7 @@ class Applications(bot.db.Model): """The postgres table for applications Currenty used in application.py - Attrs: + Attributes: pk (int): The automatic primary key guild_id (str): The string of the guild ID the application is in applicant_name (str): The name of the user who submitted the app @@ -51,7 +51,7 @@ class ApplicationBans(bot.db.Model): """The postgres table for users banned from applications Currently used in application.py and who.py - Attrs: + Attributes: pk (int): The automatic primary key guild_id (str): The string of the guild ID the applicant is banned in applicant_id (str): The string representation of the ID of the user @@ -67,7 +67,7 @@ class DuckUser(bot.db.Model): """The postgres table for ducks Currently used in duck.py - Attrs: + Attributes: pk (int): The automatic primary key author_id (str): The string representation of the ID of the user guild_id (str): The string of the guild ID the duckuser has participated in @@ -93,7 +93,7 @@ class Factoid(bot.db.Model): """The postgres table for factoids Currently used in factoid.py - Attrs: + Attributes: factoid_id (int): The primary key of the factoid name (str): The name of the factoid guild (str): The string guild ID for the guild that the factoid is in @@ -127,7 +127,7 @@ class FactoidJob(bot.db.Model): """The postgres table for factoid loops Currently used in factoid.py - Attrs: + Attributes: job_id (int): The primary key, ID of the job factoid (int): The primary key of the linked factoid channel (str): The channel this loop needs to run in @@ -147,7 +147,7 @@ class Grab(bot.db.Model): """The postgres table for grabs Currently used in grab.py - Attrs: + Attributes: pk (int): The primary key for this database author_id (str): The ID of the author of the original grab message channel (str): The channel the message was grabbed from @@ -173,7 +173,7 @@ class IRCChannelMapping(bot.db.Model): """The postgres table for IRC->discord maps Currently used in relay.py - Attrs: + Attributes: map_id (int): The primary key for the database guild_id (str): The guild where the discord channel exists at discord_channel_id (str): The ID of the discord channel @@ -191,7 +191,7 @@ class ModmailBan(bot.db.Model): """The postgres table for modmail bans Currently used in modmail.py - Attrs: + Attributes: user_id (str): The ID of the user banned from modmail """ @@ -203,7 +203,7 @@ class UserNote(bot.db.Model): """The postgres table for notes Currently used in who.py - Attrs: + Attributes: pk (int): The primary key for this database user_id (str): The user ID that has a note guild_id (str): The guild ID that the note belongs to @@ -227,7 +227,7 @@ class Warning(bot.db.Model): """The postgres table for warnings Currently used in protect.py and who.py - Attrs: + Attributes: pk (int): The primary key for the database user_id (str): The user who got warned guild_id (str): The guild this warn occured in @@ -249,7 +249,7 @@ class Config(bot.db.Model): """The postgres table for guild config Currently used nearly everywhere - Attrs: + Attributes: pk (int): The primary key for the database guild_id (str): The ID of the guild this config is for config (str): The config text @@ -269,7 +269,7 @@ class Listener(bot.db.Model): """The postgres table for listeners Currently used in listen.py - Attrs: + Attributes: pk (int): The primary key for the database src_id (str): The source channel for the listener dst_id (str): The destination channel for the listener @@ -285,7 +285,7 @@ class Rule(bot.db.Model): """The postgres table for rules Currently used in rules.py - Attrs: + Attributes: pk (int): The primary key for the database guild_id (str): The ID of the guild that these rules are for rules (str): The json representation of the rules @@ -301,7 +301,7 @@ class Votes(bot.db.Model): """The postgres table for votes Currently used in voting.py - Attrs: + Attributes: vote_id (int): The primary key of the vote guild_id (str): The guild the vote belongs to message_id (str): The ID of the message the vote is in diff --git a/techsupport_bot/ircrelay/irc.py b/techsupport_bot/ircrelay/irc.py index 6d59555f..725f8d36 100644 --- a/techsupport_bot/ircrelay/irc.py +++ b/techsupport_bot/ircrelay/irc.py @@ -22,7 +22,7 @@ class IRCBot(ib3.auth.SASL, irc.bot.SingleServerIRCBot): """The IRC bot class. This is the class that runs the entire IRC side of the bot The class to start the entire IRC bot - Attrs: + Attributes: irc_cog (commands.relay.DiscordToIRC): The discord cog for the relay, to allow communication between loop (asyncio.AbstractEventLoop): The discord bots event loop diff --git a/techsupport_bot/tests/commands_tests/test_extensions_wyr.py b/techsupport_bot/tests/commands_tests/test_extensions_wyr.py index 093abf94..d1649039 100644 --- a/techsupport_bot/tests/commands_tests/test_extensions_wyr.py +++ b/techsupport_bot/tests/commands_tests/test_extensions_wyr.py @@ -96,7 +96,7 @@ async def test_wyr_command_send(self: Self) -> None: class Test_Get_Question: """A set of tests to test the get_question function - Attrs: + Attributes: sample_resource (str): A set of same questions for doing unit tests """ diff --git a/techsupport_bot/ui/application.py b/techsupport_bot/ui/application.py index 155f1c67..8474a00a 100644 --- a/techsupport_bot/ui/application.py +++ b/techsupport_bot/ui/application.py @@ -12,7 +12,7 @@ class Application(discord.ui.Modal, title="Staff interest form"): """The class contianing the modal and all variables for it This must be sent as a response to an interaction, cannot be from a prefix command - Attrs: + Attributes: background (discord.ui.TextInput): The background question for the application reason (discord.ui.TextInput): The reason question for the application """ diff --git a/techsupport_bot/ui/appnotice.py b/techsupport_bot/ui/appnotice.py index fce26e60..d35bb34b 100644 --- a/techsupport_bot/ui/appnotice.py +++ b/techsupport_bot/ui/appnotice.py @@ -10,7 +10,7 @@ class AppNotice(discord.ui.View): """The view containing a button and message encouraging users to apply - Attrs: + Attributes: ICON (str): The Icon for the application reminder """ diff --git a/techsupport_bot/ui/confirm.py b/techsupport_bot/ui/confirm.py index a8fd988c..2aa5e721 100644 --- a/techsupport_bot/ui/confirm.py +++ b/techsupport_bot/ui/confirm.py @@ -12,7 +12,7 @@ class ConfirmResponse(Enum): """A class to define the 3 responses - Attrs: + Attributes: CONFIRMED (int): The original author clicked the "confirm" button DENIED (int): The original author clicked the "cancel" button TIMEOUT (int): No buttons were pressed in the timeout range diff --git a/techsupport_bot/ui/pagination.py b/techsupport_bot/ui/pagination.py index 2b520882..874290f7 100644 --- a/techsupport_bot/ui/pagination.py +++ b/techsupport_bot/ui/pagination.py @@ -14,7 +14,7 @@ class PaginateView(discord.ui.View): To use this, call the send function. Everything else is automatic - Attrs: + Attributes: current_page (int): The current page number the user is on data (list[str | discord.Embed]): The list of data for the pages timeout (int): The timeout till the buttons dissapear without interaction diff --git a/techsupport_bot/ui/vote_creation.py b/techsupport_bot/ui/vote_creation.py index 0d401fba..823054a7 100644 --- a/techsupport_bot/ui/vote_creation.py +++ b/techsupport_bot/ui/vote_creation.py @@ -12,7 +12,7 @@ class VoteCreation(discord.ui.Modal, title="Staff voting"): """The class contianing the modal and all variables for it This must be sent as a response to an interaction, cannot be from a prefix command - Attrs: + Attributes: vote_short (discord.TextInput): The title to make the forum thread for the vote vote_reason (discord.TextInput): The main body of the vote """ From 0b4d62b19e31ee2e6e27c673259f2d501fcbac2b Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:57:24 -0400 Subject: [PATCH 11/13] Move properties --- techsupport_bot/commands/hangman.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/techsupport_bot/commands/hangman.py b/techsupport_bot/commands/hangman.py index 3ea1b509..ff7d78da 100644 --- a/techsupport_bot/commands/hangman.py +++ b/techsupport_bot/commands/hangman.py @@ -40,8 +40,10 @@ class HangmanGame: Attributes: HANG_PICS (list[str]): The list of hangman pictures FINAL_STEP (int): The last step of the hangman game - finished : Determines if the game has been finished or not - failed : Determines if the players failed to guess the word + + Properties: + finished (bool): Determines if the game has been finished or not + failed (bool): Determines if the players failed to guess the word Args: word (str): The word to start the game with From 77aa2f57fd606b71d2cdc4b953d91cf69be27b29 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:58:53 -0400 Subject: [PATCH 12/13] Back to attrs --- techsupport_bot/commands/hangman.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/techsupport_bot/commands/hangman.py b/techsupport_bot/commands/hangman.py index ff7d78da..12300e9c 100644 --- a/techsupport_bot/commands/hangman.py +++ b/techsupport_bot/commands/hangman.py @@ -40,8 +40,6 @@ class HangmanGame: Attributes: HANG_PICS (list[str]): The list of hangman pictures FINAL_STEP (int): The last step of the hangman game - - Properties: finished (bool): Determines if the game has been finished or not failed (bool): Determines if the players failed to guess the word From 5ff44a34cbe5e1b75503cc2e2c9b8782d4e91843 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Thu, 25 Jul 2024 19:00:10 -0400 Subject: [PATCH 13/13] Ignore conflicting pydoclint stuff --- .flake8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index c24d03d6..48b31fad 100644 --- a/.flake8 +++ b/.flake8 @@ -1,4 +1,4 @@ [flake8] -ignore = DCO010, DCO023, E203, E501, E712, F401, F403, F821, W503 +ignore = DCO010, DCO023, DOC602, DOC603, E203, E501, E712, F401, F403, F821, W503 style = google skip-checking-short-docstrings = False \ No newline at end of file