24
24
from discord .ext import commands , menus
25
25
from libs .tickets .utils import get_cached_thread
26
26
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
+ )
28
32
from libs .utils .embeds import CooldownEmbed , Embed
29
33
from libs .utils .pages import SimplePages
30
34
from libs .utils .pages .paginator import RoboPages
33
37
34
38
if TYPE_CHECKING :
35
39
from cogs .tickets import Tickets
40
+
36
41
from rodhaj import Rodhaj
37
42
38
43
@@ -471,7 +476,7 @@ async def _handle_error(
471
476
elif isinstance (error , commands .BadArgument ):
472
477
await ctx .send (str (error ))
473
478
474
- @check_permissions ( manage_guild = True )
479
+ @is_manager ( )
475
480
@bot_check_permissions (manage_channels = True , manage_webhooks = True )
476
481
@commands .guild_only ()
477
482
@commands .group (name = "rodhaj" )
@@ -480,7 +485,7 @@ async def rodhaj(self, ctx: GuildContext) -> None:
480
485
if ctx .invoked_subcommand is None :
481
486
await ctx .send_help (ctx .command )
482
487
483
- @check_permissions ( manage_guild = True )
488
+ @is_manager ( )
484
489
@bot_check_permissions (manage_channels = True , manage_webhooks = True )
485
490
@commands .cooldown (1 , 20 , commands .BucketType .guild )
486
491
@commands .guild_only ()
@@ -644,7 +649,7 @@ async def setup(self, ctx: GuildContext, *, flags: SetupFlags) -> None:
644
649
msg = f"Rodhaj channels successfully created! The ticket channel can be found under { ticket_channel .mention } "
645
650
await ctx .send (msg )
646
651
647
- @check_permissions ( manage_guild = True )
652
+ @is_manager ( )
648
653
@bot_check_permissions (manage_channels = True , manage_webhooks = True )
649
654
@commands .cooldown (1 , 20 , commands .BucketType .guild )
650
655
@commands .guild_only ()
@@ -710,15 +715,15 @@ async def on_delete_error(
710
715
) -> None :
711
716
await self ._handle_error (error , ctx = ctx )
712
717
713
- @check_permissions ( manage_guild = True )
718
+ @is_manager ( )
714
719
@commands .guild_only ()
715
720
@commands .hybrid_group (name = "config" )
716
721
async def config (self , ctx : GuildContext ) -> None :
717
722
"""Modifiable configuration layer for Rodhaj"""
718
723
if ctx .invoked_subcommand is None :
719
724
await ctx .send_help (ctx .command )
720
725
721
- @check_permissions ( manage_guild = True )
726
+ @is_manager ( )
722
727
@commands .guild_only ()
723
728
@config .command (name = "options" , usage = "active: <bool>" )
724
729
async def config_options (
@@ -742,7 +747,7 @@ async def config_options(
742
747
pages = ConfigPages (guild_settings .to_dict (), ctx = ctx , active = flags .active )
743
748
await pages .start ()
744
749
745
- @check_permissions ( manage_guild = True )
750
+ @is_manager ( )
746
751
@commands .guild_only ()
747
752
@config .command (name = "set-age" )
748
753
async def config_set_age (
@@ -772,7 +777,7 @@ async def config_set_age(
772
777
self .get_guild_settings .cache_invalidate (ctx .guild .id )
773
778
await ctx .send (f"Set `{ type } _age` to `{ duration .td } `" )
774
779
775
- @check_permissions ( manage_guild = True )
780
+ @is_manager ( )
776
781
@commands .guild_only ()
777
782
@config .command (name = "set" )
778
783
async def config_set (
@@ -800,7 +805,7 @@ async def config_set(
800
805
801
806
await self .set_guild_settings (key , value , config_type = ConfigType .SET , ctx = ctx )
802
807
803
- @check_permissions ( manage_guild = True )
808
+ @is_manager ( )
804
809
@commands .guild_only ()
805
810
@config .command (name = "toggle" )
806
811
async def config_toggle (
@@ -845,7 +850,7 @@ async def on_config_toggle_error(
845
850
):
846
851
await self ._handle_error (error , ctx = ctx )
847
852
848
- @check_permissions ( manage_guild = True )
853
+ @is_manager ( )
849
854
@commands .guild_only ()
850
855
@config .group (name = "prefix" , fallback = "info" )
851
856
async def prefix (self , ctx : GuildContext ) -> None :
@@ -862,7 +867,7 @@ async def prefix(self, ctx: GuildContext) -> None:
862
867
embed .set_author (name = ctx .guild .name , icon_url = ctx .guild .icon .url ) # type: ignore
863
868
await ctx .send (embed = embed )
864
869
865
- @check_permissions ( manage_guild = True )
870
+ @is_manager ( )
866
871
@commands .guild_only ()
867
872
@prefix .command (name = "add" )
868
873
@app_commands .describe (prefix = "The new prefix to add" )
@@ -891,7 +896,7 @@ async def prefix_add(
891
896
get_prefix .cache_invalidate (self .bot , ctx .message )
892
897
await ctx .send (f"Added prefix: `{ prefix } `" )
893
898
894
- @check_permissions ( manage_guild = True )
899
+ @is_manager ( )
895
900
@commands .guild_only ()
896
901
@prefix .command (name = "edit" )
897
902
@app_commands .describe (
@@ -920,7 +925,7 @@ async def prefix_edit(
920
925
else :
921
926
await ctx .send ("The prefix is not in the list of prefixes for your server" )
922
927
923
- @check_permissions ( manage_guild = True )
928
+ @is_manager ( )
924
929
@commands .guild_only ()
925
930
@prefix .command (name = "delete" )
926
931
@app_commands .describe (prefix = "The prefix to delete" )
0 commit comments