Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dotheprompt = function () {};
- promptcallback = function (message) {
- if (message.author.id !== "201765854990434304") {
- return;
- }
- if (message.content.match(/^y(es)?$/i)) {
- try {
- this.branch("y");
- lechannel.send(this.current.text);
- } catch (err) {
- lechannel.send("Thank you for answering questions about...chickens...");
- bot.removeListener("message", dotheprompt);
- }
- }
- if (message.content.match(/^n(o)?$/i)) {
- try {
- this.branch("n");
- lechannel.send(this.current.text);
- } catch (err) {
- lechannel.send("Thank you for answering questions about...chickens...");
- bot.removeListener("message", dotheprompt);
- }
- }
- };
- myprompt = new multiprompt("Do you like chickens?", promptcallback);
- myprompt.addBranch("y", "Do you like ducks as well?", promptcallback);
- myprompt.addBranch("n", "Do you dislike ducks as well?", promptcallback);
- myprompt.branch("y");
- myprompt.addBranch("y", "Do you like all birds?", promptcallback);
- myprompt.addBranch("n", "Do you only like chickens?", promptcallback);
- myprompt.toFirst();
- myprompt.branch("n");
- myprompt.addBranch("y", "Do you only like ducks?", promptcallback);
- myprompt.addBranch("n", "Do you dislike all birds?", promptcallback);
- myprompt.toFirst();
- dotheprompt = function (message) {
- myprompt.exec(message);
- };
- lechannel.send(myprompt.first.text);
- bot.on("message", dotheprompt);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement