Skip to main content

D-rex

d-rex is a simple deno discord framework that lets u register commands. d-rex is based on the harmony discord library and built with deno and ts.

example

// deno run --allow-net --allow-env --allow-read bot.ts
import 'https://deno.land/x/dotenv/load.ts';
// import { app, type } from '../mod.ts';
import { app, type } from 'https://deno.land/x/drex/mod.ts';

// creates client with prefixes ~ and ^
const client = app(['~', '^']);

// changes prefix to ~
client.prefixes = ['~'];

// runs on every message sent
client.hook((message) => {
    message.reply('hello there');
});

// runs every time someone sends ~ping <user> or ^ping <user>
client.command({
    name: 'ping',
    aliases: ['p'],
    params: [
        {
            name: 'user',
            type: type.Member,
        },
    ],
    handler: async (msg, args) => {
        msg.reply(
            `pong! ${(await client.member(args.user, msg.guild))?.toString()}`
        );
    },
});

client.listen(Deno.env.get('TOKEN'));

contact

dev@okirshen.xyz

or discord with joerje#5185