GithubHelp home page GithubHelp logo

sparkle_interactions's Introduction

โœจ๐Ÿ“„ Sparkle Interactions

Safe, concise Discord interaction handling for Twilight

โœจ Features

Responding to Interactions

An interaction handle is provided to respond to interactions, which holds the state of the interaction.

The handle has a respond method which determines whether to create an interaction response or a followup message using the state.

See module documentation of handle module for more.

Tracking Last Response

Optionally, the interaction handle can track the last message sent. Methods are then provided to return or update the last message.

See module documentation of handle module for more.

Extracting Interaction Data

This library provides methods to extract interaction data, command options, and modal components concisely.

See module documentation of the extract module for more.

Builders

Builders for components and interaction responses are given by the library, allowing you to create these structs concisely and safely.

See module documentation of the builder module for more.

๐Ÿท๏ธ Versioning

Since this crate is a third party crate for Twilight, its minor version follows the minor version of Twilight that this crate supports.

For example, for a version of the crate that supports Twilight 0.15.4, this crate's version will be 0.15.x, where x can be any number.

๐Ÿงช Testing

This crate makes use of unit tests and integration tests. Unit tests can be run as usual, while integration tests require some setup.

Since integration tests receive Discord events and make requests to Discord, you should first set these environment variables in a .env file located in the root of this repository:

  • BOT_TOKEN: The token of the bot to use for testing
  • GUILD_ID: The ID of the server where the test command will be created
  • CHANNEL_ID: The ID of the channel where the test message with a component will be created

Each test runs on an interaction. Since bots can't create interactions, when running the test, the bot will wait for an InteractionCreate event to use for testing. For tests that don't run on component interactions, you should first run the test then send the sparkle_interactions_test command manually, after which point the bot runs the test on the interaction you created. For tests that run on component interactions, the bot will send a message with the component upon running the test. Once you click on the component, testing will continue.

๐Ÿ™‹ Wanted: Issues

While this crate is tested heavily, there may still be some bugs; or you might have some awesome ideas. Please to create issues or PRs for bug reports, suggestions, and additions.

sparkle_interactions's People

Contributors

laralove143 avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.