diff --git a/videoarchiver/core/commands/archiver_commands.py b/videoarchiver/core/commands/archiver_commands.py index 4e7e0a4..50ad42f 100644 --- a/videoarchiver/core/commands/archiver_commands.py +++ b/videoarchiver/core/commands/archiver_commands.py @@ -1,7 +1,8 @@ """Module for core archiver commands""" import discord -from redbot.core.commands import Context, hybrid_group, guild_only, checks +from redbot.core.commands import Context, hybrid_group, guild_only +from redbot.core.utils.mod import admin_or_permissions from discord import app_commands import logging from ..response_handler import handle_response @@ -22,7 +23,7 @@ def setup_archiver_commands(cog): @archiver.command(name="enable") @guild_only() - @checks.admin_or_permissions(administrator=True) + @admin_or_permissions(administrator=True) async def enable_archiver(ctx: Context): """Enable video archiving in this server.""" try: @@ -44,7 +45,7 @@ def setup_archiver_commands(cog): @archiver.command(name="disable") @guild_only() - @checks.admin_or_permissions(administrator=True) + @admin_or_permissions(administrator=True) async def disable_archiver(ctx: Context): """Disable video archiving in this server.""" try: diff --git a/videoarchiver/core/commands/database_commands.py b/videoarchiver/core/commands/database_commands.py index 25cc66b..1f3e5e3 100644 --- a/videoarchiver/core/commands/database_commands.py +++ b/videoarchiver/core/commands/database_commands.py @@ -1,7 +1,8 @@ """Module for database-related commands""" import discord -from redbot.core.commands import Context, hybrid_group, hybrid_command, guild_only, checks +from redbot.core.commands import Context, hybrid_group, hybrid_command, guild_only +from redbot.core.utils.mod import admin_or_permissions from discord import app_commands import logging from ..response_handler import handle_response @@ -23,7 +24,7 @@ def setup_database_commands(cog): @archivedb.command(name="enable") @guild_only() - @checks.admin_or_permissions(administrator=True) + @admin_or_permissions(administrator=True) async def enable_database(ctx: Context): """Enable the video archive database.""" try: @@ -65,7 +66,7 @@ def setup_database_commands(cog): @archivedb.command(name="disable") @guild_only() - @checks.admin_or_permissions(administrator=True) + @admin_or_permissions(administrator=True) async def disable_database(ctx: Context): """Disable the video archive database.""" try: diff --git a/videoarchiver/core/commands/settings_commands.py b/videoarchiver/core/commands/settings_commands.py index 0dd3453..279a523 100644 --- a/videoarchiver/core/commands/settings_commands.py +++ b/videoarchiver/core/commands/settings_commands.py @@ -1,7 +1,8 @@ """Module for settings-related commands""" import discord -from redbot.core.commands import Context, hybrid_command, guild_only, checks +from redbot.core.commands import Context, hybrid_command, guild_only +from redbot.core.utils.mod import admin_or_permissions from discord import app_commands import logging from ..response_handler import handle_response @@ -13,7 +14,7 @@ def setup_settings_commands(cog): @cog.hybrid_command(name="setchannel") @guild_only() - @checks.admin_or_permissions(administrator=True) + @admin_or_permissions(administrator=True) @app_commands.describe(channel="The channel where archived videos will be stored") async def set_archive_channel(ctx: Context, channel: discord.TextChannel): """Set the channel where archived videos will be stored.""" @@ -36,7 +37,7 @@ def setup_settings_commands(cog): @cog.hybrid_command(name="setlog") @guild_only() - @checks.admin_or_permissions(administrator=True) + @admin_or_permissions(administrator=True) @app_commands.describe(channel="The channel where log messages will be sent") async def set_log_channel(ctx: Context, channel: discord.TextChannel): """Set the channel where log messages will be sent.""" @@ -59,7 +60,7 @@ def setup_settings_commands(cog): @cog.hybrid_command(name="addchannel") @guild_only() - @checks.admin_or_permissions(administrator=True) + @admin_or_permissions(administrator=True) @app_commands.describe(channel="The channel to monitor for videos") async def add_enabled_channel(ctx: Context, channel: discord.TextChannel): """Add a channel to monitor for videos.""" @@ -92,7 +93,7 @@ def setup_settings_commands(cog): @cog.hybrid_command(name="removechannel") @guild_only() - @checks.admin_or_permissions(administrator=True) + @admin_or_permissions(administrator=True) @app_commands.describe(channel="The channel to stop monitoring") async def remove_enabled_channel(ctx: Context, channel: discord.TextChannel): """Remove a channel from video monitoring.""" @@ -125,7 +126,7 @@ def setup_settings_commands(cog): @cog.hybrid_command(name="setformat") @guild_only() - @checks.admin_or_permissions(administrator=True) + @admin_or_permissions(administrator=True) @app_commands.describe(format="The video format to use (mp4, webm, or mkv)") async def set_video_format(ctx: Context, format: str): """Set the video format for archived videos.""" @@ -153,7 +154,7 @@ def setup_settings_commands(cog): @cog.hybrid_command(name="setquality") @guild_only() - @checks.admin_or_permissions(administrator=True) + @admin_or_permissions(administrator=True) @app_commands.describe(quality="The video quality (144-4320)") async def set_video_quality(ctx: Context, quality: int): """Set the video quality for archived videos.""" @@ -182,7 +183,7 @@ def setup_settings_commands(cog): @cog.hybrid_command(name="setmaxsize") @guild_only() - @checks.admin_or_permissions(administrator=True) + @admin_or_permissions(administrator=True) @app_commands.describe(size="The maximum file size in MB (1-100)") async def set_max_file_size(ctx: Context, size: int): """Set the maximum file size for archived videos.""" @@ -209,7 +210,7 @@ def setup_settings_commands(cog): @cog.hybrid_command(name="setmessageduration") @guild_only() - @checks.admin_or_permissions(administrator=True) + @admin_or_permissions(administrator=True) @app_commands.describe(hours="How long to keep messages in hours (0-168)") async def set_message_duration(ctx: Context, hours: int): """Set how long to keep archived messages.""" @@ -238,7 +239,7 @@ def setup_settings_commands(cog): @cog.hybrid_command(name="settemplate") @guild_only() - @checks.admin_or_permissions(administrator=True) + @admin_or_permissions(administrator=True) @app_commands.describe( template="The message template to use. Available placeholders: {author}, {channel}, {original_message}" ) @@ -272,7 +273,7 @@ def setup_settings_commands(cog): @cog.hybrid_command(name="setconcurrent") @guild_only() - @checks.admin_or_permissions(administrator=True) + @admin_or_permissions(administrator=True) @app_commands.describe(count="Number of concurrent downloads (1-5)") async def set_concurrent_downloads(ctx: Context, count: int): """Set the number of concurrent downloads allowed."""