diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..f4447cd --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,21 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages + +name: neosjs-commands Publish + +on: + release: + types: [created] + +jobs: + publish-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/docs/index.html b/docs/index.html index cb96e5a..8ff21f4 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,7 +2,7 @@
-1.0.1
1.0.2
This is a placeholder
++ Plugin Library for + Neos.js +
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);
+
CommandHandler Plugin.
+CommandExtended Plugin. Adds more features to CommandHandler
"/"
, HelpCommand: "help"
, UsageCommand:
+ "usage"
, CommandsCommand: "commands"
,
+ HelpDefault:
+ "Get a list of commands with $this.prefix +
+ $this.CommandsCommand"
})
(String
- = "Invalid Command"
)
({Prefix: "/"
, HelpCommand: "help"
,
+ UsageCommand: "usage"
, CommandsCommand:
+ "commands"
, HelpDefault:
+ "Get a list of commands with $this.prefix +
+ $this.CommandsCommand"
})
const NEOS = require("@bombitmanbomb/neosjs")
+ >const CommandHandler = require("@bombitmanbomb/neosjs/Plugins/CommandHandler")
+const CommandExtended = require("@bombitmanbomb/neosjs/Plugins/CommandExtended")
+const NEOS = require("@bombitmanbomb/neosjs")
const Neos = new NEOS()
-const CommandHandler = require("@bombitmanbomb/neosjs/Plugins/CommandHandler")
-const Command = new Commandhandler(Neos)
-Command.Add("Ping", (Handler)=>{Handler.Reply("Pong!")});
-Neos.on("messageReceived", (Message)=>{
- Command.Run(Message)
-})
+const Command = new CommandExtended(new CommandHandler(Neos),Options);
+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);
- Add a Command
+Add a new Command Hook
(any)
+ (CommandHandler
>String>?)
+ Users allowed to run the command
Parse and run the given message object
+ +(any)
+ Run a Message for Commands
++ Set help of a command, Will overwrite any previous indexes +
({Id, OwnerId, RecipientId, SenderId, MessageType,
- Content, SendTime, LastUpdateTime, ReadTime})
(String)
+ Command to set Index for
(any)
CommandExtended Plugin. Adds more features to CommandHandler
+CommandHandler Plugin.
"/"
, HelpCommand: "help"
, UsageCommand:
- "usage"
, CommandsCommand: "commands"
,
- HelpDefault:
- "Get a list of commands with $this.prefix +
- $this.CommandsCommand"
})
+ new CommandHandler(NeosJS: Class, Invalid:
+ String)
({Prefix: "/"
, HelpCommand: "help"
,
- UsageCommand: "usage"
, CommandsCommand:
- "commands"
, HelpDefault:
- "Get a list of commands with $this.prefix +
- $this.CommandsCommand"
})
(String
+ = "Invalid Command"
)
const CommandHandler = require("@bombitmanbomb/neosjs/Plugins/CommandHandler")
-const CommandExtended = require("@bombitmanbomb/neosjs/Plugins/CommandExtended")
-const NEOS = require("@bombitmanbomb/neosjs")
+ >const NEOS = require("@bombitmanbomb/neosjs")
const Neos = new NEOS()
-const Command = new CommandExtended(new CommandHandler(Neos),Options);
-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);
+const CommandHandler = require("@bombitmanbomb/neosjs/Plugins/CommandHandler")
+const Command = new Commandhandler(Neos)
+Command.Add("Ping", (Handler)=>{Handler.Reply("Pong!")});
+Neos.on("messageReceived", (Message)=>{
+ Command.Run(Message)
+})
- Add a new Command Hook
+Add a Command
(any)
Parse and run the given message object
- -(any)
- Set help of a command, Will overwrite any previous indexes -
+Run a Message for Commands
(String)
({Id, OwnerId, RecipientId, SenderId, MessageType,
+ Content, SendTime, LastUpdateTime, ReadTime})
- Command to set Index for
(any)