1.0.22 • Published 3 years ago
javascript-cord v1.0.22
Table of contents
About
JSCord is a discord.js framework to easily maintain discord bots.
Note: This is still in beta and some features may not be working
Installation
Node.js 12.0.0+ is required. Install with npm:
$ npm i javascript-cord
Examples
Basic
const JSC = require('javascript-cord');
const client = new JSC.JSClient(); // Declaring the new client
client.on("message", (msg) => {
if (msg.content === "!hello") {
msg.create("Hello world!")
} else if (msg.content === "!ping") {
msg.create(`Pong! ${msg.ping}!`)
}
});
client.start("TOKEN"); // Start your bot, replacing TOKEN with your bot's token, remember to NEVER share your token with ANYONE.
Commands
const JSC = require("javascript-cord");
const client = new JSC.JSClient();
let prefix = "?";
client.on("message", async (message) => {
const args = message.content.slice(prefix.length).trim().split(/ +/);
const cmd = args.shift().toLowerCase();
if (cmd === "hi") {
message.create("Hi!")
} else if (cmd === "bye") {
message.create("Oh okay, bye")
} else if (cmd === "foo") {
message.create("bar")
}
});
client.start("TOKEN")
Contributing
- Fork the repo, clone the fork
- Make and commit your changes
- Make a pull request and I'll see :)