1
Fork 0
mirror of https://github.com/allthingslinux/tux.git synced 2024-10-02 16:43:12 +00:00

refactor: Use tux.bot.Tux directly in most files instead of its subclass

This commit is contained in:
wlinator 2024-09-02 10:55:43 -04:00
parent 854c9566a8
commit f9f9377583
48 changed files with 306 additions and 254 deletions

View file

@ -2,12 +2,12 @@ import discord
from discord.ext import commands
from loguru import logger
from tux import bot
from tux.bot import Tux
from tux.utils import checks
class Dev(commands.Cog):
def __init__(self, bot: bot.Tux) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
@commands.hybrid_group(
@ -17,13 +17,13 @@ class Dev(commands.Cog):
)
@commands.guild_only()
@checks.has_pl(8)
async def dev(self, ctx: commands.Context[commands.Bot]) -> None:
async def dev(self, ctx: commands.Context[Tux]) -> None:
"""
Dev related commands.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
Raises
@ -43,7 +43,7 @@ class Dev(commands.Cog):
)
@commands.guild_only()
@checks.has_pl(8)
async def sync_tree(self, ctx: commands.Context[commands.Bot], guild: discord.Guild) -> None:
async def sync_tree(self, ctx: commands.Context[Tux], guild: discord.Guild) -> None:
"""
Syncs the app command tree.
@ -77,7 +77,7 @@ class Dev(commands.Cog):
)
@commands.guild_only()
@checks.has_pl(8)
async def clear_tree(self, ctx: commands.Context[commands.Bot]) -> None:
async def clear_tree(self, ctx: commands.Context[Tux]) -> None:
"""
Clears the app command tree.
@ -112,7 +112,7 @@ class Dev(commands.Cog):
)
@commands.guild_only()
@checks.has_pl(8)
async def load_cog(self, ctx: commands.Context[commands.Bot], *, cog: str) -> None:
async def load_cog(self, ctx: commands.Context[Tux], *, cog: str) -> None:
"""
Loads a cog into the bot.
@ -153,7 +153,7 @@ class Dev(commands.Cog):
)
@commands.guild_only()
@checks.has_pl(8)
async def unload_cog(self, ctx: commands.Context[commands.Bot], *, cog: str) -> None:
async def unload_cog(self, ctx: commands.Context[Tux], *, cog: str) -> None:
"""
Unloads a cog from the bot.
@ -188,7 +188,7 @@ class Dev(commands.Cog):
)
@commands.guild_only()
@checks.has_pl(8)
async def reload_cog(self, ctx: commands.Context[commands.Bot], *, cog: str) -> None:
async def reload_cog(self, ctx: commands.Context[Tux], *, cog: str) -> None:
"""
Reloads a cog in the bot.
@ -223,7 +223,7 @@ class Dev(commands.Cog):
)
@commands.guild_only()
@checks.has_pl(8)
async def stop(self, ctx: commands.Context[commands.Bot]) -> None:
async def stop(self, ctx: commands.Context[Tux]) -> None:
"""
Stops the bot. If Tux is running with Docker Compose, this will restart the container.
@ -239,5 +239,5 @@ class Dev(commands.Cog):
await self.bot.shutdown()
async def setup(bot: bot.Tux) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Dev(bot))

View file

@ -4,6 +4,7 @@ import discord
from discord.ext import commands
from loguru import logger
from tux.bot import Tux
from tux.utils import checks
from tux.utils.embeds import EmbedCreator
@ -38,7 +39,7 @@ def insert_returns(body: list[ast.stmt]) -> None:
class Eval(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
@commands.command(
@ -48,13 +49,13 @@ class Eval(commands.Cog):
)
@commands.guild_only()
@checks.has_pl(8) # sysadmin or higher
async def eval(self, ctx: commands.Context[commands.Bot], *, cmd: str) -> None:
async def eval(self, ctx: commands.Context[Tux], *, cmd: str) -> None:
"""
Evaluate a Python expression. (Owner only)
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is being invoked.
cmd : str
The Python expression to evaluate.
@ -128,5 +129,5 @@ class Eval(commands.Cog):
await ctx.send(embed=embed, ephemeral=True, delete_after=30)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Eval(bot))

View file

@ -4,6 +4,7 @@
# from githubkit.versions.latest.models import Issue
# from loguru import logger
# from tux.wrappers.github import GitHubService
# from tux.utils.constants import Constants as CONST
# from tux.utils.embeds import EmbedCreator
@ -18,7 +19,7 @@
# class Git(commands.Cog):
# def __init__(self, bot: commands.Bot) -> None:
# def __init__(self, bot: Tux) -> None:
# self.bot = bot
# self.github = GitHubService()
# self.repo_url = CONST.GITHUB_REPO_URL
@ -379,7 +380,7 @@
# logger.info(f"{interaction.user} fetched a pull request.")
# async def setup(bot: commands.Bot) -> None:
# async def setup(bot: Tux) -> None:
# await bot.add_cog(Git(bot))
# TODO: Rewrite this cog to use the new hybrid command system.
@ -387,6 +388,7 @@
from discord.ext import commands
from loguru import logger
from tux.bot import Tux
from tux.ui.buttons import GithubButton
from tux.utils import checks
from tux.utils.constants import Constants as CONST
@ -395,7 +397,7 @@ from tux.wrappers.github import GithubService
class Git(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
self.github = GithubService()
self.repo_url = CONST.GITHUB_REPO_URL
@ -407,13 +409,13 @@ class Git(commands.Cog):
)
@commands.guild_only()
@checks.has_pl(8)
async def git(self, ctx: commands.Context[commands.Bot]) -> None:
async def git(self, ctx: commands.Context[Tux]) -> None:
"""
Github related commands.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
"""
@ -427,13 +429,13 @@ class Git(commands.Cog):
)
@commands.guild_only()
@checks.has_pl(8)
async def get_repo(self, ctx: commands.Context[commands.Bot]) -> None:
async def get_repo(self, ctx: commands.Context[Tux]) -> None:
"""
Get repository information.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
"""
@ -466,13 +468,13 @@ class Git(commands.Cog):
@commands.guild_only()
# @checks.has_pl(8)
@commands.has_any_role("Root", "Admin", "Contributor", "Tux Contributor", "Tux Beta Tester", "%wheel")
async def create_issue(self, ctx: commands.Context[commands.Bot], title: str, body: str) -> None:
async def create_issue(self, ctx: commands.Context[Tux], title: str, body: str) -> None:
"""
Create an issue.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
title : str
The title of the issue.
@ -507,13 +509,13 @@ class Git(commands.Cog):
)
@commands.guild_only()
@checks.has_pl(8)
async def get_issue(self, ctx: commands.Context[commands.Bot], issue_number: int) -> None:
async def get_issue(self, ctx: commands.Context[Tux], issue_number: int) -> None:
"""
Get an issue by issue number.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
issue_number : int
The number of the issue to retrieve.
@ -542,5 +544,5 @@ class Git(commands.Cog):
logger.info(f"{ctx.author} fetched an issue.")
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Git(bot))

View file

