1.1.0 • Published 3 years ago

@vexxlol/interactions v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Npm package version Npm package yearly downloads

@vexxlol/interactions

Public library for using discord HTTP interactions. Written in 100% TypeScript.

Quickstart

Installation

To install the package, please run the following command in an terminal.

npm i @vexxlol/interactions

Example

This example is written in TypeScript and is easily changeable to JavaScript. View our examples here.

import { Server, Interaction } from "../index";

let server = new Server({
    publicKey: "PUBLIC KEY" // Can be found at discord.com/developers/applications
})

server.on("interaction", (interaction: Interaction) => {
    if (interaction.isSlashCommand()) {
        interaction.data.reply("test");
    }

    if (interaction.isButton()) {
        interaction.data.reply({ content: `Hello, ${interaction.data.member.user.username}.`, flags: 1<<6 })
    }
})

server.start();

If you run the script, only the local network will be able to access the HTTP Interactions, you will need to tunnel the server. This can be done numerous ways, below is with ngrok.

ngrok http 4000 # change the port respective of what you chose

Docs

Will make it later.

Todo

x Support buttons Support autocomplete Make docs Error system Register slash commands system Ability to connect to a DJS bot and/or custom client