A library to simplify userscript creation for Multiplayer Piano.
Questo script non dovrebbe essere installato direttamente. È una libreria per altri script da includere con la chiave // @require https://update.greasyfork.org/scripts/582107/1849133/MPP%20Userscript%20Core.js
registerCommand(commandName, commandFunction, {...additionalOptions}): Self-explanatory. Note that the options aliases and rank may be used by the library, so you should be carfeful to not use those options for anything else.
send(message): Self-explanatory.
receive(message, userInfo, date): Receives a message in chat, but it can only be seen by the user.
storeItem(itemName, itemData): Stores an item to localStorage. Will automatically stringify the item data before storing.
readItem(itemName, fallbackValue): Reads an item from localStorage. Will automatically convert the item data to its true type (e.g. to an array) before storing.
findUsers(searchQuery): Finds all users that have a usename or ID that matches with the search query. Both the search query and the ID & username being searched are normalized in the same way.
findUser(searchQuery): Returns the first result of doing findUsers(searchQuery), and returns null when no user was found.
clearUserRank(targetUserID): Removes all ranks attached to the user ID given.
getUserRank(userID): Self-explanatory.
setUserRank(userID, rankIDorName): Self-explanatory. As the pseudo-argument says, the function can take in the ID (e.g. -12) and name (e.g. 'admin') of a rank.
setPrivate(privacy): Self-explanatory.
setPrefix(newPrefix): Self-explanatory.