npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

autocode-discord-interaction

v1.2.0

Published

This npm makes it easy to use the discord interactions inside autocode.

Downloads

4

Readme

Autocode Discord Interaction

This npm makes it easy to use discord interactions inside autocode.

Change log

v-1.2.0

  1. Improved file uploading.
  2. Overall code revamped.

v-1.1.0

Improved returned response schemes.

v-1.0.0

Added support for modal interaction. example

v-0.0.6

A small bug fixed.

v-0.0.5

Forgot to add form-data package inside the npm so error go brrrr.... 🤦‍♂️🤦‍♂️🤦‍♂️🤦‍♂️🤦‍♂️🤦‍♂️

v-0.0.4

Fixed a small bug where it will give error when attachments params is not provided. 😅🤦‍♂️

v-0.0.3

  1. Added support for uploading files.
  2. Improved readme :)

Available APIs

  1. Callback

| API types | Description | | ----------- | ----------- | | command_reply | Reply to any application command. Eg: slash command | | command_defer | Reply with a thinking message to any application command that can be edited later. | | component_defer | Acknowledge a message component that can be edited later. Eg: buttons | | component_update | Update the message where the component was present. | | autocomplete | Return some choices to the user. | | form_modal | Reply with a popup form. |

  1. Followup

| API types | Description | | ----------- | ----------- | | edit_original | Edit the original message created for the interaction. | | get_original | Get info about the original message created for the interaction. | | delete_original | Delete the original message created for the interaction. | | create | Create a new followup message for an interaction. (can only be used if the interaction was already replied by any of the callback apis) | | get | Get info about any newly created followup message. | | edit | Edit any followup message | | delete | Delete any followup message |

Note: Some of the apis for followup are not fully tested, so if you find any bugs please report it.

Example uses

Modal interaction

await interaction.callback.form_modal(event, {
    custom_id: `form_1`,
    title: 'This is an example form',
    text_inputs: [
      {
        style: 'short',
        custom_id: 'name',
        label: `What's your name?`,
        placeholder: `write your name here`, // optional
        required: true, // optional
        //value: 'some default value',
        //max_length: 100,
        min_length: 1, // optional
      },
      {
        style: 'long', 
        custom_id: 'description',
        label: `Describe yourself.`,
        placeholder: `Some text here`, // optional
        required: true, // optional
        //value: 'some default value',
        //max_length: 100,
        min_length: 1, // optional
      },
    ]
  })

modal interaction

You can upto 5 text inputs

Uploading files/attachments

const interaction = require('autocode-discord-interaction')

await interaction.callback.command_reply(context.params.event,{
    content: 'file',
    attachments: [
      {
        name: 'file.txt', //any file name with extension
        buffer: Buffer.from('hello'), //any buffer under 8 mb, could be more if the server is boosted
        description: 'some text' //any string, this params is optional
      }
    ]
})

You can upload upto 10 file in one message.

Reply any application command with a normal message

const interaction = require('autocode-discord-interaction')

await interaction.callback.command_reply(context.params.event,{
    content: 'hello!'
})

normal reply

Reply any application command with an ephemeral message

const interaction = require('autocode-discord-interaction')

await interaction.callback.command_reply(context.params.event,{
    content: 'hello!'
},{ephemeral: true})

ephemeral reply

Reply any application command with a thinking message/defer message

const interaction = require('autocode-discord-interaction')

await interaction.callback.command_defer(context.params.event)

defer message

Ephemeral thinking message also works.

ephemeral defer message

For more details check out my app in autocode.