@@ -68,47 +68,6 @@ const updateDynamicChoices = async (client, commandNames, Course) => {
68
68
} ) ;
69
69
} ;
70
70
71
- const setCommandPermissions = async ( client ) => {
72
- const loadedCommands = await client . guilds . cache . get ( guildId ) ?. commands . fetch ( ) ;
73
- const createCommandsWithPermission = loadedCommands . filter ( ( command ) => ! command . defaultPermission && client . slashCommands . has ( command . name ) ) ;
74
- const fullPermissions = createCommandsWithPermission . map ( ( command ) => {
75
- const commandObj = client . slashCommands . get ( command . name ) ;
76
- const perms = [ ] ;
77
- commandObj . roles
78
- . forEach ( ( commandRole ) => {
79
- client . guild . roles . cache
80
- . filter ( ( role ) => role . name . includes ( commandRole ) )
81
- . map ( ( r ) => perms . push ( { id : r . id , type : "ROLE" , permission : true } ) ) ;
82
- } ) ;
83
- return {
84
- id : command . id ,
85
- permissions : perms ,
86
- } ;
87
- } ) ;
88
-
89
- for ( let fIndex = 0 , fullLength = fullPermissions . length ; fIndex < fullLength ; fIndex ++ ) {
90
-
91
- if ( fullPermissions [ fIndex ] . permissions . length > 10 ) {
92
-
93
- for ( let pIndex = 0 , permissionLength = fullPermissions [ fIndex ] . permissions . length ; pIndex <= permissionLength ; pIndex += 10 ) {
94
- const slicedList = fullPermissions [ fIndex ] . permissions . slice ( pIndex , pIndex + 10 ) ;
95
- fullPermissions . push (
96
- {
97
- id : fullPermissions [ fIndex ] . id ,
98
- permissions : slicedList ,
99
- } ,
100
- ) ;
101
- }
102
- fullPermissions . splice ( fIndex , 1 ) ;
103
- fIndex -- ;
104
- fullLength -- ;
105
- }
106
- }
107
-
108
- await client . guilds . cache . get ( guildId ) ?. commands . permissions . set ( { fullPermissions } ) ;
109
- console . log ( "Successfully loaded all command permissions." ) ;
110
- } ;
111
-
112
71
const deployCommands = async ( commands ) => {
113
72
const rest = new REST ( { version : "9" } ) . setToken ( token ) ;
114
73
@@ -156,7 +115,6 @@ const loadCommands = (client) => {
156
115
const setUpCommands = async ( client , Course ) => {
157
116
const commands = loadCommands ( client ) ;
158
117
if ( process . env . NODE_ENV === "production" ) await deployCommands ( commands ) ;
159
- await setCommandPermissions ( client ) ;
160
118
await updateDynamicChoices ( client , [ "join" , "leave" , "hide_course" , "unhide_course" , "lock_chat" , "unlock_chat" ] , Course ) ;
161
119
} ;
162
120
0 commit comments