mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-06 06:10:49 +02:00
More dead commands
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
const Command = require('../../framework/Command');
|
||||
|
||||
module.exports = class LatlmesCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'latlmes',
|
||||
group: 'edit-text',
|
||||
memberName: 'latlmes',
|
||||
description: 'Creates a Latlmes fake link that redirects to a rickroll.',
|
||||
credit: [
|
||||
{
|
||||
name: 'Latlmes',
|
||||
url: 'https://www.latlmes.com/',
|
||||
reason: 'API'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'section',
|
||||
prompt: 'What section of the news should the link display?',
|
||||
type: 'string',
|
||||
max: 100,
|
||||
parse: query => encodeURIComponent(query.replaceAll(' ', '-').toLowerCase())
|
||||
},
|
||||
{
|
||||
key: 'query',
|
||||
prompt: 'What would you like the link to display as?',
|
||||
type: 'string',
|
||||
max: 500,
|
||||
parse: query => encodeURIComponent(query.replaceAll(' ', '-').toLowerCase())
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { section, query }) {
|
||||
return msg.say(`http://www.latlmes.com/${section}/${query}-1`);
|
||||
}
|
||||
};
|
||||
@@ -1,42 +0,0 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const request = require('node-superfetch');
|
||||
|
||||
module.exports = class YodaCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'yoda',
|
||||
aliases: ['yoda-speak'],
|
||||
group: 'edit-text',
|
||||
memberName: 'yoda',
|
||||
description: 'Converts text to Yoda speak.',
|
||||
credit: [
|
||||
{
|
||||
name: 'richchurcher',
|
||||
url: 'https://github.com/richchurcher',
|
||||
reason: 'API',
|
||||
reasonURL: 'https://github.com/richchurcher/yoda-api'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'sentence',
|
||||
prompt: 'What sentence would you like to convert to Yoda speak?',
|
||||
type: 'string',
|
||||
max: 500
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { sentence }) {
|
||||
try {
|
||||
const { body } = await request
|
||||
.get('https://yoda-api.appspot.com/api/v1/yodish')
|
||||
.query({ text: sentence });
|
||||
if (!body.yodish) return msg.reply('Empty, this message is. Try again later, you must.');
|
||||
return msg.say(body.yodish);
|
||||
} catch (err) {
|
||||
return msg.reply(`Being a jerk again, Yoda is: \`${err.message}\`. Try again later, you must.`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,118 +0,0 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const request = require('node-superfetch');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { formatNumber, list } = require('../../util/Util');
|
||||
const categories = ['qotd', 'culture', 'people', 'names', 'questions'];
|
||||
|
||||
module.exports = class GoogleFeudCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'google-feud',
|
||||
group: 'games-sp',
|
||||
memberName: 'google-feud',
|
||||
description: 'Attempt to determine the top suggestions for a Google search.',
|
||||
credit: [
|
||||
{
|
||||
name: 'Google',
|
||||
url: 'https://www.google.com/',
|
||||
reason: 'Autofill API'
|
||||
},
|
||||
{
|
||||
name: 'Google Feud',
|
||||
url: 'http://www.googlefeud.com/',
|
||||
reason: 'Question Data, Original Game'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'category',
|
||||
prompt: `What category do you want to use for the game? Either ${list(categories, 'or')}.`,
|
||||
type: 'string',
|
||||
oneOf: categories,
|
||||
parse: category => category.toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
this.questions = null;
|
||||
}
|
||||
|
||||
async run(msg, { category }) {
|
||||
const current = this.client.games.get(msg.channel.id);
|
||||
if (current) return msg.reply(`Please wait until the current game of \`${current.name}\` is finished.`);
|
||||
this.client.games.set(msg.channel.id, { name: this.name });
|
||||
try {
|
||||
if (!this.questions) await this.fetchQuestions();
|
||||
const question = this.questions[category][Math.floor(Math.random() * this.questions[category].length)];
|
||||
const suggestions = await this.fetchSuggestions(question);
|
||||
if (!suggestions) return msg.say('Could not find any results.');
|
||||
const display = new Array(suggestions.length).fill('???');
|
||||
let tries = 4;
|
||||
let score = 0;
|
||||
while (display.includes('???') && tries) {
|
||||
const embed = this.makeEmbed(question, tries, suggestions, display);
|
||||
await msg.embed(embed);
|
||||
const msgs = await msg.channel.awaitMessages({
|
||||
filter: res => res.author.id === msg.author.id,
|
||||
max: 1,
|
||||
time: 30000
|
||||
});
|
||||
if (!msgs.size) {
|
||||
await msg.say('Time is up!');
|
||||
break;
|
||||
}
|
||||
const choice = msgs.first().content.toLowerCase();
|
||||
if (suggestions.includes(choice)) {
|
||||
score += 10000 - (suggestions.indexOf(choice) * 1000);
|
||||
display[suggestions.indexOf(choice)] = choice;
|
||||
} else {
|
||||
--tries;
|
||||
}
|
||||
}
|
||||
this.client.games.delete(msg.channel.id);
|
||||
if (!display.includes('???')) {
|
||||
return msg.say(`You win! Nice job, master of Google!\n**Final Score: $${formatNumber(score)}**`);
|
||||
}
|
||||
const final = this.makeEmbed(question, tries, suggestions, suggestions);
|
||||
return msg.say(`Better luck next time!\n**Final Score: $${formatNumber(score)}**`, { embeds: [final] });
|
||||
} catch (err) {
|
||||
this.client.games.delete(msg.channel.id);
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
|
||||
async fetchSuggestions(question) {
|
||||
const { text } = await request
|
||||
.get('https://suggestqueries.google.com/complete/search')
|
||||
.query({
|
||||
client: 'firefox',
|
||||
q: question
|
||||
});
|
||||
const suggestions = JSON.parse(text)[1]
|
||||
.filter(suggestion => suggestion.toLowerCase() !== question.toLowerCase());
|
||||
if (!suggestions.length) return null;
|
||||
return suggestions.map(suggestion => suggestion.toLowerCase().replace(question.toLowerCase(), '').trim());
|
||||
}
|
||||
|
||||
async fetchQuestions() {
|
||||
if (this.questions) return this.questions;
|
||||
const { body } = await request.get('https://www.googlefeud.com/autocomplete/js/questions-en.json');
|
||||
const questions = {};
|
||||
for (const category of categories) questions[category] = body[category];
|
||||
this.questions = questions;
|
||||
return this.questions;
|
||||
}
|
||||
|
||||
makeEmbed(question, tries, suggestions, display) {
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x005AF0)
|
||||
.setTitle(`${question}...?`)
|
||||
.setDescription('Type the choice you think is a suggestion _without_ the question.')
|
||||
.setFooter(`${tries} ${tries === 1 ? 'try' : 'tries'} remaining!`);
|
||||
for (let i = 0; i < suggestions.length; i++) {
|
||||
const num = formatNumber(10000 - (i * 1000));
|
||||
embed.addField(`❯ ${num}`, display[i], true);
|
||||
}
|
||||
return embed;
|
||||
}
|
||||
};
|
||||
@@ -1,17 +0,0 @@
|
||||
const Command = require('../../framework/Command');
|
||||
|
||||
module.exports = class IbHardcoreEditionCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'ib-hardcore-edition',
|
||||
aliases: ['ib-hardcore', 'ib'],
|
||||
group: 'games-sp',
|
||||
memberName: 'ib-hardcore-edition',
|
||||
description: 'Responds with the download link for Ib: Hardcore Edition.'
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say('https://drive.google.com/file/d/1RHDvI8RthElngagvwu-GXUN69-oHsUBO/view?usp=sharing');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user