Git Product home page Git Product logo

discordjs-prompter's Introduction

Sup

Typescript developer based in Brazil maintaining some open source libraries and making some cool apps.

Metrics

discordjs-prompter's People

Contributors

dependabot[bot] avatar hexenon avatar joaquimnet avatar lightyagami200 avatar

Stargazers

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

Watchers

 avatar  avatar

discordjs-prompter's Issues

Validation method

Is there a way to "reask" the question after it's been answered if say, it was wrong?

Example:

prompter.message(msg.channel, {
    question: 'What is your age?',
    userId: msg.author.id,
    max: 1,
    timeout: 10000,
}).then(responses => {
    // other code... response get, etc.
    if (isNaN(response)) {
        prompter.error(`Response wasn't a number. Please answer again:`); // resends question
    } else {
        // continue, if/once correct
    }
});

spelling mistake

you've used "massage" instead of "message" in this sentence "Prompt for a user response using reactions or a massage."
This same sentence shows on the npmjs entry

Need help!!

So i used your code from the other issue to do multiple question and answers, how will i do the command in a guild then it send a message and the collector in dm.

      const questionList = ['First question', 'Second question'];
      const responseList = await questionList.reduce(
        async (previousQuestions, currentQuestion, index) => {
          // responses will contain an array of the previous responses
          const responses = await previousQuestions;

          // Here you could use the index variable to check in which question you
          // are at and use the responses array to change the question accordingly.
          let question = currentQuestion;

          const messageCollection = await Promter.message(message.channel, {
            question,
            userId: message.author.id,
            timeout: 5000,
            max: 1,
          });

          // Get the first message from the returned collection
          const msg = messageCollection.first();
          // If the user timed out the collection will be empty
          const response = msg ? msg.content : null;

          return [...responses, response];
        },
        [],
      );

      message.channel.send('Response: ' + responseList.join(`, `));```

DMs Error

channel.awaitMessages is not a function
When trying in DMs

Prompting for multiple questions and responses

Awesome library! How would I prompt for a question, wait for a response, then prompt for another question and wait for a response (etc, etc...), while also using responses in the next question?

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.