@ -6,6 +6,7 @@ from discord import app_commands
from discord.ext import commands
from loguru import logger
from tux.bot import Tux
from tux.utils import checks
from tux.utils.constants import Constants as CONST
@ -13,7 +14,7 @@ MailboxData = dict[str, str | list[str]]
class Mail(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
self.api_url = CONST.MAILCOW_API_URL
self.headers = {
@ -203,5 +204,5 @@ If you have any questions or need assistance, please feel free to reach out to t
)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Mail(bot))

View file

@ -2,11 +2,12 @@ import random
from discord.ext import commands
from tux.bot import Tux
from tux.utils.embeds import EmbedCreator
class Fact(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
self.facts = [
"The Linux kernel has over 36 million lines of code in its Git repository.",
@ -36,13 +37,13 @@ class Fact(commands.Cog):
name="fact",
aliases=["funfact"],
)
async def fact(self, ctx: commands.Context[commands.Bot]) -> None:
async def fact(self, ctx: commands.Context[Tux]) -> None:
"""
Get a random fun fact.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
"""
embed = EmbedCreator.create_info_embed(
@ -61,5 +62,5 @@ class Fact(commands.Cog):
await ctx.send(embed=embed)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Fact(bot))

View file

@ -7,11 +7,12 @@ from discord.ext import commands
from loguru import logger
from PIL import Image, ImageEnhance, ImageOps
from tux.bot import Tux
from tux.utils.embeds import EmbedCreator
class ImgEffect(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
self.allowed_mimetypes = [
"image/jpeg",
@ -93,5 +94,5 @@ class ImgEffect(commands.Cog):
await interaction.followup.send(file=file, ephemeral=True)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(ImgEffect(bot))

View file

@ -2,11 +2,12 @@ import random
from discord.ext import commands
from tux.bot import Tux
from tux.utils.embeds import EmbedCreator
class Random(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
@commands.hybrid_group(
@ -15,13 +16,13 @@ class Random(commands.Cog):
usage="random <subcommand>",
)
@commands.guild_only()
async def random(self, ctx: commands.Context[commands.Bot]) -> None:
async def random(self, ctx: commands.Context[Tux]) -> None:
"""
Random generation commands.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the
"""
if ctx.invoked_subcommand is None:
@ -33,13 +34,13 @@ class Random(commands.Cog):
usage="random coinflip",
)
@commands.guild_only()
async def coinflip(self, ctx: commands.Context[commands.Bot]) -> None:
async def coinflip(self, ctx: commands.Context[Tux]) -> None:
"""
Flip a coin.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
"""
@ -53,13 +54,13 @@ class Random(commands.Cog):
usage="random 8ball [question]",
)
@commands.guild_only()
async def eight_ball(self, ctx: commands.Context[commands.Bot], *, question: str, cow: bool = False) -> None:
async def eight_ball(self, ctx: commands.Context[Tux], *, question: str, cow: bool = False) -> None:
"""
Ask the magic 8ball a question.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
question : str
The question to ask the 8ball.
@ -157,13 +158,13 @@ class Random(commands.Cog):
usage="random dice <sides>",
)
@commands.guild_only()
async def dice(self, ctx: commands.Context[commands.Bot], sides: int = 6) -> None:
async def dice(self, ctx: commands.Context[Tux], sides: int = 6) -> None:
"""
Roll a dice.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
sides : int, optional
The number of sides on the dice, by default 6.
@ -189,7 +190,7 @@ class Random(commands.Cog):
@commands.guild_only()
async def random_number(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
minimum_str: str = "0",
maximum_str: str = "100",
) -> None:
@ -198,7 +199,7 @@ class Random(commands.Cog):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
minimum_str : str, optional
The minimum value of the random number, by default 0. Converted to int after removing certain characters.
@ -228,5 +229,5 @@ class Random(commands.Cog):
await ctx.send(content=f"Your random number is: {random.randint(minimum_int, maximum_int)}")
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Random(bot))

View file

@ -2,13 +2,14 @@ import discord
from discord.ext import commands
from loguru import logger
from tux.bot import Tux
from tux.ui.buttons import XkcdButtons
from tux.utils.embeds import EmbedCreator
from tux.wrappers import xkcd
class Xkcd(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
self.client = xkcd.Client()
@ -18,13 +19,13 @@ class Xkcd(commands.Cog):
usage="xkcd <subcommand>",
)
@commands.guild_only()
async def xkcd(self, ctx: commands.Context[commands.Bot], comic_id: int | None = None) -> None:
async def xkcd(self, ctx: commands.Context[Tux], comic_id: int | None = None) -> None:
"""
xkcd related commands.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
comic_id : int | None
The ID of the xkcd comic to search for.
@ -41,13 +42,13 @@ class Xkcd(commands.Cog):
usage="xkcd latest",
)
@commands.guild_only()
async def latest(self, ctx: commands.Context[commands.Bot]) -> None:
async def latest(self, ctx: commands.Context[Tux]) -> None:
"""
Get the latest xkcd comic.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
"""
@ -64,13 +65,13 @@ class Xkcd(commands.Cog):
usage="xkcd random",
)
@commands.guild_only()
async def random(self, ctx: commands.Context[commands.Bot]) -> None:
async def random(self, ctx: commands.Context[Tux]) -> None:
"""
Get a random xkcd comic.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the
"""
@ -87,13 +88,13 @@ class Xkcd(commands.Cog):
usage="xkcd specific [comic_id]",
)
@commands.guild_only()
async def specific(self, ctx: commands.Context[commands.Bot], comic_id: int) -> None:
async def specific(self, ctx: commands.Context[Tux], comic_id: int) -> None:
"""
Get a specific xkcd comic.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
comic_id : int
The ID of the comic to search for.
@ -157,5 +158,5 @@ class Xkcd(commands.Cog):
)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Xkcd(bot))

View file

@ -4,6 +4,7 @@ import discord
from discord import app_commands
from discord.ext import commands
from tux.bot import Tux
from tux.database.controllers import DatabaseController
from tux.ui.views.config import ConfigSetChannels, ConfigSetPrivateLogs, ConfigSetPublicLogs
@ -13,7 +14,7 @@ from tux.ui.views.config import ConfigSetChannels, ConfigSetPrivateLogs, ConfigS
class Config(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
self.db = DatabaseController().guild_config
@ -319,5 +320,5 @@ class Config(commands.Cog):
await interaction.response.send_message(embed=embed, ephemeral=True, delete_after=30)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Config(bot))

View file

@ -2,12 +2,13 @@ import discord
from discord import app_commands
from discord.ext import commands
from tux.bot import Tux
from tux.utils import checks, exports
from tux.utils.embeds import EmbedCreator
class Export(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
export = app_commands.Group(name="export", description="export server data with Tux.")
@ -105,5 +106,5 @@ class Export(commands.Cog):
return await interaction.response.send_message(embed=embed)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Export(bot))

View file

