New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

message_parser.js

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

message_parser.js

A quick script that parses messages.

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

MessageParser

Importing

const _MessageParser = require("message_parser.js");
const MessageParser = new _MessageParser("!"); // "!" would be the prefix

- OR -

const MessageParser = new (require("message_parser.js"))("!"); 
// "!" would be the prefix

Usage

const MessageParser = new (require("message_parser.js"))("!"); 
// "!" would be the prefix
let text = "!help moderation";
text = MessageParser.parse(text);
if(text.parsed) {          // If it was parsed
    switch(text.command){  // ...
        case "help":       // and the command is help:
            console.log("You asked for help on \"" + text.arguments[0] + "\".");
            break;
    }
}

Output

> You asked for help on "moderation".

Return

{
    "command": "string",
    "arguments": ["argument", "argument"],
    "parsed": true
}

LICENSE

gnu-logo

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Keywords

discord.js

FAQs

Package last updated on 07 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts