Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async run(msg) {
- const messages = [];
- var username = null;
- var email = null;
- var password = null;
- var blockProcess = 0;
- try {
- if (blockProcess === 0) {
- await msg.direct('You are about to register. You will have 10 seconds to enter each process. You will need to have your username, email, and password ready! Type ok to continue.');
- await msg.author.dmChannel.awaitMessages(res => {
- if (res.content === 'ok') {
- blockProcess = 1;
- } else {
- console.log(res.content);
- console.log(blockProcess);
- return msg.direct('You did not produce the correct answer.');
- }
- }, { max: 1, time: 10000, errors: ['time'] });
- }
- if (blockProcess === 1) {
- await msg.direct('What do you wish your username to be?');
- await msg.author.dmChannel.awaitMessages(res => {
- username = res.content;
- blockProcess = 2;
- return msg.direct('Your username: ' + username);
- }, { max: 1, time: 30000, errors: ['time'] });
- }
- if (blockProcess === 2) {
- await msg.direct('What is you email address?');
- await msg.author.dmChannel.awaitMessages(res => {
- email = res.content;
- blockProcess = 3;
- return msg.direct('Your email: ' + email);;
- }, { max: 1, time: 30000, errors: ['time'] });
- }
- if (blockProcess === 3) {
- await msg.direct('What do you wish your password to be?');
- await msg.author.dmChannel.awaitMessages(res => {
- password = res.content;
- blockProcess = 4;
- return msg.direct('Your password: ' + password);
- }, { max: 1, time: 30000, errors: ['time'] });
- }
- if (blockProcess === 4) {
- blockProcess = null;
- return msg.direct('Your username:' + username +
- '\nYour email: ' + email +
- '\nYour password: ' + password + '\n`You have been registered!`');
- }
- if (msg.channel.type !== 'dm') messages.push(await msg.reply('I have sent you a DM with further instructions.'));
- } catch (err) {
- messages.push(await msg.reply('Unable to send you a DM, you most likely have them disabled.'));
- }
- return messages;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement