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

1.4.1 • Public • Published

power

Interactions

🗡️ An interactions library made for Discord interactions

npm i @antibot/interactions

yarn add @antibot/interaction

Usage

const { Interactions, Command, ApplicationCommandType, Permissions } = require('@antibot/interactions');
const interactions = new Interactions({
    publicKey: "key",
    botID: "Bot ID",
    botToken: "Bot Token",
    debug: true
});

const pingCommand = new Command()
.Name("animal")
.Type(ApplicationCommandType.MESSAGE)
.Description("Send a random adorable animal photo")
.Permissions(Permissions({
    SendMessages: true,
    EmbedLinks: true
}))
.Options([
    {
      name: "animal",
      description: "The type of animal",
      type: ApplicationCommandType.MESSAGE,
      required: true,
      choices: [
        {
          name: "Dog",
          value: "animal_dog",
        },
        {
          name: "Cat",
          value: "animal_cat",
        },
        {
          name: "Penguin",
          value: "animal_penguin",
        },
      ],
    },
  ]);

async function main() {
 await interactions.createGlobalCommand(pingCommand);
}

main();

Permissions

const { 
  PermissionBitToNumber,
  Permissions, 
  PermissionsToHuman
  } = require("@antibot/interactions");

  console.log(PermissionBitToNumber(Permissions({ SendMessages: true }))); // 2048
  console.log(
    PermissionsToHuman(PlantPermission(Permissions({ SendMessages: true })))
  ); // [ 'SEND_MESSAGES' ]

Package Sidebar

Install

npm i @antibot/interactions

Weekly Downloads

3

Version

1.4.1

License

MIT

Unpacked Size

208 kB

Total Files

169

Last publish

Collaborators

  • j_ddev