Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions techsupport_bot/commands/animal.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
"""Module for the animal extension for the discord bot."""

from __future__ import annotations

from typing import TYPE_CHECKING

from core import auxiliary, cogs
from discord.ext import commands

if TYPE_CHECKING:
import bot


async def setup(bot: bot.TechSupportBot) -> None:
"""Loading the animals plugin into the bot

async def setup(bot) -> None:
"""Loading the animal plugin"""
Args:
bot (bot.TechSupportBot): The bot object to register the cogs to
"""

await bot.add_cog(Animals(bot=bot))

Expand Down
14 changes: 12 additions & 2 deletions techsupport_bot/commands/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,26 @@
.bot
"""

from __future__ import annotations

import re
from typing import TYPE_CHECKING

import discord
import git
from core import auxiliary, cogs
from discord.ext import commands

if TYPE_CHECKING:
import bot


async def setup(bot) -> None:
"""Registers the BotInfo Cog"""
async def setup(bot: bot.TechSupportBot) -> None:
"""Loading the BotInfo plugin into the bot

Args:
bot (bot.TechSupportBot): The bot object to register the cogs to
"""
await bot.add_cog(BotInfo(bot=bot))


Expand Down
19 changes: 16 additions & 3 deletions techsupport_bot/commands/burn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@
This modules requires no config, no databases, and no APIs
"""

from __future__ import annotations

import random
from typing import TYPE_CHECKING, Self

import discord
from core import auxiliary, cogs
from discord.ext import commands

if TYPE_CHECKING:
import bot


async def setup(bot: bot.TechSupportBot) -> None:
"""Loading the Burn plugin into the bot

async def setup(bot) -> None:
"""Method to add burn command to config."""
Args:
bot (bot.TechSupportBot): The bot object to register the cogs to
"""
await bot.add_cog(Burn(bot=bot))


Expand All @@ -29,7 +39,10 @@ class Burn(cogs.BaseCog):
]

async def handle_burn(
self, ctx: commands.Context, user: discord.Member, message: discord.Message
self: Self,
ctx: commands.Context,
user: discord.Member,
message: discord.Message,
) -> None:
"""The core logic to handle the burn command

Expand Down
18 changes: 16 additions & 2 deletions techsupport_bot/commands/chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,30 @@
Defines: None
"""

from __future__ import annotations

from typing import TYPE_CHECKING

import discord
import expiringdict
import ui
from botlogging import LogContext, LogLevel
from core import auxiliary, cogs
from discord.ext import commands

if TYPE_CHECKING:
import bot


async def setup(bot: bot.TechSupportBot) -> None:
"""Loading the ChatGPT plugin into the bot

Args:
bot (bot.TechSupportBot): The bot object to register the cogs to

async def setup(bot) -> None:
"""Registers the extension"""
Raises:
AttributeError: Raised if an API key is missing to prevent unusable commands from loading
"""

# Don't load without the API key
try:
Expand Down
15 changes: 13 additions & 2 deletions techsupport_bot/commands/commandcontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,23 @@
.command enable
"""

from __future__ import annotations

from typing import TYPE_CHECKING

from core import auxiliary, cogs
from discord.ext import commands

if TYPE_CHECKING:
import bot


async def setup(bot) -> None:
"""Registers the CommandControl Cog"""
async def setup(bot: bot.TechSupportBot) -> None:
"""Loading the Command Control plugin into the bot

Args:
bot (bot.TechSupportBot): The bot object to register the cogs to
"""
await bot.add_cog(CommandControl(bot=bot))


Expand Down
22 changes: 19 additions & 3 deletions techsupport_bot/commands/conch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@
This modules requires no config, no databases, and no APIs
"""

from __future__ import annotations

import random
from typing import TYPE_CHECKING

import discord
from core import auxiliary, cogs
from discord.ext import commands

if TYPE_CHECKING:
import bot


async def setup(bot: bot.TechSupportBot) -> None:
"""Loading the Magic Conch plugin into the bot

async def setup(bot) -> None:
"""Method to add conch to the config in discord bot."""
Args:
bot (bot.TechSupportBot): The bot object to register the cogs to
"""
await bot.add_cog(MagicConch(bot=bot))


Expand Down Expand Up @@ -87,5 +97,11 @@ async def conch_command(self, ctx: commands.Context, question: str = "") -> None
usage="[question]",
)
async def ask_question(self, ctx: commands.Context, *, question: str = "") -> None:
"""Method for how the conch command works for the bot."""
"""Method for how the conch command works for the bot.
This is a command and should be run via discord

Args:
ctx (commands.Context): The context in which the command was run
question (str, optional): The question to ask the magic conch. Defaults to "".
"""
await self.conch_command(ctx, question)
14 changes: 12 additions & 2 deletions techsupport_bot/commands/config.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
"""Module for config commands."""

from __future__ import annotations

import datetime
import io
import json
from typing import TYPE_CHECKING

import discord
import ui
from core import auxiliary, cogs
from discord.ext import commands

if TYPE_CHECKING:
import bot


async def setup(bot: bot.TechSupportBot) -> None:
"""Loading the Guild Config plugin into the bot

async def setup(bot) -> None:
"""Method to add burn command to config."""
Args:
bot (bot.TechSupportBot): The bot object to register the cogs to
"""
await bot.add_cog(ConfigControl(bot=bot))


Expand Down
23 changes: 20 additions & 3 deletions techsupport_bot/commands/correct.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,24 @@
This modules requires no config, no databases, and no APIs
"""

from __future__ import annotations

from typing import TYPE_CHECKING

import discord
from core import auxiliary, cogs
from discord.ext import commands

if TYPE_CHECKING:
import bot


async def setup(bot: bot.TechSupportBot) -> None:
"""Loading the Correct plugin into the bot

async def setup(bot) -> None:
"""Method to add correct to the config."""
Args:
bot (bot.TechSupportBot): The bot object to register the cogs to
"""
await bot.add_cog(Corrector(bot=bot))


Expand Down Expand Up @@ -80,5 +91,11 @@ def prepare_message(
async def correct(
self, ctx: commands.Context, to_replace: str, replacement: str
) -> None:
"""Method for the correct command for the discord bot."""
"""Discord entry point into the correct command

Args:
ctx (commands.Context): The context in which the command was run
to_replace (str): What is being searched for to replace
replacement (str): What to replace to_replace with
"""
await self.correct_command(ctx, to_replace, replacement)
Loading