diff --git a/assets/json/rotten-tomatoes.json b/assets/json/rotten-tomatoes.json deleted file mode 100644 index 313f613a..00000000 --- a/assets/json/rotten-tomatoes.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "critic": { - "certified": "<:certified_fresh:391778461951459339>", - "fresh": "<:red_tomato:391778462974607360>", - "rotten": "<:splat_tomato:391778462194728961>" - }, - "audience": { - "Upright": "<:standing_popcorn:391778463045910538>", - "Spilled": "<:tipped_popcorn:391778462312169472>" - } -} diff --git a/commands/other/timer.js b/commands/other/timer.js new file mode 100644 index 00000000..c8d1ae2d --- /dev/null +++ b/commands/other/timer.js @@ -0,0 +1,33 @@ +const { Command } = require('discord.js-commando'); +const { wait } = require('../../util/Util'); + +module.exports = class TimerCommand extends Command { + constructor(client) { + super(client, { + name: 'timer', + group: 'other', + memberName: 'timer', + description: 'Sets a timer for a certain amount of time.', + args: [ + { + key: 'seconds', + prompt: 'How many seconds do you want to set a timer for?', + type: 'float', + min: 1, + max: 600 + } + ] + }); + + this.timers = new Set(); + } + + async run(msg, { seconds }) { + if (this.timers.has(msg.author.id)) return msg.reply('You can only have one timer at a time.'); + this.timers.add(msg.author.id); + await msg.say(`Setting a timer for ${seconds} seconds...`); + await wait(seconds / 1000); + this.timers.delete(msg.author.id); + return msg.reply('Time\'s up!'); + } +}; diff --git a/commands/random/opinion.js b/commands/random/opinion.js new file mode 100644 index 00000000..3024c753 --- /dev/null +++ b/commands/random/opinion.js @@ -0,0 +1,30 @@ +const { Command } = require('discord.js-commando'); +const { stripIndents } = require('common-tags'); +const opinions = ['👍', '👎']; + +module.exports = class OpinionCommand extends Command { + constructor(client) { + super(client, { + name: 'opinion', + aliases: ['sex'], + group: 'random', + memberName: 'opinion', + description: 'Determines the opinion on something.', + args: [ + { + key: 'question', + prompt: 'What do you want to get an opinion on?', + type: 'string', + max: 1950 + } + ] + }); + } + + run(msg, { question }) { + return msg.say(stripIndents` + ${question} + ${opinions[Math.floor(Math.random() * opinions.length)]} + `); + } +}; diff --git a/commands/search/google.js b/commands/search/google.js index a6ca2092..3ca662c6 100644 --- a/commands/search/google.js +++ b/commands/search/google.js @@ -16,7 +16,7 @@ module.exports = class GoogleCommand extends Command { prompt: 'What would you like to search for?', type: 'string', validate: query => { - if (encodeURIComponent(query).length < 1973) return true; + if (encodeURIComponent(query).length < 1950) return true; return 'Invalid query, your query is too long.'; } } diff --git a/commands/search/map.js b/commands/search/map.js index ed06266e..20199f17 100644 --- a/commands/search/map.js +++ b/commands/search/map.js @@ -25,7 +25,7 @@ module.exports = class MapCommand extends Command { prompt: 'What location would you like to get a map of?', type: 'string', validate: location => { - if (encodeURIComponent(location).length < 1965) return true; + if (encodeURIComponent(location).length < 1950) return true; return 'Invalid location, your location is too long.'; } } diff --git a/commands/search/rotten-tomatoes.js b/commands/search/rotten-tomatoes.js index 69ccd9d2..da3bac9b 100644 --- a/commands/search/rotten-tomatoes.js +++ b/commands/search/rotten-tomatoes.js @@ -2,7 +2,6 @@ const { Command } = require('discord.js-commando'); const { MessageEmbed } = require('discord.js'); const snekfetch = require('snekfetch'); const { shorten } = require('../../util/Util'); -const { critic, audience } = require('../../assets/json/rotten-tomatoes'); module.exports = class RottenTomatoesCommand extends Command { constructor(client) { @@ -36,8 +35,8 @@ module.exports = class RottenTomatoesCommand extends Command { const urlID = find.url.replace('/m/', ''); const { text } = await snekfetch.get(`https://www.rottentomatoes.com/api/private/v1.0/movies/${urlID}`); const body = JSON.parse(text); - const criticS = body.ratingSummary.allCritics; - const audienceS = body.ratingSummary.audience; + const criticScore = body.ratingSummary.allCritics; + const audienceScore = body.ratingSummary.audience; const embed = new MessageEmbed() .setColor(0xFFEC02) .setTitle(`${body.title} (${body.year})`) @@ -46,9 +45,9 @@ module.exports = class RottenTomatoesCommand extends Command { .setDescription(shorten(body.ratingSummary.consensus)) .setThumbnail(body.posters.original) .addField('❯ Critic Score', - criticS.meterValue ? `${critic[criticS.meterClass]} ${criticS.meterValue}%` : '???', true) + criticScore.meterValue ? `${criticScore.meterValue}%` : '???', true) .addField('❯ Audience Score', - audienceS.meterScore ? `${audience[body.ratings.audience_rating]} ${audienceS.meterScore}%` : '???', true); + audienceScore.meterScore ? `${audienceScore.meterScore}%` : '???', true); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/text-edit/lmgtfy.js b/commands/text-edit/lmgtfy.js index 5dbb4423..300c3dbd 100644 --- a/commands/text-edit/lmgtfy.js +++ b/commands/text-edit/lmgtfy.js @@ -14,7 +14,7 @@ module.exports = class LMGTFYCommand extends Command { prompt: 'What would you like the link to search for?', type: 'string', validate: query => { - if (encodeURIComponent(query).length < 1973) return true; + if (encodeURIComponent(query).length < 1950) return true; return 'Invalid query, your query is too long.'; }, parse: query => encodeURIComponent(query) diff --git a/commands/text-edit/mocking.js b/commands/text-edit/mocking.js index aedf9e40..9967b780 100644 --- a/commands/text-edit/mocking.js +++ b/commands/text-edit/mocking.js @@ -1,4 +1,5 @@ const { Command } = require('discord.js-commando'); +const { MOCKING_EMOJI_ID } = process.env; module.exports = class MockingCommand extends Command { constructor(client) { @@ -23,7 +24,7 @@ module.exports = class MockingCommand extends Command { run(msg, { text }) { for (let i = 0; i < text.length; i += Math.floor(Math.random() * 4)) text[i] = text[i].toUpperCase(); - return msg.say(`${text.join('')} <:sponge:390141884070363138>`); + return msg.say(`${text.join('')} <:mocking:${MOCKING_EMOJI_ID}>`); } }; diff --git a/package.json b/package.json index 8f9f3dc6..23551ec8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "66.5.2", + "version": "66.6.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {