2021-04-04 14:29:20 +00:00
// Also set Powercord global var stuff here since entities import is needed to use Plugin (which every PC plugin uses)
2021-04-04 18:00:26 +00:00
export const powercord = {
2021-04-04 14:29:20 +00:00
api : {
commands : {
2021-04-04 14:57:28 +00:00
registerCommand : ( { command , alias , description , usage , executor } ) => {
// TODO: implement alias
2021-04-04 14:29:20 +00:00
goosemodScope . patcher . commands . add ( command , description ,
2021-04-04 16:16:56 +00:00
( { args : [ { text } ] } ) => {
2021-04-04 14:29:20 +00:00
const out = executor ( text . split ( ' ' ) ) ; // Run original executor func
if ( ! out . send ) return ; // PC impl. sends internal message when out.send === true, so we also do the same via our previous Patcher API function, seen below
goosemodScope . patcher . internalMessage ( out . result ) ;
} , [
{ type : 3 , required : false , name : 'args' , description : 'Arguments for PC command' } // Argument for any string for compat. with PC's classical commands
2021-04-04 16:16:56 +00:00
] ) ;
2021-04-04 14:30:48 +00:00
} ,
unregisterCommand : ( command ) => {
goosemodScope . patcher . commands . remove ( command ) ;
2021-04-04 14:29:20 +00:00
}
2021-04-04 14:37:08 +00:00
} ,
notices : {
sendToast : ( _id , { header , content , type , buttons } ) => {
// TODO: implement full toast in future instead of just small current GM toast
goosemodScope . showToast ( content ) ;
}
2021-04-04 14:29:20 +00:00
}
}
} ;
2021-04-04 12:50:12 +00:00
export class Plugin {
constructor ( ) {
2021-04-04 12:55:38 +00:00
}
get goosemodHandlers ( ) {
return {
onImport : this . startPlugin ,
onRemove : this . pluginWillUnload
} ;
2021-04-04 12:50:12 +00:00
}
}