{"_id":"57a7ee8f3754050e0053cbc6","category":{"_id":"57858e1b8a711d2000d1252b","version":"57858bff9e80c32200234f4f","project":"57858bff9e80c32200234f4c","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-07-13T00:40:59.463Z","from_sync":false,"order":1,"slug":"managers","title":"Core Managers"},"project":"57858bff9e80c32200234f4c","__v":0,"user":"57858823fc4a0f2200f02f01","version":{"_id":"57858bff9e80c32200234f4f","__v":3,"project":"57858bff9e80c32200234f4c","createdAt":"2016-07-13T00:31:59.708Z","releaseDate":"2016-07-13T00:31:59.708Z","categories":["57858bff9e80c32200234f50","57858e1b8a711d2000d1252b","5785a2bf2eca4e0e002b4d67"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Stable. I Hope.","version_clean":"0.3.0","version":"0.3.00"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-08-08T02:29:35.566Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":999,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Info\"\n}\n[/block]\n**Name** - `SayManager`\n**Options** :\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"key\",\n    \"h-1\": \"type\",\n    \"h-2\": \"desc\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Commands\"\n}\n[/block]\nThese are the default commands include.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Command\",\n    \"h-1\": \"Run\",\n    \"h-2\": \"Context\",\n    \"h-3\": \"Desc\",\n    \"h-4\": \"Usage\",\n    \"0-0\": \"addSay\",\n    \"0-1\": \"cmdAddSay\",\n    \"0-2\": \"SayManager\",\n    \"0-3\": \"Create a new say command!\",\n    \"0-4\": \"addSay [command] [response]\"\n  },\n  \"cols\": 5,\n  \"rows\": 1\n}\n[/block]\nThis Function is used internally to AudioPlayer for the commands playFile and stopPlayinghttps://dash.readme.io/project/disnode/v0.3.00/docs/audioplayer\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Config\"\n}\n[/block]\nDefault Config Params\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"name\",\n    \"h-1\": \"type\",\n    \"h-2\": \"desc\",\n    \"0-0\": \"commands\",\n    \"0-1\": \"Array<CommandObjects>\",\n    \"0-2\": \"Default Commands\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Source Code\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\\"use strict\\\"\\nconst colors = require('colors');\\nclass SayManager{\\n  constructor(options){\\n    this.options = options;\\n\\n\\n    this.defaultConfig = {\\n      errEnterCommand: \\\"Please Enter a Command (First Parameter)\\\",\\n      errEnterSay: \\\"Please Enter a Say (Secound Parameter)\\\",\\n      resAddedCommand: \\\"Added Command [Command]\\\",\\n      commands:[\\n        {\\n          \\\"cmd\\\": \\\"addSay\\\",\\n          \\\"context\\\": \\\"SayManager\\\",\\n          \\\"run\\\": \\\"cmdAddSay\\\",\\n          \\\"desc\\\": \\\"Create a new say command!\\\",\\n          \\\"usage\\\": \\\"addSay [command] [response]\\\"\\n        },\\n      ]\\n    };\\n\\n    this.config = this.options.disnode.config.SayManager;\\n  }\\n  cmdAddSay(parsedMsg){\\n    var self = this;\\n    var command = parsedMsg.params[0];\\n    var say = parsedMsg.params[1];\\n    if(!command){\\n      self.options.disnode.bot.sendMessage(parsedMsg.msg.channel, self.config.errEnterCommand );\\n    }\\n    if(!say){\\n      self.options.disnode.bot.sendMessage(parsedMsg.msg.channel, self.config.errEnterSay );\\n    }\\n    if(command && say){\\n      self.addSayCommand(command, say);\\n      var shortcuts = [{\\n        shortcut: \\\"[Command]\\\",\\n        data: say\\n      }];\\n      self.options.disnode.sendResponse(parsedMsg,\\\"Added Command [Command]\\\",\\n      {\\n        timeout: 2000,\\n        shortcuts: shortcuts,\\n        parse: true,\\n        mention: true\\n      });\\n    }\\n  }\\n  addSayCommand(command, say){\\n    var self = this;\\n      var config = self.options.disnode.config;\\n\\n      var newSayComand = {\\n        cmd: command,\\n        run: \\\"cmdSay\\\",\\n        context: \\\"SayManager\\\",\\n        desc: \\\"Prints Entered Command\\\",\\n        usage: command,\\n        params: {\\n          sayText: say\\n        }\\n      }\\n\\n      config.commands.push(newSayComand);\\n      self.options.disnode.saveConfig();\\n      self.options.disnode.loadConfig(function(){\\n        self.config = self.options.disnode.config.SayManager;\\n        self.options.disnode.addDefaultManagerCommands(\\\"SayManager\\\", config.commands);\\n      });\\n      console.log(\\\"[SayManager]\\\".grey + \\\" New Say Command Added!\\\".cyan);\\n\\n\\n  }\\n\\n  cmdSay(parsedMsg, params){\\n    var self = this;\\n\\n\\n    var printText = self.options.disnode.parseString(params.sayText,parsedMsg);\\n    self.options.disnode.bot.sendMessage(parsedMsg.msg.channel, printText);\\n  }\\n}\\n\\nfunction GetMsgOffCommand(cmdName, list){\\n  var found = null;\\n  for(var i=0;i<list.length;i++)\\n  {\\n    if(list[i].cmd == cmdName){\\n      found = list[i];\\n    }\\n  }\\n\\n  return found;\\n}\\n\\nmodule.exports = SayManager;\\n\\n\",\n      \"language\": \"javascript\",\n      \"name\": \"ManagerSource\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"saymanager","type":"basic","title":"SayManager"}
[block:api-header] { "type": "basic", "title": "Info" } [/block] **Name** - `SayManager` **Options** : [block:parameters] { "data": { "h-0": "key", "h-1": "type", "h-2": "desc" }, "cols": 3, "rows": 1 } [/block] [block:api-header] { "type": "basic", "title": "Commands" } [/block] These are the default commands include. [block:parameters] { "data": { "h-0": "Command", "h-1": "Run", "h-2": "Context", "h-3": "Desc", "h-4": "Usage", "0-0": "addSay", "0-1": "cmdAddSay", "0-2": "SayManager", "0-3": "Create a new say command!", "0-4": "addSay [command] [response]" }, "cols": 5, "rows": 1 } [/block] This Function is used internally to AudioPlayer for the commands playFile and stopPlayinghttps://dash.readme.io/project/disnode/v0.3.00/docs/audioplayer [block:api-header] { "type": "basic", "title": "Config" } [/block] Default Config Params [block:parameters] { "data": { "h-0": "name", "h-1": "type", "h-2": "desc", "0-0": "commands", "0-1": "Array<CommandObjects>", "0-2": "Default Commands" }, "cols": 3, "rows": 1 } [/block] [block:api-header] { "type": "basic", "title": "Source Code" } [/block] [block:code] { "codes": [ { "code": "\"use strict\"\nconst colors = require('colors');\nclass SayManager{\n constructor(options){\n this.options = options;\n\n\n this.defaultConfig = {\n errEnterCommand: \"Please Enter a Command (First Parameter)\",\n errEnterSay: \"Please Enter a Say (Secound Parameter)\",\n resAddedCommand: \"Added Command [Command]\",\n commands:[\n {\n \"cmd\": \"addSay\",\n \"context\": \"SayManager\",\n \"run\": \"cmdAddSay\",\n \"desc\": \"Create a new say command!\",\n \"usage\": \"addSay [command] [response]\"\n },\n ]\n };\n\n this.config = this.options.disnode.config.SayManager;\n }\n cmdAddSay(parsedMsg){\n var self = this;\n var command = parsedMsg.params[0];\n var say = parsedMsg.params[1];\n if(!command){\n self.options.disnode.bot.sendMessage(parsedMsg.msg.channel, self.config.errEnterCommand );\n }\n if(!say){\n self.options.disnode.bot.sendMessage(parsedMsg.msg.channel, self.config.errEnterSay );\n }\n if(command && say){\n self.addSayCommand(command, say);\n var shortcuts = [{\n shortcut: \"[Command]\",\n data: say\n }];\n self.options.disnode.sendResponse(parsedMsg,\"Added Command [Command]\",\n {\n timeout: 2000,\n shortcuts: shortcuts,\n parse: true,\n mention: true\n });\n }\n }\n addSayCommand(command, say){\n var self = this;\n var config = self.options.disnode.config;\n\n var newSayComand = {\n cmd: command,\n run: \"cmdSay\",\n context: \"SayManager\",\n desc: \"Prints Entered Command\",\n usage: command,\n params: {\n sayText: say\n }\n }\n\n config.commands.push(newSayComand);\n self.options.disnode.saveConfig();\n self.options.disnode.loadConfig(function(){\n self.config = self.options.disnode.config.SayManager;\n self.options.disnode.addDefaultManagerCommands(\"SayManager\", config.commands);\n });\n console.log(\"[SayManager]\".grey + \" New Say Command Added!\".cyan);\n\n\n }\n\n cmdSay(parsedMsg, params){\n var self = this;\n\n\n var printText = self.options.disnode.parseString(params.sayText,parsedMsg);\n self.options.disnode.bot.sendMessage(parsedMsg.msg.channel, printText);\n }\n}\n\nfunction GetMsgOffCommand(cmdName, list){\n var found = null;\n for(var i=0;i<list.length;i++)\n {\n if(list[i].cmd == cmdName){\n found = list[i];\n }\n }\n\n return found;\n}\n\nmodule.exports = SayManager;\n\n", "language": "javascript", "name": "ManagerSource" } ] } [/block]