Skip to content

Instantly share code, notes, and snippets.

@dcorvus
Last active September 23, 2018 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcorvus/d2817deaafdc56ecc9daabefefec3d73 to your computer and use it in GitHub Desktop.
Save dcorvus/d2817deaafdc56ecc9daabefefec3d73 to your computer and use it in GitHub Desktop.
A backup of General Wrex's NPM Module Installation command.
{
"name": "npm",
"permissions": "NONE",
"restriction": "4",
"_id": "UwRCF",
"actions": [
{
"info": "0",
"infoIndex": "1",
"storage": "1",
"varName": "moduleName",
"name": "Store Command Params"
},
{
"channel": "0",
"varName": "",
"message": "Attempting to install node module: ${tempVars(\"moduleName\")}",
"storage": "0",
"varName2": "",
"name": "Send Message"
},
{
"behavior": "1",
"interpretation": "0",
"code": "\nvar moduleName = tempVars(\"moduleName\");\n\ntry{ \nrequire.resolve(moduleName)\nmsg.channel.send(\"Module '\"+ moduleName + \"' is already installed!\"); \n\n}catch(err){\nmsg.channel.send(\"Installing/Updating node module '\"+ moduleName + \"'\"); \n\nvar theModule = this.getWrexMods().require(moduleName);\n\nif(theModule){\n msg.channel.send(\"\"+ moduleName + \" was installed to the bot!\"); \n}else{\n msg.channel.send(\"Error! Module NOT \"+ moduleName + \" installed to the bot!\"); \n}\n\n}\n\n\n\n \n",
"storage": "0",
"varName": "",
"name": "Run Script"
},
{
"channel": "0",
"varName": "",
"message": "**NPM_INSTALL**: ${tempVars(\"installMessage\")}",
"storage": "0",
"varName2": "",
"name": "Send Message"
}
],
"comType": "0",
"_aliases": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment