Skip to content

Commit d360d20

Browse files
committed
replace checks with better ones
1 parent 600bb7d commit d360d20

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

bot/cogs/config.py

+18-13
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
from discord.ext import commands, menus
2525
from libs.tickets.utils import get_cached_thread
2626
from libs.utils import GuildContext
27-
from libs.utils.checks import bot_check_permissions, check_permissions
27+
from libs.utils.checks import (
28+
bot_check_permissions,
29+
check_permissions,
30+
is_manager,
31+
)
2832
from libs.utils.embeds import CooldownEmbed, Embed
2933
from libs.utils.pages import SimplePages
3034
from libs.utils.pages.paginator import RoboPages
@@ -33,6 +37,7 @@
3337

3438
if TYPE_CHECKING:
3539
from cogs.tickets import Tickets
40+
3641
from rodhaj import Rodhaj
3742

3843

@@ -471,7 +476,7 @@ async def _handle_error(
471476
elif isinstance(error, commands.BadArgument):
472477
await ctx.send(str(error))
473478

474-
@check_permissions(manage_guild=True)
479+
@is_manager()
475480
@bot_check_permissions(manage_channels=True, manage_webhooks=True)
476481
@commands.guild_only()
477482
@commands.group(name="rodhaj")
@@ -480,7 +485,7 @@ async def rodhaj(self, ctx: GuildContext) -> None:
480485
if ctx.invoked_subcommand is None:
481486
await ctx.send_help(ctx.command)
482487

483-
@check_permissions(manage_guild=True)
488+
@is_manager()
484489
@bot_check_permissions(manage_channels=True, manage_webhooks=True)
485490
@commands.cooldown(1, 20, commands.BucketType.guild)
486491
@commands.guild_only()
@@ -644,7 +649,7 @@ async def setup(self, ctx: GuildContext, *, flags: SetupFlags) -> None:
644649
msg = f"Rodhaj channels successfully created! The ticket channel can be found under {ticket_channel.mention}"
645650
await ctx.send(msg)
646651

647-
@check_permissions(manage_guild=True)
652+
@is_manager()
648653
@bot_check_permissions(manage_channels=True, manage_webhooks=True)
649654
@commands.cooldown(1, 20, commands.BucketType.guild)
650655
@commands.guild_only()
@@ -710,15 +715,15 @@ async def on_delete_error(
710715
) -> None:
711716
await self._handle_error(error, ctx=ctx)
712717

713-
@check_permissions(manage_guild=True)
718+
@is_manager()
714719
@commands.guild_only()
715720
@commands.hybrid_group(name="config")
716721
async def config(self, ctx: GuildContext) -> None:
717722
"""Modifiable configuration layer for Rodhaj"""
718723
if ctx.invoked_subcommand is None:
719724
await ctx.send_help(ctx.command)
720725

721-
@check_permissions(manage_guild=True)
726+
@is_manager()
722727
@commands.guild_only()
723728
@config.command(name="options", usage="active: <bool>")
724729
async def config_options(
@@ -742,7 +747,7 @@ async def config_options(
742747
pages = ConfigPages(guild_settings.to_dict(), ctx=ctx, active=flags.active)
743748
await pages.start()
744749

745-
@check_permissions(manage_guild=True)
750+
@is_manager()
746751
@commands.guild_only()
747752
@config.command(name="set-age")
748753
async def config_set_age(
@@ -772,7 +777,7 @@ async def config_set_age(
772777
self.get_guild_settings.cache_invalidate(ctx.guild.id)
773778
await ctx.send(f"Set `{type}_age` to `{duration.td}`")
774779

775-
@check_permissions(manage_guild=True)
780+
@is_manager()
776781
@commands.guild_only()
777782
@config.command(name="set")
778783
async def config_set(
@@ -800,7 +805,7 @@ async def config_set(
800805

801806
await self.set_guild_settings(key, value, config_type=ConfigType.SET, ctx=ctx)
802807

803-
@check_permissions(manage_guild=True)
808+
@is_manager()
804809
@commands.guild_only()
805810
@config.command(name="toggle")
806811
async def config_toggle(
@@ -845,7 +850,7 @@ async def on_config_toggle_error(
845850
):
846851
await self._handle_error(error, ctx=ctx)
847852

848-
@check_permissions(manage_guild=True)
853+
@is_manager()
849854
@commands.guild_only()
850855
@config.group(name="prefix", fallback="info")
851856
async def prefix(self, ctx: GuildContext) -> None:
@@ -862,7 +867,7 @@ async def prefix(self, ctx: GuildContext) -> None:
862867
embed.set_author(name=ctx.guild.name, icon_url=ctx.guild.icon.url) # type: ignore
863868
await ctx.send(embed=embed)
864869

865-
@check_permissions(manage_guild=True)
870+
@is_manager()
866871
@commands.guild_only()
867872
@prefix.command(name="add")
868873
@app_commands.describe(prefix="The new prefix to add")
@@ -891,7 +896,7 @@ async def prefix_add(
891896
get_prefix.cache_invalidate(self.bot, ctx.message)
892897
await ctx.send(f"Added prefix: `{prefix}`")
893898

894-
@check_permissions(manage_guild=True)
899+
@is_manager()
895900
@commands.guild_only()
896901
@prefix.command(name="edit")
897902
@app_commands.describe(
@@ -920,7 +925,7 @@ async def prefix_edit(
920925
else:
921926
await ctx.send("The prefix is not in the list of prefixes for your server")
922927

923-
@check_permissions(manage_guild=True)
928+
@is_manager()
924929
@commands.guild_only()
925930
@prefix.command(name="delete")
926931
@app_commands.describe(prefix="The prefix to delete")

0 commit comments

Comments
 (0)