Skip to content

Commit

Permalink
📖 DOC: Example Code
Browse files Browse the repository at this point in the history
  • Loading branch information
bombitmanbomb committed Nov 26, 2020
1 parent 01637a1 commit 8986278
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ toc:
children:
- neosjs-commands
description: |
This is a placeholder
Plugin Library for [Neos.js](https://www.npmjs.com/package/@bombitmanbomb/neosjs)
- CommandManager
17 changes: 17 additions & 0 deletions CommandManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ const CommandExtended = require("./CommandExtended");
/**
*
* @class CommandManager
* @example const CommandManager = require("neosjs-commands");
* const Neos = new (require("@bombitmanbomb/neosjs"))
* Command = CommandManager.Create(Neos)
* Command.Add("Ping", (Handler)=>{Handler.Reply("Pong")})
* Command.SetHelp("Ping", {index:"Ping Pong!", usage:Command.Options.Prefix+"Ping"})
* Command.Add("Relay", (Handler, Sender, Args)=>{
* if (Args.length<2) return Handler.Usage();
* if (!Args[0].startsWith("U-")) return Handler.Reply("First Argument must be a UserID.");
* if (!Neos.IsFriend(Args[0])) return Handler.Reply("User is not a Friend of the bot.");
* Neos.SendTextMessage(Args.shift(), Args.join(" ")); // Remove first argument (UserID) and join the rest with spaces.
* Handler.Reply("Message Sent!")
* },
* {
* index:"Send a message to another user via the bot.",
* usage:Command.Options.Prefix+"Relay <User-ID> <Message>"
* }, ["U-BotOwner"]);
* Neos.on("messageReceived", Command.Run);
*/
class CommandManager {
/**
Expand Down

0 comments on commit 8986278

Please sign in to comment.