Skip to main content

Velocity banner

Discord

velocity-lite

A minimal discord API wrapper. Lite version of the main lib velocity - Full version of velocity yet to be released.

Documentation

There is not much to the minimal library, apart from two events, ready & message, as this library is intended for very small applications that need to communicate with the Discord API. No point having a whole library just a basic application right?

Quick start

As you’ll start to find out this library shares many of the same syntax as the discord.js syntax, with a few variations.

Please note that this lib does not currently support intents but we will shortly in the future.

import Client from "https://raw.githubusercontent.com/VGB-Devs/lib-lite/main/mod.ts"

let client = new Client("token")

client.on("ready", () => {console.log("Connected to the discord gateway!")})

client.on("message", async (msg: Message) => {
    if (msg.author.bot) return;
    if (msg.content == "!ping") {
        await msg.channel.send("Pong! :ping_pong:") 
        // You can also pass an object through here following the discord embed structure!
        // https://leovoel.github.io/embed-visualizer/
    }
})

client.start()

// To execute me type `deno run --allow-net --allow-read file_name.ts`!
Author attribute

The author attribute has 5 sub-attributes, which stores the id, username, discriminator, avatar & bot

<Message>.author.id // Returns the message creator discord id - String
<Message>.author.username // Returns the message creator username - String
<Message>.author.discriminator // Returns the message creator discirminator - String
<Message>.author.avatar // Returns the URL for the message creator avatar - String
<Message>.author.bot // Returns a boolean to determine if the message creator is a bot or a client - Boolean
Channel Attribute

The channel attribute has 18 sub attributes which store the channel id, type, guildID, position, permissionOverwrites, name, topic, nsfw, lastMessageID, bitrate, user limit, rate limit per user, recipients, icon, owner id, application id, parent id & last pin time stamp.

<Message>.channel.id // Returns the channel id as a string
<Message>.channel.type // Returns a number for the type of channel
<Message>.channel.guildId // Returns the guild id as a string
<Message>.channel.position // Returns the channel position, number (Could be null)
<Message>.channel.permissionOverwrites // array of overwrite objects	explicit permission overwrites for members and roles
<Message>.channel.name // Returns the name of the channel - String
<Message>.channel.topic // Returns the channel topic - String
<Message>.channel.nsfw // Returns a boolean if the channel is marked NSFW
<Message>.channel.lastMessageId // Returns the last message id of the channel - string
<Message>.channel.bitrate // Returns the bittrate in bits of the channel (voice) - Intenger
<Message>.channel.userLimite // Returns the user limit of the voice channel - Integer
<Message>.channel.rateLimitePerUser // Returns amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected - Integer
<Message>.channel.recipients // Returns the recipents of the DM
<Message>.channel.icon // Returns the icon hash - String
<Message>.channel.ownerId // Returns the DM creator id - String
<Message>.channel.applicationId // Returns application id of the group DM creator if it is bot-created - String
<Message>.channel.parentId // Returns the id of the parent category for a channel (each parent category can contain up to 50 channels) - String
<Message>.channel.lastPinTimestamp // ISO8601 Format Returns the last pin timestamp of the current channel - String

<Message>.channel.send() // Takes a string or an object, if you pass an object it will assume you are sending an embed https://leovoel.github.io/embed-visualizer/
<Message>.delete() // Deletes the current message