Deno.js Tutorial to Call Discord REST API Using Coward Module in TypeScript Full Project For Beginners

 

 

Coward is a Deno module for easy interaction with the Discord API

 

 

Usage

 

You must be using Deno v1.0.2 or higher.

 

import { Client } from "https://deno.land/x/coward@v0.3.2/mod.ts";

 

Please don’t use this in anything important yet. It is barely functional, and as such is not production ready. Also note, coward uses Evt for events. You can read the documentation for that here.

 

Ping-Pong Example

 

import { Client } from "https://deno.land/x/coward@v0.3.2/mod.ts";

let client = new Client("TOKEN");

client.evt.ready.attach(() => {console.log("READY!")});

client.evt.messageCreate.attach(async ({message}) => {
  if(message.content == "!ping") {
    await message.channel.createMessage("Pong!");
  }
})

client.connect()

 

Leave a Reply