{"_id":"5785a2e69e80c32200234f6d","category":{"_id":"5785a2bf2eca4e0e002b4d67","version":"57858bff9e80c32200234f4f","__v":0,"project":"57858bff9e80c32200234f4c","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-07-13T02:09:03.422Z","from_sync":false,"order":2,"slug":"explanations","title":"Explanations"},"project":"57858bff9e80c32200234f4c","user":"57858823fc4a0f2200f02f01","__v":0,"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"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-07-13T02:09:42.409Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"About Managers\"\n}\n[/block]\nManagers, like plugins, are external features that are loading into Disnode and gives bots their functionality. Disnode acts a importer and manager to these Managers, but the Managers handle all the core Features. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Manager Types\"\n}\n[/block]\n\nManagers can both be 'Core' or '3rd Party'.      \n**CORE**: Core Managers are those that are included in Disnode. All you have to do is add them to your bot!     \n**3rd Party**: 3rd Party Managers are those created and imported by npm externally. These require you to feed Disnode a path. Although popular, well-coded, or just AWESOME managers can be added to Core!     \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Manager Configs\"\n}\n[/block]\n\nManagers come with default configs and commands. If your bot config does not contain a config for a manager, the default config is copied and saved in your bot config. This manager config contains message responses (Responses used when responding inside Disnode), Commands for the Managers, and other options.      \n**ALL SETTINGS INCLUDING COMMANDS ARE EDITABLE IN YOUR BOT CONFIG!**\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Using Managers\"\n}\n[/block]\n## Core Managers\n### Run Down\nTo use a Core manager in your bot all you need to know is it's name and options. The name is used through out Disnode to reference it and options are just options you can feed it. (EX: Command Prefix for Command Handler, or Max Volume for AudioPlayer). All the default functionality is imported so you're good to go! Acorse you can edit as you please in your bot's config file.       \n### Code\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"testBot.addManager({name:\\\"CommandHandler\\\", options:{prefix: \\\"!\\\"}});\",\n      \"language\": \"javascript\",\n      \"name\": \"Example 1\"\n    }\n  ]\n}\n[/block]\nThe Example above imports the Command Handler managers and sets the option for prefix. Note that no path is required since its located inside Disnode like all Core Managers;\n\n\n## 3rd Party Managers\n### Run Down\n3rd Party Managers are almost as simple as they share the same code as Core Managers, but they are located externally.   After you import a 3rd Party Manager, you can load it the same way, although you will also need to know the path.\n### Code\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"testBot.addManager({name:\\\"ThirdPartyManager\\\",path:\\\"./3rdPartyManager.js\\\", options:{prefix: \\\"!\\\"}});\",\n      \"language\": \"javascript\",\n      \"name\": \"Example 2\"\n    }\n  ]\n}\n[/block]\nThe Example above imports a 3rd party manager from the path and sets the option for prefix.\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Using Managers\"\n}\n[/block]\nBy Default your managers should be all set to go. The default commands have be imported by default into your bot's config and the plugin has been initialized. Although if you choose to access Managers in code its quiet simple. You can reference managers by just referring to <Bot>.<MANAGER>. Thats it! Note the name of the object is the same name you used to add it!\n## Example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"testBot.ConfigManager.someFunction();\\n//or\\ntestbot.ThirdPartyManager.someFunction();\",\n      \"language\": \"javascript\",\n      \"name\": \"Example 3\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Writing Managers\"\n}\n[/block]\nTo write managers you can first start off using the template below. The options object is a object that contains the options passed into on creation and a reference to Disnode. (options.disnode). All you have to do it right the class, add defaultConfig, and export it!\n\n## Example Manager\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\\"use strict\\\"\\n\\n    class TestManager{\\n      constructor(options){\\n\\n        this.defaultConfig = {\\n          defaultSaying: \\\"Default Saying\\\",\\n          responses:{\\n            printSay: \\\"[Sender] Says: [Saying]\\\"\\n          },\\n          commands:[\\n            {\\n              cmd: \\\"testManager\\\",\\n              run: \\\"cmdTest\\\",\\n              context: \\\"TestManager\\\",\\n              usage: \\\"testManager\\\",\\n              desc: \\\"Default Manager Test Command\\\"\\n            }\\n    \\n          ]\\n        }    \\n\\n        var self = this;\\n        //Created Class Varables for Disnode and Options\\n        self.disnode = options.disnode;\\n        self.options = options;\\n        // Loads Config.\\n        self.config = self.disnode.config.TestManager;\\n        //Defaults if saying isn't provided\\n        if(options.saying){\\n          self.saying = options.saying;\\n        }else{\\n          self.saying = self.config.defaultSaying;\\n        }\\n      }\\n      cmdTest(parsedMsg){\\n        var self = this;\\n        var parse = self.disnode.parseString;\\n        //Adds Shortcut for Saying\\n        var customShortCuts = [{shortcut:\\\"[Saying]\\\", data: self.saying}];\\n\\n        self.disnode.bot.sendMessage(parsedMsg.msg.channel,\\n          parse(self.saying,parsedMsg,customShortCuts));\\n      }\\n    }\\n    module.exports = TestManager;\",\n      \"language\": \"javascript\",\n      \"name\": \"TestManager.js\"\n    }\n  ]\n}\n[/block]\n    \n\nThat Example Manager Prints the string you either feed it in options, or the config.\nFor more details on the ShortCut System, go here:\nFor more details on the Command System, go here: \nFor more details on the Config System, Read About Managers or go here:","excerpt":"","slug":"managers","type":"basic","title":"Managers"}
[block:api-header] { "type": "basic", "title": "About Managers" } [/block] Managers, like plugins, are external features that are loading into Disnode and gives bots their functionality. Disnode acts a importer and manager to these Managers, but the Managers handle all the core Features. [block:api-header] { "type": "basic", "title": "Manager Types" } [/block] Managers can both be 'Core' or '3rd Party'. **CORE**: Core Managers are those that are included in Disnode. All you have to do is add them to your bot! **3rd Party**: 3rd Party Managers are those created and imported by npm externally. These require you to feed Disnode a path. Although popular, well-coded, or just AWESOME managers can be added to Core! [block:api-header] { "type": "basic", "title": "Manager Configs" } [/block] Managers come with default configs and commands. If your bot config does not contain a config for a manager, the default config is copied and saved in your bot config. This manager config contains message responses (Responses used when responding inside Disnode), Commands for the Managers, and other options. **ALL SETTINGS INCLUDING COMMANDS ARE EDITABLE IN YOUR BOT CONFIG!** [block:api-header] { "type": "basic", "title": "Using Managers" } [/block] ## Core Managers ### Run Down To use a Core manager in your bot all you need to know is it's name and options. The name is used through out Disnode to reference it and options are just options you can feed it. (EX: Command Prefix for Command Handler, or Max Volume for AudioPlayer). All the default functionality is imported so you're good to go! Acorse you can edit as you please in your bot's config file. ### Code [block:code] { "codes": [ { "code": "testBot.addManager({name:\"CommandHandler\", options:{prefix: \"!\"}});", "language": "javascript", "name": "Example 1" } ] } [/block] The Example above imports the Command Handler managers and sets the option for prefix. Note that no path is required since its located inside Disnode like all Core Managers; ## 3rd Party Managers ### Run Down 3rd Party Managers are almost as simple as they share the same code as Core Managers, but they are located externally. After you import a 3rd Party Manager, you can load it the same way, although you will also need to know the path. ### Code [block:code] { "codes": [ { "code": "testBot.addManager({name:\"ThirdPartyManager\",path:\"./3rdPartyManager.js\", options:{prefix: \"!\"}});", "language": "javascript", "name": "Example 2" } ] } [/block] The Example above imports a 3rd party manager from the path and sets the option for prefix. [block:api-header] { "type": "basic", "title": "Using Managers" } [/block] By Default your managers should be all set to go. The default commands have be imported by default into your bot's config and the plugin has been initialized. Although if you choose to access Managers in code its quiet simple. You can reference managers by just referring to <Bot>.<MANAGER>. Thats it! Note the name of the object is the same name you used to add it! ## Example: [block:code] { "codes": [ { "code": "testBot.ConfigManager.someFunction();\n//or\ntestbot.ThirdPartyManager.someFunction();", "language": "javascript", "name": "Example 3" } ] } [/block] [block:api-header] { "type": "basic", "title": "Writing Managers" } [/block] To write managers you can first start off using the template below. The options object is a object that contains the options passed into on creation and a reference to Disnode. (options.disnode). All you have to do it right the class, add defaultConfig, and export it! ## Example Manager [block:code] { "codes": [ { "code": "\"use strict\"\n\n class TestManager{\n constructor(options){\n\n this.defaultConfig = {\n defaultSaying: \"Default Saying\",\n responses:{\n printSay: \"[Sender] Says: [Saying]\"\n },\n commands:[\n {\n cmd: \"testManager\",\n run: \"cmdTest\",\n context: \"TestManager\",\n usage: \"testManager\",\n desc: \"Default Manager Test Command\"\n }\n \n ]\n } \n\n var self = this;\n //Created Class Varables for Disnode and Options\n self.disnode = options.disnode;\n self.options = options;\n // Loads Config.\n self.config = self.disnode.config.TestManager;\n //Defaults if saying isn't provided\n if(options.saying){\n self.saying = options.saying;\n }else{\n self.saying = self.config.defaultSaying;\n }\n }\n cmdTest(parsedMsg){\n var self = this;\n var parse = self.disnode.parseString;\n //Adds Shortcut for Saying\n var customShortCuts = [{shortcut:\"[Saying]\", data: self.saying}];\n\n self.disnode.bot.sendMessage(parsedMsg.msg.channel,\n parse(self.saying,parsedMsg,customShortCuts));\n }\n }\n module.exports = TestManager;", "language": "javascript", "name": "TestManager.js" } ] } [/block] That Example Manager Prints the string you either feed it in options, or the config. For more details on the ShortCut System, go here: For more details on the Command System, go here: For more details on the Config System, Read About Managers or go here: