Repository
Current version released
6 years ago
Versions
THIS BRANCH IS OUT-OF-DATE, PLEASE CHECK dev INSTEAD; BASICALLY EVERYTHING IS THERE UNTIL ITāS STABLE!
THIS LIBRARY IS UNDERDEVELOPMENT & ARENāT MEANT TO BE USED IN PRODUCTION YET!
dcord
Library to interact with Discordās API on the Deno javascript/typescript runtime.
setup
First you need to have Deno runtime installed on your machine. Install it here.
After that is done, make sure you have it by doing following command on PS/cmd/bash:
$ deno infoIf it does not tell that the command doesnāt exists, you have successfully installed deno runtime!
installation
Thereās no āinstallationā needed, just include the https://deno.land/x/ url in your file.
Example in usage:
// Importing the library itself as "DCord"
// Take a note that this is taken from `dev` branch, so until it's stable, use that
// after it's stable, please make sure you change that `dev` into `main`
import * as DCord from "https://raw.githubusercontent.com/u59/dcord/dev/mod.ts";
// Creating the client itself, you pass token into the constructor, and possibly a boolean to the constructor what tells the client should it connect automatically or not.
const client = new DCord.Client("your.very.secret.token");
// Event fired once the client is ready to serve requests
client.once("ready", () => console.log("I'm ready!"));
// Event fired once bot receives NEW message
client.on("messageCreate", (message: any) => {
if (message.content.startsWith("ping") && !message.author.bot)
{
return client.createMessage(message.channel_id, "Pong!");
}
});
// You might have been conformtable with something like `client.connect()` or `client.login()`, but this library doesn't require it. (major changes can happen lol)To start the bot, simply run this command on your command line:
$ deno run --allow-net index.tsContribution is appreciated! :3