@ -3,6 +3,7 @@ from discord import app_commands
from discord.ext import commands
from reactionmenu import ViewButton, ViewMenu
from tux.bot import Tux
from tux.utils.embeds import EmbedCreator
des_ids = [
@ -146,7 +147,7 @@ misc_ids = [
class RoleCount(commands.Cog):
def __init__(self, bot: commands.Bot):
def __init__(self, bot: Tux):
self.bot = bot
self.roles_emoji_mapping = {
"ds": distro_ids,
@ -352,5 +353,5 @@ class RoleCount(commands.Cog):
await menu.start()
async def setup(bot: commands.Bot):
async def setup(bot: Tux):
await bot.add_cog(RoleCount(bot))

View file

@ -2,12 +2,13 @@ import discord
from discord import app_commands
from discord.ext import commands
from tux.bot import Tux
from tux.database.controllers import DatabaseController
from tux.utils import checks
class Setup(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
self.db = DatabaseController()
self.config = DatabaseController().guild_config
@ -81,5 +82,5 @@ class Setup(commands.Cog):
await interaction.edit_original_response(content=f"Setting up permissions for {channel.name}.")
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Setup(bot))

View file

@ -6,11 +6,13 @@ import httpx
from discord import app_commands
from discord.ext import commands
from tux.bot import Tux
client = httpx.AsyncClient()
class Avatar(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
@app_commands.command(name="avatar")
@ -41,7 +43,7 @@ class Avatar(commands.Cog):
@commands.guild_only()
async def prefix_avatar(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
member: discord.Member | None = None,
) -> None:
"""
@ -49,7 +51,7 @@ class Avatar(commands.Cog):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is being invoked.
member : discord.Member
The member to get the avatar of.
@ -59,7 +61,7 @@ class Avatar(commands.Cog):
async def send_avatar(
self,
source: commands.Context[commands.Bot] | discord.Interaction,
source: commands.Context[Tux] | discord.Interaction,
member: discord.Member | None = None,
) -> None:
"""
@ -67,7 +69,7 @@ class Avatar(commands.Cog):
Parameters
----------
source : commands.Context[commands.Bot] | discord.Interaction
source : commands.Context[Tux] | discord.Interaction
The source object for sending the message.
member : discord.Member
The member to get the avatar of.
@ -130,5 +132,5 @@ class Avatar(commands.Cog):
return discord.File(image_file, filename=f"avatar{extension}")
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Avatar(bot))

View file

@ -4,13 +4,15 @@ import discord
from discord.ext import commands
from reactionmenu import ViewButton, ViewMenu
from tux.bot import Tux
class Info(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
@commands.hybrid_group(name="info", aliases=["i"], usage="info <subcommand>")
async def info(self, ctx: commands.Context[commands.Bot]) -> None:
async def info(self, ctx: commands.Context[Tux]) -> None:
"""
Information commands.
@ -24,7 +26,7 @@ class Info(commands.Cog):
await ctx.send_help("info")
@info.command(name="server", aliases=["s"], usage="info server")
async def server(self, ctx: commands.Context[commands.Bot]) -> None:
async def server(self, ctx: commands.Context[Tux]) -> None:
"""
Show information about the server.
@ -62,7 +64,7 @@ class Info(commands.Cog):
await ctx.send(embed=embed)
@info.command(name="member", aliases=["m", "user", "u"], usage="info member [member]")
async def member(self, ctx: commands.Context[commands.Bot], member: discord.Member) -> None:
async def member(self, ctx: commands.Context[Tux], member: discord.Member) -> None:
"""
Show information about a member.
@ -106,7 +108,7 @@ class Info(commands.Cog):
await ctx.send(embed=embed)
@info.command(name="roles", aliases=["r"], usage="info roles")
async def roles(self, ctx: commands.Context[commands.Bot]) -> None:
async def roles(self, ctx: commands.Context[Tux]) -> None:
"""
List all roles in the server.
@ -124,7 +126,7 @@ class Info(commands.Cog):
await self.paginated_embed(ctx, "Server Roles", "roles", guild.name, roles, 32)
@info.command(name="emotes", aliases=["e"], usage="info emotes")
async def emotes(self, ctx: commands.Context[commands.Bot]) -> None:
async def emotes(self, ctx: commands.Context[Tux]) -> None:
"""
List all emotes in the server.
@ -142,7 +144,7 @@ class Info(commands.Cog):
async def paginated_embed(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
title: str,
list_type: str,
guild_name: str,
@ -238,5 +240,5 @@ class Info(commands.Cog):
return menu
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Info(bot))

View file

@ -2,11 +2,12 @@ import discord
from discord import app_commands
from discord.ext import commands
from tux.bot import Tux
from tux.utils.embeds import EmbedCreator
class MemberCount(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
@app_commands.command(name="membercount", description="Shows server member count")
@ -48,5 +49,5 @@ class MemberCount(commands.Cog):
await interaction.response.send_message(embed=embed)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(MemberCount(bot))

View file

@ -5,20 +5,21 @@ from discord.ext import commands
from loguru import logger
from prisma.enums import CaseType
from tux.bot import Tux
from tux.database.controllers import DatabaseController
from tux.utils.constants import Constants as CONST
from tux.utils.embeds import create_embed_footer, create_error_embed
class ModerationCogBase(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
self.db = DatabaseController()
self.config = DatabaseController().guild_config
def create_embed(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
title: str,
fields: list[tuple[str, str, bool]],
color: int,
@ -31,7 +32,7 @@ class ModerationCogBase(commands.Cog):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context of the command.
title : str
The title of the embed.
@ -64,7 +65,7 @@ class ModerationCogBase(commands.Cog):
async def send_embed(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
embed: discord.Embed,
log_type: str,
) -> None:
@ -73,7 +74,7 @@ class ModerationCogBase(commands.Cog):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context of the command.
embed : discord.Embed
The embed to send.
@ -90,7 +91,7 @@ class ModerationCogBase(commands.Cog):
async def send_dm(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
silent: bool,
user: discord.Member,
reason: str,
@ -101,7 +102,7 @@ class ModerationCogBase(commands.Cog):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context of the command.
silent : bool
Whether the command is silent.
@ -125,7 +126,7 @@ class ModerationCogBase(commands.Cog):
async def check_conditions(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
user: discord.Member,
moderator: discord.Member | discord.User,
action: str,
@ -135,7 +136,7 @@ class ModerationCogBase(commands.Cog):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context of the command.
user : discord.Member
The target of the moderation action.
@ -173,7 +174,7 @@ class ModerationCogBase(commands.Cog):
async def check_jail_conditions(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
user: discord.Member,
) -> tuple[bool, discord.Role | None, discord.abc.GuildChannel | None]:
"""
@ -181,7 +182,7 @@ class ModerationCogBase(commands.Cog):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context of the command.
user : discord.Member
The member to jail.
@ -215,7 +216,7 @@ class ModerationCogBase(commands.Cog):
async def handle_case_response(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
case_type: CaseType,
case_number: int | None,
reason: str,

View file

@ -3,6 +3,7 @@ from discord.ext import commands
from loguru import logger
from prisma.enums import CaseType
from tux.bot import Tux
from tux.utils import checks
from tux.utils.flags import BanFlags, generate_usage
@ -10,7 +11,7 @@ from . import ModerationCogBase
class Ban(ModerationCogBase):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
super().__init__(bot)
self.ban.usage = generate_usage(self.ban, BanFlags)
@ -19,7 +20,7 @@ class Ban(ModerationCogBase):
@checks.has_pl(3)
async def ban(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
member: discord.Member,
*,
flags: BanFlags,
@ -29,7 +30,7 @@ class Ban(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is being invoked.
member : discord.Member
The member to ban.
@ -73,5 +74,5 @@ class Ban(ModerationCogBase):
await self.handle_case_response(ctx, CaseType.BAN, case.case_number, flags.reason, member)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Ban(bot))

View file

@ -6,6 +6,7 @@ from reactionmenu import ViewButton, ViewMenu
from prisma.enums import CaseType
from prisma.models import Case
from prisma.types import CaseWhereInput
from tux.bot import Tux
from tux.utils import checks
from tux.utils.constants import Constants as CONST
from tux.utils.embeds import create_embed_footer
@ -29,7 +30,7 @@ emojis: dict[str, int] = {
class Cases(ModerationCogBase):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
super().__init__(bot)
self.cases_view.usage = generate_usage(self.cases_view, CasesViewFlags)
self.cases_modify.usage = generate_usage(self.cases_modify, CaseModifyFlags)
@ -41,7 +42,7 @@ class Cases(ModerationCogBase):
)
@commands.guild_only()
@checks.has_pl(2)
async def cases(self, ctx: commands.Context[commands.Bot]) -> None:
async def cases(self, ctx: commands.Context[Tux]) -> None:
"""
Manage moderation cases in the server.
"""
@ -56,7 +57,7 @@ class Cases(ModerationCogBase):
@checks.has_pl(2)
async def cases_view(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
number: int | None,
*,
flags: CasesViewFlags,
@ -66,7 +67,7 @@ class Cases(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is being invoked.
number : int | None
The case number to view.
@ -91,7 +92,7 @@ class Cases(ModerationCogBase):
@checks.has_pl(2)
async def cases_modify(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
number: int,
*,
flags: CaseModifyFlags,
@ -101,7 +102,7 @@ class Cases(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is being invoked.
number : int
The case number to modify.
@ -129,7 +130,7 @@ class Cases(ModerationCogBase):
async def _view_single_case(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
number: int,
) -> None:
"""
@ -137,7 +138,7 @@ class Cases(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is being invoked.
number : int
The number of the case to view.
@ -160,7 +161,7 @@ class Cases(ModerationCogBase):
async def _view_cases_with_flags(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
flags: CasesViewFlags,
) -> None:
"""
@ -168,7 +169,7 @@ class Cases(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is being invoked.
flags : CasesViewFlags
The flags for the command. (type, user, moderator)
@ -198,7 +199,7 @@ class Cases(ModerationCogBase):
async def _update_case(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
case: Case,
flags: CaseModifyFlags,
) -> None:
@ -207,7 +208,7 @@ class Cases(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is being invoked.
case : Case
The case to update.
@ -240,7 +241,7 @@ class Cases(ModerationCogBase):
async def _handle_case_response(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
case: Case | None,
action: str,
reason: str,
@ -251,7 +252,7 @@ class Cases(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is being invoked.
case : Case | None
The case to handle the response for.
@ -296,7 +297,7 @@ class Cases(ModerationCogBase):
async def _handle_case_list_response(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
cases: list[Case],
total_cases: int,
) -> None:
@ -343,7 +344,7 @@ class Cases(ModerationCogBase):
def _create_case_list_embed(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
cases: list[Case],
total_cases: int,
) -> discord.Embed:
@ -435,5 +436,5 @@ class Cases(ModerationCogBase):
embed.description += self._get_case_description(case, case_status_emoji, case_type_emoji, case_action_emoji)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Cases(bot))

View file

@ -3,6 +3,7 @@ from discord.ext import commands
from loguru import logger
from prisma.enums import CaseType
from tux.bot import Tux
from tux.utils import checks
from tux.utils.flags import JailFlags, generate_usage
@ -10,7 +11,7 @@ from . import ModerationCogBase
class Jail(ModerationCogBase):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
super().__init__(bot)
self.jail.usage = generate_usage(self.jail, JailFlags)
@ -22,7 +23,7 @@ class Jail(ModerationCogBase):
@checks.has_pl(2)
async def jail(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
member: discord.Member,
*,
flags: JailFlags,
@ -32,7 +33,7 @@ class Jail(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The discord context object.
member : discord.Member
The member to jail.
@ -121,5 +122,5 @@ class Jail(ModerationCogBase):
]
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Jail(bot))

View file

@ -3,6 +3,7 @@ from discord.ext import commands
from loguru import logger
from prisma.enums import CaseType
from tux.bot import Tux
from tux.utils import checks
from tux.utils.flags import KickFlags, generate_usage
@ -10,7 +11,7 @@ from . import ModerationCogBase
class Kick(ModerationCogBase):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
super().__init__(bot)
self.kick.usage = generate_usage(self.kick, KickFlags)
@ -22,7 +23,7 @@ class Kick(ModerationCogBase):
@checks.has_pl(2)
async def kick(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
member: discord.Member,
*,
flags: KickFlags,
@ -32,7 +33,7 @@ class Kick(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is being invoked.
member : discord.Member
The member to kick.
@ -76,5 +77,5 @@ class Kick(ModerationCogBase):
await self.handle_case_response(ctx, CaseType.KICK, case.case_number, flags.reason, member)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Kick(bot))

View file

@ -3,11 +3,12 @@ from discord import app_commands
from discord.ext import commands
from loguru import logger
from tux.bot import Tux
from tux.utils import checks
class Purge(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
@app_commands.command(name="purge")
@ -79,7 +80,7 @@ class Purge(commands.Cog):
@checks.has_pl(2)
async def prefix_purge(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
limit: int,
channel: discord.TextChannel | discord.Thread | None = None,
) -> None:
@ -88,7 +89,7 @@ class Purge(commands.Cog):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is being invoked.
limit : int
The number of messages to delete.
@ -134,5 +135,5 @@ class Purge(commands.Cog):
await ctx.send(f"Purged {limit} messages from {channel.mention}.", delete_after=30, ephemeral=True)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Purge(bot))

View file

@ -2,11 +2,12 @@ import discord
from discord import app_commands
from discord.ext import commands
from tux.bot import Tux
from tux.ui.modals.report import ReportModal
class Report(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
@app_commands.command(name="report")
@ -26,5 +27,5 @@ class Report(commands.Cog):
await interaction.response.send_modal(modal)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Report(bot))

View file

@ -3,11 +3,12 @@ from discord import app_commands
from discord.ext import commands
from loguru import logger
from tux.bot import Tux
from tux.utils import checks
class Roles(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
roles = app_commands.Group(name="roles", description="Commands for managing roles.")
@ -59,5 +60,5 @@ class Roles(commands.Cog):
logger.info(f"{interaction.user} added role {role.name} to {user}.")
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Roles(bot))

View file

@ -2,11 +2,12 @@ import discord
from discord.ext import commands
from loguru import logger
from tux.bot import Tux
from tux.utils import checks
class Slowmode(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
@commands.hybrid_command(
@ -18,7 +19,7 @@ class Slowmode(commands.Cog):
@checks.has_pl(2)
async def slowmode(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
action: str,
channel: discord.TextChannel | discord.Thread | None = None,
) -> None:
@ -27,7 +28,7 @@ class Slowmode(commands.Cog):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context of the command.
action : str
Either 'get' to get the current slowmode or the slowmode time in seconds, max is 21600.
@ -94,5 +95,5 @@ class Slowmode(commands.Cog):
logger.error(f"Failed to set slowmode. Error: {error}")
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Slowmode(bot))

View file

@ -3,6 +3,7 @@ from discord.ext import commands
from loguru import logger
from prisma.enums import CaseType
from tux.bot import Tux
from tux.database.controllers.case import CaseController
from tux.utils import checks
from tux.utils.flags import SnippetBanFlags, generate_usage
@ -11,7 +12,7 @@ from . import ModerationCogBase
class SnippetBan(ModerationCogBase):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
super().__init__(bot)
self.case_controller = CaseController()
self.snippet_ban.usage = generate_usage(self.snippet_ban, SnippetBanFlags)
@ -24,7 +25,7 @@ class SnippetBan(ModerationCogBase):
@checks.has_pl(3)
async def snippet_ban(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
member: discord.Member,
*,
flags: SnippetBanFlags,
@ -34,7 +35,7 @@ class SnippetBan(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object.
member : discord.Member
The member to snippet ban.
@ -93,5 +94,5 @@ class SnippetBan(ModerationCogBase):
return ban_count > unban_count
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(SnippetBan(bot))

View file

@ -3,6 +3,7 @@ from discord.ext import commands
from loguru import logger
from prisma.enums import CaseType
from tux.bot import Tux
from tux.database.controllers.case import CaseController
from tux.utils import checks
from tux.utils.flags import SnippetUnbanFlags, generate_usage
@ -11,7 +12,7 @@ from . import ModerationCogBase
class SnippetUnban(ModerationCogBase):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
super().__init__(bot)
self.case_controller = CaseController()
self.snippet_unban.usage = generate_usage(self.snippet_unban, SnippetUnbanFlags)
@ -24,7 +25,7 @@ class SnippetUnban(ModerationCogBase):
@checks.has_pl(3)
async def snippet_unban(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
member: discord.Member,
*,
flags: SnippetUnbanFlags,
@ -34,7 +35,7 @@ class SnippetUnban(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object.
member : discord.Member
The member to snippet unban.
@ -93,5 +94,5 @@ class SnippetUnban(ModerationCogBase):
return ban_count > unban_count
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(SnippetUnban(bot))

View file

@ -5,6 +5,7 @@ from discord.ext import commands
from loguru import logger
from prisma.enums import CaseType
from tux.bot import Tux
from tux.utils import checks
from tux.utils.flags import TimeoutFlags, generate_usage
from tux.utils.functions import parse_time_string
@ -13,7 +14,7 @@ from . import ModerationCogBase
class Timeout(ModerationCogBase):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
super().__init__(bot)
self.timeout.usage = generate_usage(self.timeout, TimeoutFlags)
@ -25,7 +26,7 @@ class Timeout(ModerationCogBase):
@checks.has_pl(2)
async def timeout(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
member: discord.Member,
*,
flags: TimeoutFlags,
@ -35,7 +36,7 @@ class Timeout(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is being invoked.
member : discord.Member
The member to timeout.
@ -83,5 +84,5 @@ class Timeout(ModerationCogBase):
await self.handle_case_response(ctx, CaseType.TIMEOUT, case.case_number, flags.reason, member, flags.duration)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Timeout(bot))

View file

@ -3,6 +3,7 @@ from discord.ext import commands
from loguru import logger
from prisma.enums import CaseType
from tux.bot import Tux
from tux.utils import checks
from tux.utils.flags import UnbanFlags, generate_usage
@ -10,7 +11,7 @@ from . import ModerationCogBase
class Unban(ModerationCogBase):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
super().__init__(bot)
self.unban.usage = generate_usage(self.unban, UnbanFlags)
@ -22,7 +23,7 @@ class Unban(ModerationCogBase):
@checks.has_pl(3)
async def unban(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
username_or_id: str,
*,
flags: UnbanFlags,
@ -32,7 +33,7 @@ class Unban(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
username_or_id : str
The username or ID of the user to unban.
@ -78,5 +79,5 @@ class Unban(ModerationCogBase):
await self.handle_case_response(ctx, CaseType.UNBAN, case.case_number, flags.reason, user)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Unban(bot))

View file

@ -3,6 +3,7 @@ from discord.ext import commands
from loguru import logger
from prisma.enums import CaseType
from tux.bot import Tux
from tux.utils import checks
from tux.utils.flags import UnjailFlags, generate_usage
@ -10,7 +11,7 @@ from . import ModerationCogBase
class Unjail(ModerationCogBase):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
super().__init__(bot)
self.unjail.usage = generate_usage(self.unjail, UnjailFlags)
@ -22,7 +23,7 @@ class Unjail(ModerationCogBase):
@checks.has_pl(2)
async def unjail( # noqa: PLR0911
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
member: discord.Member,
*,
flags: UnjailFlags,
@ -32,7 +33,7 @@ class Unjail(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The discord context object.
member : discord.Member
The member to unjail.
@ -90,5 +91,5 @@ class Unjail(ModerationCogBase):
await self.handle_case_response(ctx, CaseType.UNJAIL, unjail_case.case_number, flags.reason, member)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Unjail(bot))

View file

@ -3,6 +3,7 @@ from discord.ext import commands
from loguru import logger
from prisma.enums import CaseType
from tux.bot import Tux
from tux.utils import checks
from tux.utils.flags import UntimeoutFlags, generate_usage
@ -10,7 +11,7 @@ from . import ModerationCogBase
class Untimeout(ModerationCogBase):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
super().__init__(bot)
self.untimeout.usage = generate_usage(self.untimeout, UntimeoutFlags)
@ -22,7 +23,7 @@ class Untimeout(ModerationCogBase):
@checks.has_pl(2)
async def untimeout(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
member: discord.Member,
*,
flags: UntimeoutFlags,
@ -32,7 +33,7 @@ class Untimeout(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is being invoked.
member : discord.Member
The member to untimeout.
@ -76,5 +77,5 @@ class Untimeout(ModerationCogBase):
await self.handle_case_response(ctx, CaseType.UNTIMEOUT, case.case_number, flags.reason, member)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Untimeout(bot))

View file

@ -3,6 +3,7 @@ from discord.ext import commands
from loguru import logger
from prisma.enums import CaseType
from tux.bot import Tux
from tux.utils import checks
from tux.utils.flags import WarnFlags, generate_usage
@ -10,7 +11,7 @@ from . import ModerationCogBase
class Warn(ModerationCogBase):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
super().__init__(bot)
self.warn.usage = generate_usage(self.warn, WarnFlags)
@ -22,7 +23,7 @@ class Warn(ModerationCogBase):
@checks.has_pl(2)
async def warn(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
member: discord.Member,
*,
flags: WarnFlags,
@ -32,7 +33,7 @@ class Warn(ModerationCogBase):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is being invoked.
member : discord.Member
The member to warn.
@ -62,5 +63,5 @@ class Warn(ModerationCogBase):
await self.handle_case_response(ctx, CaseType.WARN, case.case_number, flags.reason, member)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Warn(bot))

View file

@ -4,12 +4,13 @@ import discord
from discord.ext import commands
from loguru import logger
from tux.bot import Tux
from tux.utils.constants import Constants as CONST
from tux.utils.embeds import EmbedCreator
class Bookmarks(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
@commands.Cog.listener()
@ -103,5 +104,5 @@ class Bookmarks(commands.Cog):
await notify_message.delete(delay=30)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Bookmarks(bot))

View file

@ -1,6 +1,7 @@
import discord
from discord.ext import commands
from tux.bot import Tux
from tux.utils.constants import Constants as CONST
@ -10,13 +11,13 @@ class TempVc(commands.Cog):
Attributes
----------
bot : commands.Bot
bot : Tux
The bot instance.
base_vc_name : str
The base name for temporary voice channels.
"""
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
self.base_vc_name: str = "/tmp/"
@ -132,5 +133,5 @@ class TempVc(commands.Cog):
await channel.delete()
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(TempVc(bot))

View file

@ -5,6 +5,8 @@ import discord
from discord.ext import commands
from loguru import logger
from tux.bot import Tux
class TtyRoles(commands.Cog):
"""
@ -12,13 +14,13 @@ class TtyRoles(commands.Cog):
Attributes
----------
bot : commands.Bot
bot : Tux
The bot instance.
base_role_name : str
The base name for the roles.
"""
def __init__(self, bot: commands.Bot):
def __init__(self, bot: Tux):
self.bot = bot
self.base_role_name = "/dev/tty"
@ -113,5 +115,5 @@ class TtyRoles(commands.Cog):
logger.error(f"Failed to assign role {role.name} to {member}: {error}")
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(TtyRoles(bot))

View file

@ -1,24 +1,25 @@
import psutil
from discord.ext import commands
from tux.bot import Tux
from tux.utils.embeds import EmbedCreator
class Ping(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
@commands.hybrid_command(
name="ping",
usage="ping",
)
async def ping(self, ctx: commands.Context[commands.Bot]) -> None:
async def ping(self, ctx: commands.Context[Tux]) -> None:
"""
Check the bot's latency and other stats.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The discord context object.
"""
@ -49,5 +50,5 @@ class Ping(commands.Cog):
await ctx.send(embed=embed)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Ping(bot))

View file

@ -3,13 +3,14 @@ from discord import app_commands
from discord.ext import commands
from loguru import logger
from tux.bot import Tux
from tux.utils.embeds import EmbedCreator
# TODO: Create option inputs for the poll command instead of using a comma separated string
class Poll(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
@commands.Cog.listener() # listen for messages
@ -104,5 +105,5 @@ class Poll(commands.Cog):
await message.add_reaction(f"{num + 1}\u20e3")
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Poll(bot))

View file

@ -3,12 +3,13 @@ import httpx
from discord.ext import commands
from loguru import logger
from tux.bot import Tux
from tux.utils.constants import Constants as CONST
from tux.utils.embeds import EmbedCreator
class Query(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
@commands.hybrid_command(
@ -16,13 +17,13 @@ class Query(commands.Cog):
aliases=["q"],
usage="query [search_term]",
)
async def query(self, ctx: commands.Context[commands.Bot], *, search_term: str) -> None:
async def query(self, ctx: commands.Context[Tux], *, search_term: str) -> None:
"""
Query the DuckDuckGo API for a search term and return a answer.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
search_term : str
The search term.
@ -122,5 +123,5 @@ class Query(commands.Cog):
await ctx.send(embed=embed)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Query(bot))

View file

@ -8,6 +8,7 @@ from discord.ext import commands
from loguru import logger
from prisma.models import Reminder
from tux.bot import Tux
from tux.database.controllers import DatabaseController
from tux.utils.embeds import EmbedCreator
from tux.utils.functions import convert_to_seconds
@ -32,7 +33,7 @@ def get_closest_reminder(reminders: list[Reminder]) -> Reminder | None:
class RemindMe(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
self.db = DatabaseController().reminder
self.bot.loop.create_task(self.update())
@ -206,5 +207,5 @@ class RemindMe(commands.Cog):
await self.update()
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(RemindMe(bot))

View file

@ -2,6 +2,7 @@ import re
from discord.ext import commands
from tux.bot import Tux
from tux.utils.embeds import EmbedCreator
from tux.wrappers import godbolt
@ -39,7 +40,7 @@ compiler_map = {
class Run(commands.Cog):
def __init__(self, bot: commands.Bot):
def __init__(self, bot: Tux):
self.bot = bot
def remove_ansi(self, ansi: str) -> str:
@ -78,7 +79,7 @@ class Run(commands.Cog):
async def generalized_code_executor(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
compiler_map: dict[str, str],
code: str,
options: str | None = None,
@ -88,7 +89,7 @@ class Run(commands.Cog):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is invoked.
compiler_map : dict[str, str]
A dictionary containing mappings from a language to its compiler.
@ -136,7 +137,7 @@ class Run(commands.Cog):
async def generalized_code_constructor(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
compiler_map: dict[str, str],
code: str,
options: str | None = None,
@ -146,7 +147,7 @@ class Run(commands.Cog):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is invoked.
compiler_map : dict[str, str]
A dictionary containing mappings from a language to its compiler.
@ -201,7 +202,7 @@ class Run(commands.Cog):
async def send_embedded_reply(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
gen_one: str,
output: str,
lang: str,
@ -211,7 +212,7 @@ class Run(commands.Cog):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is invoked.
gen_one : str
The first few lines of the output.
@ -236,7 +237,7 @@ class Run(commands.Cog):
)
async def run(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
*,
code: str,
):
@ -245,7 +246,7 @@ class Run(commands.Cog):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is invoked.
code : str
The code to be evaluated.
@ -271,7 +272,7 @@ class Run(commands.Cog):
@run.error
async def run_error(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
error: Exception,
):
"""
@ -279,7 +280,7 @@ class Run(commands.Cog):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is invoked.
error : Exception
The error that occurred.
@ -304,13 +305,13 @@ class Run(commands.Cog):
aliases=["langs"],
usage="languages",
)
async def languages(self, ctx: commands.Context[commands.Bot]) -> None:
async def languages(self, ctx: commands.Context[Tux]) -> None:
"""
Lists all the supported languages.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context in which the command is invoked.
"""
@ -323,5 +324,5 @@ class Run(commands.Cog):
await ctx.send(embed=embed)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Run(bot))

View file

@ -10,6 +10,7 @@ from reactionmenu import ViewButton, ViewMenu
from prisma.enums import CaseType
from prisma.models import Snippet
from tux.bot import Tux
from tux.database.controllers import CaseController, DatabaseController
from tux.utils import checks
from tux.utils.constants import Constants as CONST
@ -17,7 +18,7 @@ from tux.utils.embeds import EmbedCreator, create_embed_footer, create_error_emb
class Snippets(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
self.db = DatabaseController().snippet
self.config = DatabaseController().guild_config
@ -38,13 +39,13 @@ class Snippets(commands.Cog):
usage="snippets",
)
@commands.guild_only()
async def list_snippets(self, ctx: commands.Context[commands.Bot]) -> None:
async def list_snippets(self, ctx: commands.Context[Tux]) -> None:
"""
List snippets by pagination.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object.
"""
@ -84,7 +85,7 @@ class Snippets(commands.Cog):
def _create_snippets_list_embed(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
snippets: list[Snippet],
total_snippets: int,
) -> discord.Embed:
@ -119,13 +120,13 @@ class Snippets(commands.Cog):
usage="topsnippets",
)
@commands.guild_only()
async def top_snippets(self, ctx: commands.Context[commands.Bot]) -> None:
async def top_snippets(self, ctx: commands.Context[Tux]) -> None:
"""
List top snippets.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object.
"""
@ -171,13 +172,13 @@ class Snippets(commands.Cog):
usage="deletesnippet [name]",
)
@commands.guild_only()
async def delete_snippet(self, ctx: commands.Context[commands.Bot], name: str) -> None:
async def delete_snippet(self, ctx: commands.Context[Tux], name: str) -> None:
"""
Delete a snippet by name.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object.
name : str
The name of the snippet.
@ -221,13 +222,13 @@ class Snippets(commands.Cog):
)
@commands.guild_only()
@checks.has_pl(2)
async def force_delete_snippet(self, ctx: commands.Context[commands.Bot], name: str) -> None:
async def force_delete_snippet(self, ctx: commands.Context[Tux], name: str) -> None:
"""
Force delete a snippet by name.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object.
name : str
The name of the snippet.
@ -255,13 +256,13 @@ class Snippets(commands.Cog):
usage="snippet [name]",
)
@commands.guild_only()
async def get_snippet(self, ctx: commands.Context[commands.Bot], name: str) -> None:
async def get_snippet(self, ctx: commands.Context[Tux], name: str) -> None:
"""
Get a snippet by name.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object.
name : str
The name of the snippet.
@ -304,13 +305,13 @@ class Snippets(commands.Cog):
usage="snippetinfo [name]",
)
@commands.guild_only()
async def get_snippet_info(self, ctx: commands.Context[commands.Bot], name: str) -> None:
async def get_snippet_info(self, ctx: commands.Context[Tux], name: str) -> None:
"""
Get information about a snippet by name.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object.
name : str
The name of the snippet.
@ -363,13 +364,13 @@ class Snippets(commands.Cog):
usage="createsnippet [name] [content]",
)
@commands.guild_only()
async def create_snippet(self, ctx: commands.Context[commands.Bot], *, arg: str) -> None:
async def create_snippet(self, ctx: commands.Context[Tux], *, arg: str) -> None:
"""
Create a snippet.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object.
arg : str
The name and content of the snippet.
@ -429,13 +430,13 @@ class Snippets(commands.Cog):
usage="editsnippet [name]",
)
@commands.guild_only()
async def edit_snippet(self, ctx: commands.Context[commands.Bot], *, arg: str) -> None:
async def edit_snippet(self, ctx: commands.Context[Tux], *, arg: str) -> None:
"""
Edit a snippet.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object.
arg : str
The name and content of the snippet.
@ -503,13 +504,13 @@ class Snippets(commands.Cog):
)
@commands.guild_only()
@checks.has_pl(2)
async def toggle_snippet_lock(self, ctx: commands.Context[commands.Bot], name: str) -> None:
async def toggle_snippet_lock(self, ctx: commands.Context[Tux], name: str) -> None:
"""
Toggle a snippet lock.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object.
name : str
The name of the snippet.
@ -549,5 +550,5 @@ Snippets are usually locked by moderators if they are important to usual use of
logger.info(f"{ctx.author} toggled the lock of the snippet with the name {name}.")
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Snippets(bot))

View file

@ -5,6 +5,8 @@ import pytz
from discord.ext import commands
from reactionmenu import Page, ViewButton, ViewMenu, ViewSelect
from tux.bot import Tux
timezones = {
"North America": [
("🇺🇸", "US", "Pacific/Honolulu", "HST", -10),
@ -85,7 +87,7 @@ continent_emojis = {
class Timezones(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
@commands.hybrid_command(
@ -93,7 +95,7 @@ class Timezones(commands.Cog):
aliases=["tz"],
usage="timezones",
)
async def timezones(self, ctx: commands.Context[commands.Bot]) -> None:
async def timezones(self, ctx: commands.Context[Tux]) -> None:
utc_now = datetime.now(UTC)
menu = ViewMenu(ctx, menu_type=ViewMenu.TypeEmbed)
@ -136,5 +138,5 @@ class Timezones(commands.Cog):
await menu.start()
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Timezones(bot))

View file

@ -4,11 +4,12 @@ import discord
from discord import app_commands
from discord.ext import commands
from tux.bot import Tux
from tux.utils.embeds import EmbedCreator
class Tldr(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
async def get_autocomplete(
@ -73,13 +74,13 @@ class Tldr(commands.Cog):
usage="tldr [command]",
)
@commands.guild_only()
async def prefix_tldr(self, ctx: commands.Context[commands.Bot], command: str) -> None:
async def prefix_tldr(self, ctx: commands.Context[Tux], command: str) -> None:
"""
Show a TLDR page for a CLI command
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
command : str
The command to retrieve the TLDR page for.
@ -159,5 +160,5 @@ class Tldr(commands.Cog):
return process.stdout
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Tldr(bot))

View file

@ -2,11 +2,12 @@ import httpx
from discord.ext import commands
from loguru import logger
from tux.bot import Tux
from tux.utils.embeds import EmbedCreator
class Wiki(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
self.arch_wiki_base_url = "https://wiki.archlinux.org/api.php"
self.atl_wiki_base_url = "https://atl.wiki/api.php"
@ -86,13 +87,13 @@ class Wiki(commands.Cog):
usage="wiki [arch|atl]",
aliases=["wk"],
)
async def wiki(self, ctx: commands.Context[commands.Bot]) -> None:
async def wiki(self, ctx: commands.Context[Tux]) -> None:
"""
Wiki related commands.
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
"""
@ -103,13 +104,13 @@ class Wiki(commands.Cog):
name="arch",
usage="wiki arch [query]",
)
async def arch_wiki(self, ctx: commands.Context[commands.Bot], query: str) -> None:
async def arch_wiki(self, ctx: commands.Context[Tux], query: str) -> None:
"""
Search the Arch Linux Wiki
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
query : str
The search query.
@ -133,13 +134,13 @@ class Wiki(commands.Cog):
name="atl",
usage="wiki atl [query]",
)
async def atl_wiki(self, ctx: commands.Context[commands.Bot], query: str) -> None:
async def atl_wiki(self, ctx: commands.Context[Tux], query: str) -> None:
"""
Search the All Things Linux Wiki
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The context object for the command.
query : str
The search query.
@ -160,5 +161,5 @@ class Wiki(commands.Cog):
await ctx.send(embed=embed)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(Wiki(bot))

View file

@ -4,9 +4,11 @@ from typing import NoReturn
import discord
from discord.ext import commands
from tux.bot import Tux
class ActivityHandler(commands.Cog):
def __init__(self, bot: commands.Bot, delay: int = 5 * 60) -> None:
def __init__(self, bot: Tux, delay: int = 5 * 60) -> None:
self.bot = bot
self.delay = delay
self.activities = self.build_activity_list()
@ -59,5 +61,5 @@ class ActivityHandler(commands.Cog):
await asyncio.gather(activity_task)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(ActivityHandler(bot))

View file

@ -6,6 +6,7 @@ from discord import app_commands
from discord.ext import commands
from loguru import logger
from tux.bot import Tux
from tux.utils.embeds import create_error_embed
from tux.utils.exceptions import AppCommandPermissionLevelError, PermissionLevelError
@ -141,7 +142,7 @@ error_map: dict[type[Exception], str] = {
class ErrorHandler(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
self.error_message = "An error occurred. Please try again later or contact support."
@ -184,7 +185,7 @@ class ErrorHandler(commands.Cog):
@commands.Cog.listener()
async def on_command_error(
self,
ctx: commands.Context[commands.Bot],
ctx: commands.Context[Tux],
error: commands.CommandError | commands.CheckFailure,
) -> None:
"""
@ -192,7 +193,7 @@ class ErrorHandler(commands.Cog):
Parameters
----------
ctx : commands.Context[commands.Bot]
ctx : commands.Context[Tux]
The discord context object.
error : commands.CommandError | commands.CheckFailure
The error that occurred.
@ -243,7 +244,7 @@ class ErrorHandler(commands.Cog):
def get_error_message(
self,
error: Exception,
ctx: commands.Context[commands.Bot] | None = None,
ctx: commands.Context[Tux] | None = None,
) -> str:
"""
Get the error message for a given error.
@ -252,7 +253,7 @@ class ErrorHandler(commands.Cog):
----------
error : Exception
The error that occurred.
ctx : commands.Context[commands.Bot], optional
ctx : commands.Context[Tux], optional
The discord context object, by default None
"""
if ctx:
@ -275,5 +276,5 @@ class ErrorHandler(commands.Cog):
sentry_sdk.capture_exception(error)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(ErrorHandler(bot))

View file

@ -1,12 +1,13 @@
import discord
from discord.ext import commands
from tux.bot import Tux
from tux.database.controllers import DatabaseController
from tux.utils.functions import is_harmful, strip_formatting
class EventHandler(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
def __init__(self, bot: Tux) -> None:
self.bot = bot
self.db = DatabaseController()
@ -98,5 +99,5 @@ class EventHandler(commands.Cog):
await channel.send(content=support_role, embed=embed)
async def setup(bot: commands.Bot) -> None:
async def setup(bot: Tux) -> None:
await bot.add_cog(EventHandler(bot))

View file

@ -1,13 +1,13 @@
import discord
from discord.ext import commands
from loguru import logger
from tux.bot import Tux
from tux.database.controllers import DatabaseController
from tux.utils.embeds import EmbedCreator
class ReportModal(discord.ui.Modal):
def __init__(self, *, title: str = "Submit an anonymous report", bot: commands.Bot) -> None:
def __init__(self, *, title: str = "Submit an anonymous report", bot: Tux) -> None:
super().__init__(title=title)
self.bot = bot
self.config = DatabaseController().guild_config

View file

@ -5,6 +5,7 @@ from discord import app_commands
from discord.ext import commands
from loguru import logger
from tux.bot import Tux
from tux.database.controllers import DatabaseController
from tux.utils.constants import CONST
from tux.utils.exceptions import AppCommandPermissionLevelError, PermissionLevelError
@ -13,7 +14,7 @@ db = DatabaseController().guild_config
async def has_permission(
source: commands.Context[commands.Bot] | discord.Interaction,
source: commands.Context[Tux] | discord.Interaction,
lower_bound: int,
higher_bound: int | None = None,
) -> bool:
@ -22,7 +23,7 @@ async def has_permission(
Parameters
----------
source : commands.Context[commands.Bot] | discord.Interaction
source : commands.Context[Tux] | discord.Interaction
The source of the command.
lower_bound : int
The lower bound of the permission level.
@ -182,7 +183,7 @@ async def check_sysadmin_or_owner(
async def level_to_name(
source: commands.Context[commands.Bot] | discord.Interaction,
source: commands.Context[Tux] | discord.Interaction,
level: int,
or_higher: bool = False,
) -> str:
@ -191,7 +192,7 @@ async def level_to_name(
Parameters
----------
source : commands.Context[commands.Bot] | discord.Interaction
source : commands.Context[Tux] | discord.Interaction
The source of the command.
level : int
The permission level.
@ -257,7 +258,7 @@ async def get_role_name_from_source(
async def get_perm_level_role_id(
source: commands.Context[commands.Bot] | discord.Interaction,
source: commands.Context[Tux] | discord.Interaction,
level: str,
) -> int | None:
"""
@ -265,7 +266,7 @@ async def get_perm_level_role_id(
Parameters
----------
source : commands.Context[commands.Bot] | discord.Interaction
source : commands.Context[Tux] | discord.Interaction
The source of the command.
level : str
The permission level.
@ -286,7 +287,7 @@ async def get_perm_level_role_id(
async def get_perm_level_roles(
source: commands.Context[commands.Bot] | discord.Interaction,
source: commands.Context[Tux] | discord.Interaction,
lower_bound: int,
) -> list[int] | None:
"""
@ -294,7 +295,7 @@ async def get_perm_level_roles(
Parameters
----------
source : commands.Context[commands.Bot] | discord.Interaction
source : commands.Context[Tux] | discord.Interaction
The source of the command.
lower_bound : int
The lower bound of the permission level.
@ -348,7 +349,7 @@ def has_pl(level: int, or_higher: bool = True):
Whether to include "or higher" in the name, by default True.
"""
async def predicate(ctx: commands.Context[commands.Bot] | discord.Interaction) -> bool:
async def predicate(ctx: commands.Context[Tux] | discord.Interaction) -> bool:
if isinstance(ctx, discord.Interaction):
logger.error("Incorrect checks decorator used. Please use ac_has_pl instead.")
msg = "Incorrect checks decorator used. Please use ac_has_pl instead and report this as a issue."
@ -381,7 +382,7 @@ def ac_has_pl(level: int, or_higher: bool = True):
Whether to include "or higher" in the name, by default True.
"""
async def predicate(ctx: commands.Context[commands.Bot] | discord.Interaction) -> bool:
async def predicate(ctx: commands.Context[Tux] | discord.Interaction) -> bool:
if isinstance(ctx, commands.Context):
logger.error("Incorrect checks decorator used. Please use has_pl instead.")
msg = "Incorrect checks decorator used. Please use has_pl instead and report this as a issue."