Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ajax146 committed Jul 25, 2024
1 parent 0a28035 commit 68ce9cd
Show file tree
Hide file tree
Showing 41 changed files with 118 additions and 111 deletions.
10 changes: 5 additions & 5 deletions techsupport_bot/botlogging/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
"""

Expand Down
20 changes: 10 additions & 10 deletions techsupport_bot/botlogging/embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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()
1 change: 1 addition & 0 deletions techsupport_bot/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
from .linter import *
from .listen import *
from .mock import *
from .relay import *
from .roll import *
from .wyr import *
8 changes: 4 additions & 4 deletions techsupport_bot/commands/animal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion techsupport_bot/commands/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
)

Expand Down
2 changes: 1 addition & 1 deletion techsupport_bot/commands/burn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!",
Expand Down
4 changes: 2 additions & 2 deletions techsupport_bot/commands/chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -62,7 +62,7 @@ async def preconfig(self: Self) -> None:
max_age_seconds=3600,
)

SYSTEM_PROMPT = [
SYSTEM_PROMPT: dict[str, str] = [
{
"role": "system",
"content": (
Expand Down
4 changes: 2 additions & 2 deletions techsupport_bot/commands/conch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand All @@ -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
Expand Down
14 changes: 9 additions & 5 deletions techsupport_bot/commands/duck.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
2 changes: 1 addition & 1 deletion techsupport_bot/commands/emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion techsupport_bot/commands/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
)

Expand Down
12 changes: 6 additions & 6 deletions techsupport_bot/commands/factoids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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"
)

Expand Down
4 changes: 2 additions & 2 deletions techsupport_bot/commands/giphy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion techsupport_bot/commands/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions techsupport_bot/commands/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion techsupport_bot/commands/grab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions techsupport_bot/commands/hangman.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class HangmanGame:
ValueError: A valid alphabetic word wasn't provided
"""

HANG_PICS = [
HANG_PICS: list[str] = [
"""
+---+
| |
Expand Down Expand Up @@ -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():
Expand Down
4 changes: 2 additions & 2 deletions techsupport_bot/commands/hug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
)

Expand Down
4 changes: 2 additions & 2 deletions techsupport_bot/commands/ipinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
4 changes: 2 additions & 2 deletions techsupport_bot/commands/iss.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion techsupport_bot/commands/joke.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions techsupport_bot/commands/kanye.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion techsupport_bot/commands/lenny.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Lenny(cogs.BaseCog):
"""

LENNYS_SELECTION = [
LENNYS_SELECTION: list[str] = [
"( ͡° ͜ʖ ͡°)",
"( ͠° ͟ʖ ͡°)",
"( ͡ʘ ͜ʖ ͡ʘ)",
Expand Down
14 changes: 7 additions & 7 deletions techsupport_bot/commands/news.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions techsupport_bot/commands/poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 68ce9cd

Please sign in to comment.