diff --git a/TODO.md b/TODO.md index 3cf7e08..1786425 100644 --- a/TODO.md +++ b/TODO.md @@ -33,7 +33,7 @@ - [ ] Move all assets to gh -- [ ] Add codepreview for pull requests +- [x] Add codepreview for pull requests - [x] Add try it and see command diff --git a/cogs/fun/__init__.py b/cogs/fun/__init__.py index 18420de..037a493 100644 --- a/cogs/fun/__init__.py +++ b/cogs/fun/__init__.py @@ -1,4 +1,5 @@ import discord +from discord import app_commands from discord.ext import commands from discord.ext.commands import Context @@ -8,6 +9,9 @@ from .minesweeper import minesweeper_command from .randomfact import randomfact_command from .rockpaperscissors import rps_command + +@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True) +@app_commands.allowed_installs(guilds=True, users=True) class Fun(commands.GroupCog, name="fun"): def __init__(self, bot) -> None: self.bot = bot @@ -66,6 +70,8 @@ class Fun(commands.GroupCog, name="fun"): name="coinflip", description="Make a coin flip, but give your bet before." ) + @app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True) + @app_commands.allowed_installs(guilds=True, users=True) async def coinflip(self, context): return await coinflip_command()(self, context) @@ -74,6 +80,8 @@ class Fun(commands.GroupCog, name="fun"): name="8ball", description="Ask any question to the bot.", ) + @app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True) + @app_commands.allowed_installs(guilds=True, users=True) async def eight_ball(self, context, *, question: str): return await eightball_command()(self, context, question=question) @@ -82,11 +90,15 @@ class Fun(commands.GroupCog, name="fun"): name="minesweeper", description="Play a buttoned minesweeper mini-game." ) + @app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True) + @app_commands.allowed_installs(guilds=True, users=True) async def minesweeper(self, context): return await minesweeper_command()(self, context) @commands.check(_require_group_prefix) @commands.hybrid_command(name="randomfact", description="Get a random fact.") + @app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True) + @app_commands.allowed_installs(guilds=True, users=True) async def randomfact(self, context): return await randomfact_command()(self, context) @@ -94,6 +106,8 @@ class Fun(commands.GroupCog, name="fun"): @commands.hybrid_command( name="rps", description="Play the rock paper scissors game against the bot." ) + @app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True) + @app_commands.allowed_installs(guilds=True, users=True) async def rock_paper_scissors(self, context): return await rps_command()(self, context) diff --git a/cogs/general/__init__.py b/cogs/general/__init__.py index 56826ff..e83d69a 100644 --- a/cogs/general/__init__.py +++ b/cogs/general/__init__.py @@ -20,6 +20,9 @@ def _require_group_prefix(context: Context) -> bool: content = context.message.content.strip().lower() return content.startswith(f"{prefix}{group} ") + +@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True) +@app_commands.allowed_installs(guilds=True, users=True) class General(commands.GroupCog, name="general"): def __init__(self, bot) -> None: self.bot = bot diff --git a/cogs/idevice/__init__.py b/cogs/idevice/__init__.py index de3ad81..57d74c6 100644 --- a/cogs/idevice/__init__.py +++ b/cogs/idevice/__init__.py @@ -9,6 +9,9 @@ from .developermode import developermode_command from .noapps import noapps_command from .mountddi import mountddi_command + +@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True) +@app_commands.allowed_installs(guilds=True, users=True) class Idevice(commands.GroupCog, name="idevice"): def __init__(self, bot) -> None: self.bot = bot diff --git a/cogs/media/__init__.py b/cogs/media/__init__.py index f91057e..fae9fce 100644 --- a/cogs/media/__init__.py +++ b/cogs/media/__init__.py @@ -1,4 +1,5 @@ import discord +from discord import app_commands from discord.ext import commands from discord.ext.commands import Context from typing import Optional @@ -20,6 +21,9 @@ def _require_group_prefix(context: Context) -> bool: content = context.message.content.strip().lower() return content.startswith(f"{prefix}{group} ") + +@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True) +@app_commands.allowed_installs(guilds=True, users=True) class Media(commands.GroupCog, name="media"): def __init__(self, bot) -> None: self.bot = bot diff --git a/cogs/melonx/__init__.py b/cogs/melonx/__init__.py index 8b3a753..537e599 100644 --- a/cogs/melonx/__init__.py +++ b/cogs/melonx/__init__.py @@ -11,6 +11,9 @@ from .requirements import requirements_command from .error import error_command from .ios26 import ios26_command + +@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True) +@app_commands.allowed_installs(guilds=True, users=True) class Melonx(commands.GroupCog, name="melonx"): def __init__(self, bot) -> None: self.bot = bot diff --git a/cogs/miscellaneous/__init__.py b/cogs/miscellaneous/__init__.py index dabb387..b3cecbd 100644 --- a/cogs/miscellaneous/__init__.py +++ b/cogs/miscellaneous/__init__.py @@ -1,4 +1,5 @@ import discord +from discord import app_commands from discord.ext import commands from discord.ext.commands import Context @@ -13,6 +14,9 @@ from .support import support_command from .docs import docs_command from .sigma import sigma_command + +@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True) +@app_commands.allowed_installs(guilds=True, users=True) class Miscellaneous(commands.GroupCog, name="misc"): def __init__(self, bot) -> None: self.bot = bot diff --git a/cogs/moderation/__init__.py b/cogs/moderation/__init__.py index daec7b7..350a737 100644 --- a/cogs/moderation/__init__.py +++ b/cogs/moderation/__init__.py @@ -12,6 +12,9 @@ from .hackban import hackban_command from .nick import nick_command from .timeout import timeout_command + +@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True) +@app_commands.allowed_installs(guilds=True, users=True) class Moderation(commands.GroupCog, name="moderation"): def __init__(self, bot) -> None: self.bot = bot diff --git a/cogs/sidestore/__init__.py b/cogs/sidestore/__init__.py index 6c28437..7b0049d 100644 --- a/cogs/sidestore/__init__.py +++ b/cogs/sidestore/__init__.py @@ -14,6 +14,9 @@ from .udid import udid_command from .half import half_command from .sparse import sparse_command + +@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True) +@app_commands.allowed_installs(guilds=True, users=True) class Sidestore(commands.GroupCog, name="sidestore"): def __init__(self, bot) -> None: self.bot = bot diff --git a/cogs/utilities/__init__.py b/cogs/utilities/__init__.py index 94f66b0..c05a9fa 100644 --- a/cogs/utilities/__init__.py +++ b/cogs/utilities/__init__.py @@ -7,6 +7,9 @@ from .translate import translate_command, language_autocomplete from .codepreview import codepreview_command from .dictionary import dictionary_command + +@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True) +@app_commands.allowed_installs(guilds=True, users=True) class Utilities(commands.GroupCog, name="utils"): def __init__(self, bot) -> None: self.bot = bot diff --git a/database/__init__.py b/database/__init__.py index 80ebe15..f5c3abb 100644 --- a/database/__init__.py +++ b/database/__init__.py @@ -1,5 +1,3 @@ -# Copyright © Krypton 2019-Present - https://github.com/kkrypt0nn/Python-Discord-Bot-Template/blob/main/database/__init__.py - import aiosqlite diff --git a/database/schema.sql b/database/schema.sql index 892c418..52b109e 100644 --- a/database/schema.sql +++ b/database/schema.sql @@ -1,5 +1,3 @@ --- Copyright © Krypton 2019-Present - https://github.com/kkrypt0nn/Python-Discord-Bot-Template/blob/main/database/schema.sql - CREATE TABLE IF NOT EXISTS `warns` ( `id` int(11) NOT NULL, `user_id` varchar(20) NOT NULL,