Coder Social home page Coder Social logo

tomerron / cordless Goto Github PK

View Code? Open in Web Editor NEW
57.0 57.0 2.0 618 KB

๐Ÿค– Declarative Discord bot framework. Build your first bot in 5 minutes with 3 lines of code!

License: ISC License

Shell 0.12% TypeScript 99.88%
bot discord discord-api discord-bot discord-js typescript

cordless's People

Contributors

dependabot[bot] avatar semantic-release-bot avatar tomerron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

fjborquez

cordless's Issues

Handle parameters

Hey, thanks for this package!, I saw it in Reddit a few days ago.
I'm trying to accept parameters in my bot, but i dunno understand how.

Can you gimme an example?

Greetings from Chile!

It's currently not possible to write e2e tests for Application Commands

Background

Currently e2e tests are done by creating 2 clients:

  • One client is a cordless bot, initialized as normal with init()
  • Another client is a simple discord.js client that pretends to be a real user

In the e2e tests, these two clients "talk" to each other - for example, we subscribe the cordless bot to a messageCreate event with a condition of message.content === 'ping', and test the function callbacks by having the "fake user" send a ping message and assert that the cordless bot responded with a pong.

Problem

With the introduction of Application Commands, it's not possible to test them with a bot pretending to be a user. This is because Bots can not interact with other Bots through commands.

For example, we might register a /ping command in the cordless bot. When the "fake user" sends /ping, it will simply send it as a message and not create the interaction. So it is not possible to assert that the command works.

Solution

Not really sure at the moment.

We could probably simulate a browser and login into a "real" user (with Cypress for example), but that would be cumbersome and definitely against the Discord ToS, so that's not a viable option.

Another option might be to query the Discord API to get back information about the bot's commands. We can create snapshots of the JSON response for different scenarios (e.g., no commands registered, simple commands, commands with options, etc). That still won't let us test the command handling itself (and anything involved in the process, like interactive buttons and how they are handled), but at least we can assert that the commands are registered properly.

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.