1
+ from discord .ext import commands
2
+ from src .check import Protected , PermissionPreset
3
+
4
+ class DevCommands (commands .Cog , command_attrs = dict (hidden = True ), group_extras = dict (hidden = True )):
5
+ """hidden"""
6
+
7
+ client : commands .Bot
8
+
9
+
10
+ def __init__ (self , client : commands .Bot ):
11
+ self .client = client
12
+
13
+
14
+ @commands .Cog .listener ()
15
+ async def on_ready (self ):
16
+ print ('Developer Commands UP' )
17
+
18
+
19
+ @commands .command ()
20
+ @Protected .legacy (PermissionPreset .Developer )
21
+ async def syncSlashCommands (self , ctx : commands .Context ):
22
+ try :
23
+ Sync = await self .client .tree .sync ()
24
+ print (f'Synced { len (Sync )} command(s)' )
25
+ await ctx .reply (f'{ ctx .author .mention } Synced { len (Sync )} command(s)' )
26
+ except Exception as e :
27
+ print (e )
28
+
29
+ @commands .command ()
30
+ @Protected .legacy (PermissionPreset .Developer )
31
+ async def load (self , ctx : commands .Context , extension ):
32
+ await self .client .load_extension (f'cogs.{ extension } ' )
33
+ await ctx .message .add_reaction ('✅' )
34
+
35
+ @commands .command ()
36
+ @Protected .legacy (PermissionPreset .Developer )
37
+ async def unload (self , ctx : commands .Context , extension ):
38
+ await self .client .unload_extension (f'cogs.{ extension } ' )
39
+ await ctx .message .add_reaction ('✅' )
40
+
41
+ @commands .command ()
42
+ @Protected .legacy (PermissionPreset .Developer )
43
+ async def reload (self , ctx : commands .Context , extension ):
44
+ await self .client .unload_extension (f'cogs.{ extension } ' )
45
+ await self .client .load_extension (f'cogs.{ extension } ' )
46
+ await ctx .message .add_reaction ('✅' )
47
+
48
+
49
+
50
+ async def setup (client : commands .Bot ):
51
+ await client .add_cog (DevCommands (client ))
0 commit comments