@vexxlol/interactions
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Npm package version Npm package yearly downloads Discord

@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

Readme

Keywords

none

Package Sidebar

Install

npm i @vexxlol/interactions

Weekly Downloads

3

Version

1.1.0

License

ISC

Unpacked Size

46.8 kB

Total Files

35

Last publish

Collaborators

  • vexxlol