feat(owner): make owner commands be avaliable in dms

This commit is contained in:
neoarz
2025-09-22 10:22:06 -04:00
parent deef9156fa
commit 84d3e5df33
6 changed files with 24 additions and 2 deletions

View File

@@ -30,6 +30,8 @@ class Help(commands.Cog, name="help"):
@commands.hybrid_command( @commands.hybrid_command(
name="help", description="List all commands the bot has loaded." name="help", description="List all commands the bot has loaded."
) )
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
@app_commands.describe(category="Choose a specific category to view its commands") @app_commands.describe(category="Choose a specific category to view its commands")
@app_commands.autocomplete(category=category_autocomplete) @app_commands.autocomplete(category=category_autocomplete)
async def help(self, context: Context, category: str = None) -> None: async def help(self, context: Context, category: str = None) -> None:

View File

@@ -22,6 +22,8 @@ class CogManagement(commands.Cog, name="cog_management"):
name="load", name="load",
description="Load a cog", description="Load a cog",
) )
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
@app_commands.describe(cog="The name of the cog to load") @app_commands.describe(cog="The name of the cog to load")
@commands.is_owner() @commands.is_owner()
async def load(self, context: Context, cog: str) -> None: async def load(self, context: Context, cog: str) -> None:
@@ -51,6 +53,8 @@ class CogManagement(commands.Cog, name="cog_management"):
name="unload", name="unload",
description="Unloads a cog.", description="Unloads a cog.",
) )
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
@app_commands.describe(cog="The name of the cog to unload") @app_commands.describe(cog="The name of the cog to unload")
@commands.is_owner() @commands.is_owner()
async def unload(self, context: Context, cog: str) -> None: async def unload(self, context: Context, cog: str) -> None:
@@ -80,6 +84,8 @@ class CogManagement(commands.Cog, name="cog_management"):
name="reload", name="reload",
description="Reloads a cog.", description="Reloads a cog.",
) )
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
@app_commands.describe(cog="The name of the cog to reload") @app_commands.describe(cog="The name of the cog to reload")
@commands.is_owner() @commands.is_owner()
async def reload(self, context: Context, cog: str) -> None: async def reload(self, context: Context, cog: str) -> None:

View File

@@ -1,5 +1,6 @@
import os import os
import discord import discord
from discord import app_commands
from discord.ext import commands from discord.ext import commands
from discord.ext.commands import Context from discord.ext.commands import Context
@@ -22,6 +23,8 @@ class Invite(commands.Cog, name="invite"):
name="invite", name="invite",
description="Get the invite link of the bot to be able to invite it.", description="Get the invite link of the bot to be able to invite it.",
) )
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
@commands.is_owner() @commands.is_owner()
async def invite(self, context: Context) -> None: async def invite(self, context: Context) -> None:
""" """

View File

@@ -22,6 +22,8 @@ class Say(commands.Cog, name="say"):
name="say", name="say",
description="The bot will say anything you want.", description="The bot will say anything you want.",
) )
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
@app_commands.describe(message="The message that should be repeated by the bot") @app_commands.describe(message="The message that should be repeated by the bot")
@commands.is_owner() @commands.is_owner()
async def say(self, context: Context, *, message: str) -> None: async def say(self, context: Context, *, message: str) -> None:
@@ -37,6 +39,8 @@ class Say(commands.Cog, name="say"):
name="embed", name="embed",
description="The bot will say anything you want, but within embeds.", description="The bot will say anything you want, but within embeds.",
) )
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
@app_commands.describe(message="The message that should be repeated by the bot") @app_commands.describe(message="The message that should be repeated by the bot")
@commands.is_owner() @commands.is_owner()
async def embed(self, context: Context, *, message: str) -> None: async def embed(self, context: Context, *, message: str) -> None:

View File

@@ -1,6 +1,7 @@
import os import os
import signal import signal
import discord import discord
from discord import app_commands
from discord.ext import commands from discord.ext import commands
from discord.ext.commands import Context from discord.ext.commands import Context
@@ -23,6 +24,8 @@ class Shutdown(commands.Cog, name="shutdown"):
name="shutdown", name="shutdown",
description="Make the bot shutdown.", description="Make the bot shutdown.",
) )
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
@commands.is_owner() @commands.is_owner()
async def shutdown(self, context: Context) -> None: async def shutdown(self, context: Context) -> None:
""" """

View File

@@ -18,10 +18,12 @@ class Sync(commands.Cog, name="sync"):
else: else:
await context.send(embed=embed) await context.send(embed=embed)
@commands.command( @commands.hybrid_command(
name="sync", name="sync",
description="Synchonizes the slash commands.", description="Synchonizes the slash commands.",
) )
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
@app_commands.describe(scope="The scope of the sync. Can be `global` or `guild`") @app_commands.describe(scope="The scope of the sync. Can be `global` or `guild`")
@commands.is_owner() @commands.is_owner()
async def sync(self, context: Context, scope: str) -> None: async def sync(self, context: Context, scope: str) -> None:
@@ -60,10 +62,12 @@ class Sync(commands.Cog, name="sync"):
embed.set_author(name="Owner", icon_url="https://yes.nighty.works/raw/zReOib.webp") embed.set_author(name="Owner", icon_url="https://yes.nighty.works/raw/zReOib.webp")
await self.send_embed(context, embed, ephemeral=True) await self.send_embed(context, embed, ephemeral=True)
@commands.command( @commands.hybrid_command(
name="unsync", name="unsync",
description="Unsynchonizes the slash commands.", description="Unsynchonizes the slash commands.",
) )
@app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
@app_commands.allowed_installs(guilds=True, users=True)
@app_commands.describe( @app_commands.describe(
scope="The scope of the sync. Can be `global`, `current_guild` or `guild`" scope="The scope of the sync. Can be `global`, `current_guild` or `guild`"
) )