From e5d04529e46cb5ecce019b0bb01078331428e95b Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sun, 23 Jun 2019 03:41:59 +0200 Subject: [PATCH] added prompt --- commands/admin/autoresponse.js | 5 +++- commands/admin/ban.js | 9 +++++++- commands/admin/bye.js | 3 +++ commands/admin/kick.js | 9 +++++++- commands/admin/prune.js | 3 +++ commands/admin/shameboard.js | 36 ++++++++++++++++++++++------- commands/admin/slowmode.js | 10 ++++++-- commands/admin/starboard.js | 36 ++++++++++++++++++++++------- commands/admin/tag.js | 10 ++++++-- commands/admin/unban.js | 5 +++- commands/admin/untag.js | 5 +++- commands/admin/welcome.js | 5 +++- commands/fun/reddit.js | 4 ++++ commands/fun/spb.js | 5 +++- commands/fun/tts/dectalk.js | 3 +++ commands/fun/tts/dectalkvc.js | 3 +++ commands/fun/tts/sam.js | 3 +++ commands/fun/tts/samvc.js | 3 +++ commands/fun/tts/tts.js | 3 +++ commands/fun/tts/ttsvc.js | 3 +++ commands/general/clap.js | 3 +++ commands/general/emotesay.js | 3 +++ commands/general/say.js | 3 +++ commands/general/sayd.js | 3 +++ commands/general/spoiler.js | 3 +++ commands/general/tweet.js | 3 +++ commands/utility/download.js | 7 ++++-- commands/utility/downloadSpoiler.js | 9 +++++--- commands/utility/feedback.js | 3 +++ commands/utility/invite.js | 6 ++--- commands/utility/musicMatch.js | 3 +++ commands/utility/play.js | 3 +++ commands/utility/translate.js | 1 + index.js | 9 ++++++++ 34 files changed, 187 insertions(+), 35 deletions(-) diff --git a/commands/admin/autoresponse.js b/commands/admin/autoresponse.js index e734795b..8c71130e 100644 --- a/commands/admin/autoresponse.js +++ b/commands/admin/autoresponse.js @@ -9,7 +9,10 @@ class autoresponseCommand extends Command { args: [ { id: 'text', - type: 'string' + type: 'string', + prompt: { + start: 'Do you want to **enable** or **disable** auto response?', + } }, { id: 'all', diff --git a/commands/admin/ban.js b/commands/admin/ban.js index 8c893473..b1a53bad 100644 --- a/commands/admin/ban.js +++ b/commands/admin/ban.js @@ -8,11 +8,18 @@ class BanCommand extends Command { args: [ { id: 'member', - type: 'member' + type: 'member', + prompt: { + start: 'Wich member do you want to ban?', + } }, { id: 'reasons', type: 'string', + prompt: { + start: 'For what reasons?', + optional: true + }, match: 'rest' } ], diff --git a/commands/admin/bye.js b/commands/admin/bye.js index 7e222808..5dd409f3 100644 --- a/commands/admin/bye.js +++ b/commands/admin/bye.js @@ -12,6 +12,9 @@ class byeCommand extends Command { { id: 'message', type: 'string', + prompt: { + start: 'What message should the bot say when a user leave?', + }, match: 'rest' } ], diff --git a/commands/admin/kick.js b/commands/admin/kick.js index 6561b1f2..c8e34f46 100644 --- a/commands/admin/kick.js +++ b/commands/admin/kick.js @@ -8,11 +8,18 @@ class KickCommand extends Command { args: [ { id: 'member', - type: 'member' + type: 'member', + prompt: { + start: 'Wich member do you want to ban?', + } }, { id: 'reasons', type: 'string', + prompt: { + start: 'For what reasons?', + optional: true + }, match: 'rest' } ], diff --git a/commands/admin/prune.js b/commands/admin/prune.js index 86d35487..e202d2e4 100644 --- a/commands/admin/prune.js +++ b/commands/admin/prune.js @@ -8,6 +8,9 @@ class PruneCommand extends Command { args: [ { id: 'amount', + prompt: { + start: 'How many message should i delete?', + }, type: 'integer' } ], diff --git a/commands/admin/shameboard.js b/commands/admin/shameboard.js index 034ea22e..b7f73d62 100644 --- a/commands/admin/shameboard.js +++ b/commands/admin/shameboard.js @@ -12,12 +12,25 @@ class shameboardCommand extends Command { { id: 'emote', type: 'string', + prompt: { + start: 'What emote should be used to enter the shameboard?', + optional: true + }, default: '✡' }, { id: 'count', + prompt: { + start: 'How many times should that emote be reacted to enter the shameboard?', + optional: true + }, type: 'integer', default: '4' + }, + { + id: 'remove', + match: 'flag', + flag: '--remove' } ], description: { @@ -29,15 +42,22 @@ class shameboardCommand extends Command { } async exec(message, args) { - let shameboardChannel = message.channel.id; + if (!args.remove) { + let shameboardChannel = message.channel.id; - fs.writeFile(`./board/shame${message.guild.id}.json`, `{"shameboard": "${shameboardChannel}" , "emote": "${args.emote}", "count": "${args.count}"}`, function (err) { - if (err) { - console.log(err); - } - }); - - return message.channel.send(`This channel have been set as the shameboard with ${args.emote} with the minium of ${args.count}`); + fs.writeFile(`./board/shame${message.guild.id}.json`, `{"shameboard": "${shameboardChannel}" , "emote": "${args.emote}", "count": "${args.count}"}`, function (err) { + if (err) { + console.log(err); + } + }); + + return message.channel.send(`This channel have been set as the shameboard with ${args.emote} with the minium of ${args.count}`); + } else { + fs.unlink(`./board/shame${message.guild.id}.json`, function (err) { + if (err) return message.channel.send('There is no shameboard'); + return message.channel.send('Deleted the shameboard'); + }); + } } } diff --git a/commands/admin/slowmode.js b/commands/admin/slowmode.js index b4a3ac06..cf25c1bb 100644 --- a/commands/admin/slowmode.js +++ b/commands/admin/slowmode.js @@ -3,17 +3,23 @@ const { Command } = require('discord-akairo'); class SlowmodeCommand extends Command { constructor() { super('Slowmode', { - aliases: ['slowmode', 'slow'], + aliases: ['slowmode', 'slow', 'cooldown'], category: 'admin', args: [ { id: 'slowmodeNumber', + prompt: { + start: 'what do you want the delay to be between each message?', + }, type: 'integer' }, { id: 'realtime', + prompt: { + start: 'For how long should the slowmode last?', + optional: true + }, type: 'integer', - optional: true, } ], clientPermissions: ['MANAGE_CHANNELS'], diff --git a/commands/admin/starboard.js b/commands/admin/starboard.js index 2cf61cd7..38063aa2 100644 --- a/commands/admin/starboard.js +++ b/commands/admin/starboard.js @@ -12,12 +12,25 @@ class StarBoardCommand extends Command { { id: 'emote', type: 'string', + prompt: { + start: 'What emote should be used to enter the shameboard?', + optional: true + }, default: '🌟' }, { id: 'count', type: 'integer', + prompt: { + start: 'How many times should that emote be reacted to enter the shameboard?', + optional: true + }, default: '4' + }, + { + id: 'remove', + match: 'flag', + flag: '--remove' } ], description: { @@ -29,15 +42,22 @@ class StarBoardCommand extends Command { } async exec(message, args) { - let starboardChannel = message.channel.id; + if (!args.remove) { + let starboardChannel = message.channel.id; - fs.writeFile(`./board/star${message.guild.id}.json`, `{"starboard": "${starboardChannel}", "emote": "${args.emote}", "count": "${args.count}"}`, function (err) { - if (err) { - console.log(err); - } - }); - - return message.channel.send(`This channel have been set as the starboard with ${args.emote} with the minium of ${args.count}`); + fs.writeFile(`./board/star${message.guild.id}.json`, `{"starboard": "${starboardChannel}", "emote": "${args.emote}", "count": "${args.count}"}`, function (err) { + if (err) { + console.log(err); + } + }); + + return message.channel.send(`This channel have been set as the starboard with ${args.emote} with the minium of ${args.count}`); + } else { + fs.unlink(`./board/star${message.guild.id}.json`, function (err) { + if (err) return message.channel.send('There is no shameboard'); + return message.channel.send('Deleted the starboard'); + }); + } } } diff --git a/commands/admin/tag.js b/commands/admin/tag.js index f6d7bc4c..5dbb737a 100644 --- a/commands/admin/tag.js +++ b/commands/admin/tag.js @@ -11,12 +11,18 @@ class TagCommand extends Command { args: [ { id: 'trigger', - type: 'string' + type: 'string', + prompt: { + start: 'What word or sentence should trigger it?', + } }, { id: 'response', type: 'string', - match: 'rest' + match: 'rest', + prompt: { + start: 'What word or sentence should the response be?', + } } ], channelRestriction: 'guild', diff --git a/commands/admin/unban.js b/commands/admin/unban.js index 4b209dd5..aa690dc2 100644 --- a/commands/admin/unban.js +++ b/commands/admin/unban.js @@ -8,7 +8,10 @@ class UnbanCommand extends Command { args: [ { id: 'member', - type: 'user' + type: 'member', + prompt: { + start: 'Wich member do you want to unban?', + } } ], clientPermissions: ['BAN_MEMBERS'], diff --git a/commands/admin/untag.js b/commands/admin/untag.js index f1a0fbf4..9a290516 100644 --- a/commands/admin/untag.js +++ b/commands/admin/untag.js @@ -12,7 +12,10 @@ class UnTagCommand extends Command { { id: 'trigger', type: 'string', - match: 'rest' + match: 'rest', + prompt: { + start: 'wich tag do you want to remove?', + } } ], channelRestriction: 'guild', diff --git a/commands/admin/welcome.js b/commands/admin/welcome.js index c90db870..46460b17 100644 --- a/commands/admin/welcome.js +++ b/commands/admin/welcome.js @@ -12,7 +12,10 @@ class welcomeCommand extends Command { { id: 'message', type: 'string', - match: 'rest' + match: 'rest', + prompt: { + start: 'What message do you want to welcome peoples?', + } } ], description: { diff --git a/commands/fun/reddit.js b/commands/fun/reddit.js index bbefa24f..e3d2f906 100644 --- a/commands/fun/reddit.js +++ b/commands/fun/reddit.js @@ -11,6 +11,10 @@ class RedditCommand extends Command { { id: 'sub', type: 'string', + prompt: { + start: 'What subreddit do you want to browse?', + optional: true + }, default: 'random', match: 'rest' } diff --git a/commands/fun/spb.js b/commands/fun/spb.js index 63043b35..88d416b7 100644 --- a/commands/fun/spb.js +++ b/commands/fun/spb.js @@ -10,7 +10,10 @@ class spbCommand extends Command { args: [ { id: 'link', - type: 'string' + type: 'string', + prompt: { + start: 'Need a shitpostbot5000 template link!', + } } ], description: { diff --git a/commands/fun/tts/dectalk.js b/commands/fun/tts/dectalk.js index 3a731dc7..9ac2503a 100644 --- a/commands/fun/tts/dectalk.js +++ b/commands/fun/tts/dectalk.js @@ -12,6 +12,9 @@ class dectalkCommand extends Command { { id: 'decMessage', type: 'string', + prompt: { + start: 'Write something so i can say it back in dectalk', + }, match: 'rest' } ], diff --git a/commands/fun/tts/dectalkvc.js b/commands/fun/tts/dectalkvc.js index 6958be1d..808a0f4b 100644 --- a/commands/fun/tts/dectalkvc.js +++ b/commands/fun/tts/dectalkvc.js @@ -12,6 +12,9 @@ class dectalkvcCommand extends Command { { id: 'decMessage', type: 'string', + prompt: { + start: 'Write something so i can say it back in dectalk', + }, match: 'rest' } ], diff --git a/commands/fun/tts/sam.js b/commands/fun/tts/sam.js index b0e58994..1a50cb11 100644 --- a/commands/fun/tts/sam.js +++ b/commands/fun/tts/sam.js @@ -12,6 +12,9 @@ class samCommand extends Command { { id: 'samMessage', type: 'string', + prompt: { + start: 'Write something so i can say it back in sam', + }, match: 'rest' } ], diff --git a/commands/fun/tts/samvc.js b/commands/fun/tts/samvc.js index 9b74cd61..7a273e56 100644 --- a/commands/fun/tts/samvc.js +++ b/commands/fun/tts/samvc.js @@ -12,6 +12,9 @@ class samvcCommand extends Command { { id: 'samMessage', type: 'string', + prompt: { + start: 'Write something so i can say it back in sam', + }, match: 'rest' } ], diff --git a/commands/fun/tts/tts.js b/commands/fun/tts/tts.js index 070193a2..006bc5ec 100644 --- a/commands/fun/tts/tts.js +++ b/commands/fun/tts/tts.js @@ -13,6 +13,9 @@ class TtsCommand extends Command { { id: 'text', type: 'string', + prompt: { + start: 'Write something so i can say it back in Google tts', + }, match: 'rest' } ], diff --git a/commands/fun/tts/ttsvc.js b/commands/fun/tts/ttsvc.js index 29aaa2ef..5f4c66bf 100644 --- a/commands/fun/tts/ttsvc.js +++ b/commands/fun/tts/ttsvc.js @@ -14,6 +14,9 @@ class TtsvcCommand extends Command { { id: 'text', type: 'string', + prompt: { + start: 'Write something so i can say it back in Google tts', + }, match: 'rest' } ], diff --git a/commands/general/clap.js b/commands/general/clap.js index be0addc6..582abd6f 100644 --- a/commands/general/clap.js +++ b/commands/general/clap.js @@ -9,6 +9,9 @@ class ClapCommand extends Command { { id: 'text', type: 'string', + prompt: { + start: 'Write something so i can replace the space with 👏', + }, match: 'rest' } ], diff --git a/commands/general/emotesay.js b/commands/general/emotesay.js index b19e6322..6119ce1a 100644 --- a/commands/general/emotesay.js +++ b/commands/general/emotesay.js @@ -11,6 +11,9 @@ class EmotesayCommand extends Command { { id: 'text', type: 'string', + prompt: { + start: 'Write something so i can replace the space with dancing emote', + }, match: 'rest' } ], diff --git a/commands/general/say.js b/commands/general/say.js index 599a1635..a76f2813 100644 --- a/commands/general/say.js +++ b/commands/general/say.js @@ -11,6 +11,9 @@ class SayCommand extends Command { { id: 'text', type: 'string', + prompt: { + start: 'Write something so i can say it back', + }, match: 'rest' } ], diff --git a/commands/general/sayd.js b/commands/general/sayd.js index 6a9443cb..9cccc385 100644 --- a/commands/general/sayd.js +++ b/commands/general/sayd.js @@ -11,6 +11,9 @@ class SaydCommand extends Command { { id: 'text', type: 'string', + prompt: { + start: 'Write something so i can say it back', + }, match: 'rest' } ], diff --git a/commands/general/spoiler.js b/commands/general/spoiler.js index 7433e063..b7bf45f9 100644 --- a/commands/general/spoiler.js +++ b/commands/general/spoiler.js @@ -9,6 +9,9 @@ class spoilerCommand extends Command { { id: 'text', type: 'string', + prompt: { + start: 'Write something so i can say it back in spoiler', + }, match: 'rest' } ], diff --git a/commands/general/tweet.js b/commands/general/tweet.js index a4abca32..0248d581 100644 --- a/commands/general/tweet.js +++ b/commands/general/tweet.js @@ -18,6 +18,9 @@ class tweetCommand extends Command { { id: 'text', type: 'string', + prompt: { + start: 'Write something to tweet', + }, match: 'rest' } ], diff --git a/commands/utility/download.js b/commands/utility/download.js index 49371427..698e445f 100644 --- a/commands/utility/download.js +++ b/commands/utility/download.js @@ -13,11 +13,14 @@ class DownloadCommand extends Command { { id: 'link', type: 'string', - default: 'https://www.youtube.com/watch?v=6n3pFFPSlW4' + prompt: { + start: 'Send the link of wich video you want to download', + } }, { id: 'alt', - type: 'bool', + match: 'flag', + flag: '--alt' } ], clientPermissions: ['ATTACH_FILES'], diff --git a/commands/utility/downloadSpoiler.js b/commands/utility/downloadSpoiler.js index 50614ed9..048e26d6 100644 --- a/commands/utility/downloadSpoiler.js +++ b/commands/utility/downloadSpoiler.js @@ -13,11 +13,14 @@ class DownloadspoilerCommand extends Command { { id: 'link', type: 'string', - default: 'https://www.youtube.com/watch?v=6n3pFFPSlW4' + prompt: { + start: 'Send the link of wich video you want to download', + } }, { id: 'alt', - type: 'bool', + match: 'flag', + flag: '--alt' } ], clientPermissions: ['ATTACH_FILES'], @@ -36,7 +39,7 @@ class DownloadspoilerCommand extends Command { if (link.includes('http') || link.includes('www')) { if (args.alt) { console.log('alt download!'); - fs.unlink('./SPOILER_SPOILER_video.mp4', (err) => { + fs.unlink('./SPOILER_video.mp4', (err) => { if (err); }); return youtubedl.exec(args.link, ['-o', './SPOILER_video.mp4'], {}, function(err, output) { diff --git a/commands/utility/feedback.js b/commands/utility/feedback.js index b69a0c9f..2ee331cc 100644 --- a/commands/utility/feedback.js +++ b/commands/utility/feedback.js @@ -11,6 +11,9 @@ class FeedbackCommand extends Command { { id: 'text', type: 'string', + prompt: { + start: 'What do you want to say to the owner?', + }, match: 'rest' } ], diff --git a/commands/utility/invite.js b/commands/utility/invite.js index 6e24432e..83200dbc 100644 --- a/commands/utility/invite.js +++ b/commands/utility/invite.js @@ -9,8 +9,8 @@ class InviteCommand extends Command { args: [ { id: 'here', - type: 'string', - optional: true + match: 'flag', + flag: '--here' } ], description: { @@ -23,7 +23,7 @@ class InviteCommand extends Command { async exec(message, args) { let invMessage = `You can add me from here: https://discordapp.com/oauth2/authorize?client_id=${this.client.user.id}&scope=bot&permissions=0\nYou can also join my support server over here: ${supportServer} come and say hi :)`; - if (args.here == 'here') { + if (args.here) { message.channel.send(invMessage); } else { message.channel.send('Check your dm'); diff --git a/commands/utility/musicMatch.js b/commands/utility/musicMatch.js index 083beaee..7e196466 100644 --- a/commands/utility/musicMatch.js +++ b/commands/utility/musicMatch.js @@ -16,6 +16,9 @@ class musicCommand extends Command { { id: 'music', type: 'string', + prompt: { + start: 'Send the link of wich video you want to know song', + }, match: 'rest' } ], diff --git a/commands/utility/play.js b/commands/utility/play.js index e642052c..a147da30 100644 --- a/commands/utility/play.js +++ b/commands/utility/play.js @@ -10,6 +10,9 @@ class playCommand extends Command { { id: 'ytblink', type: 'string', + prompt: { + start: 'Send the link of wich video you want to play', + }, match: 'rest', } ], diff --git a/commands/utility/translate.js b/commands/utility/translate.js index a8b8edf8..ed2c8130 100644 --- a/commands/utility/translate.js +++ b/commands/utility/translate.js @@ -13,6 +13,7 @@ class TranslationCommand extends Command { id: 'language', type: ['az','ml','sq','mt','am','mk','en','mi','ar','mr','hy','mhr','af','mn','eu','de','ba','ne','be','no','bn','pa','my','pap','bg','fa','bs','pl','cy','pt','hu','ro','vi','ru','ht','ceb','gl','sr','nl','si','mrj','sk','el','sl','ka','sw','gu','su','da','tg','he','th','yi','tl','id','ta','ga','tt','it','te','is','tr','es','udm','kk','uz','kn','uk','ca','ur','ky','fi','zh','fr','ko','hi','xh','hr','km','cs','lo','sv','la','gd','lv','et','lt','eo','lb','jv','mg','ja','ms'], prompt: { + start: 'In what language do you want to translate it to', retry: 'That\'s not a valid language! try again.' }, default: 'en' diff --git a/index.js b/index.js index c587cad8..8bcd5a48 100644 --- a/index.js +++ b/index.js @@ -14,6 +14,15 @@ class hahaYesClient extends AkairoClient { this.commandHandler = new CommandHandler(this, { directory: './commands/', prefix: prefix, + argumentDefaults: { + prompt: { + timeout: 'Time ran out, command has been cancelled.', + ended: 'Too many retries, command has been cancelled.', + cancel: 'Command has been cancelled.', + retries: 4, + time: 30000 + } + }, commandUtil: true, commandUtilLifetime: 60000, allowMention: true,