mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-09 09:12:07 +02:00
Updates
This commit is contained in:
@@ -56,12 +56,6 @@ client.on('warn', err => console.warn('[WARNING]', err));
|
||||
|
||||
client.on('commandError', (command, err) => console.error('[COMMAND ERROR]', command.name, err));
|
||||
|
||||
client.dispatcher.addInhibitor(msg => {
|
||||
if (msg.channel.type !== 'text' || !msg.channel.topic) return false;
|
||||
if (msg.channel.topic.includes('<blocked>')) return 'topic blocked';
|
||||
return false;
|
||||
});
|
||||
|
||||
client.login(XIAO_TOKEN);
|
||||
|
||||
process.on('unhandledRejection', err => {
|
||||
|
||||
@@ -38,5 +38,33 @@
|
||||
{
|
||||
"text": "Travelers of the Wind",
|
||||
"type": "LISTENING"
|
||||
},
|
||||
{
|
||||
"text": "you eat pant",
|
||||
"type": "WATCHING"
|
||||
},
|
||||
{
|
||||
"text": "anime",
|
||||
"type": "WATCHING"
|
||||
},
|
||||
{
|
||||
"text": "with a big red button",
|
||||
"type": "PLAYING"
|
||||
},
|
||||
{
|
||||
"text": "with you",
|
||||
"type": "PLAYING"
|
||||
},
|
||||
{
|
||||
"text": "with a ban hammer",
|
||||
"type": "PLAYING"
|
||||
},
|
||||
{
|
||||
"text": "you",
|
||||
"type": "PLAYING"
|
||||
},
|
||||
{
|
||||
"text": "Nothing",
|
||||
"type": "PLAYING"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -3217,6 +3217,13 @@
|
||||
"The Royal Canadian Mounted Police.",
|
||||
"An icy handjob from an Edmonton hooker.",
|
||||
"eat pant.",
|
||||
"<Blank>"
|
||||
"<Blank>",
|
||||
"dragonfire535.",
|
||||
"ebearskittychan.",
|
||||
"XiaoBot.",
|
||||
"XiaoBot's public source code.",
|
||||
"Discord.",
|
||||
"Beta.",
|
||||
"Delta."
|
||||
]
|
||||
}
|
||||
|
||||
@@ -30,8 +30,7 @@ module.exports = class HoroscopeCommand extends Command {
|
||||
|
||||
async run(msg, { sign }) {
|
||||
try {
|
||||
const { text } = await snekfetch.get(`http://sandipbgt.com/theastrologer/api/horoscope/${sign}/today/`);
|
||||
const body = JSON.parse(text);
|
||||
const { body } = await snekfetch.get(`http://theastrologer-api.herokuapp.com/api/horoscope/${sign}/today`);
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x9797FF)
|
||||
.setTitle(`Horoscope for ${body.sunsign}...`)
|
||||
|
||||
@@ -87,20 +87,8 @@ module.exports = class ApplesToApplesCommand extends Command {
|
||||
continue;
|
||||
}
|
||||
if (chosen === '<Blank>') {
|
||||
await player.user.send(stripIndents`
|
||||
What do you want the blank card to say?
|
||||
Only answers under 100 characters will be counted.
|
||||
`);
|
||||
const blank = await player.user.dmChannel.awaitMessages(res => res.content.length < 100, {
|
||||
max: 1,
|
||||
time: 120000
|
||||
});
|
||||
if (!blank.size) { // eslint-disable-line max-depth
|
||||
await player.user.send('Skipping your turn...');
|
||||
continue;
|
||||
}
|
||||
player.hand.delete('<Blank>');
|
||||
chosen = blank.first().content;
|
||||
const handled = await this.handleBlank(player);
|
||||
chosen = handled;
|
||||
} else {
|
||||
player.hand.delete(chosen);
|
||||
}
|
||||
@@ -166,4 +154,15 @@ module.exports = class ApplesToApplesCommand extends Command {
|
||||
}
|
||||
return players;
|
||||
}
|
||||
|
||||
async handleBlank(player) {
|
||||
await player.user.send('What do you want the blank card to say? Must be 100 or less characters.');
|
||||
const blank = await player.user.dmChannel.awaitMessages(res => res.content.length <= 100, {
|
||||
max: 1,
|
||||
time: 120000
|
||||
});
|
||||
player.hand.delete('<Blank>');
|
||||
if (!blank.size) return `A blank card ${player.user.tag} forgot to fill out.`;
|
||||
return blank.first().content;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -89,20 +89,8 @@ module.exports = class CardsAgainstHumanityCommand extends Command {
|
||||
continue;
|
||||
}
|
||||
if (chosen.includes('<Blank>')) {
|
||||
await player.user.send(stripIndents`
|
||||
What do you want the blank card to say?
|
||||
Only answers under 100 characters will be counted.
|
||||
`);
|
||||
const blank = await player.user.dmChannel.awaitMessages(res => res.content.length < 100, {
|
||||
max: 1,
|
||||
time: 120000
|
||||
});
|
||||
if (!blank.size) { // eslint-disable-line max-depth
|
||||
await player.user.send('Skipping your turn...');
|
||||
continue;
|
||||
}
|
||||
player.hand.delete('<Blank>');
|
||||
chosen[chosen.indexOf('<Blank>')] = blank.first().content;
|
||||
const handled = await this.handleBlank(player);
|
||||
chosen[chosen.indexOf('<Blank>')] = handled;
|
||||
}
|
||||
for (const card of chosen) player.hand.delete(card);
|
||||
chosenCards.push({
|
||||
@@ -167,4 +155,15 @@ module.exports = class CardsAgainstHumanityCommand extends Command {
|
||||
}
|
||||
return players;
|
||||
}
|
||||
|
||||
async handleBlank(player) {
|
||||
await player.user.send('What do you want the blank card to say? Must be 100 or less characters.');
|
||||
const blank = await player.user.dmChannel.awaitMessages(res => res.content.length <= 100, {
|
||||
max: 1,
|
||||
time: 120000
|
||||
});
|
||||
player.hand.delete('<Blank>');
|
||||
if (!blank.size) return `A blank card ${player.user.tag} forgot to fill out.`;
|
||||
return blank.first().content;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { DBOTS_KEY } = process.env;
|
||||
|
||||
module.exports = class BotInfoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'bot-info',
|
||||
aliases: ['discord-bots', 'dbots'],
|
||||
group: 'search',
|
||||
memberName: 'bot-info',
|
||||
description: 'Responds with information on a specific Discord bot.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'bot',
|
||||
prompt: 'Which bot do you want to get information on?',
|
||||
type: 'user'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { bot }) {
|
||||
try {
|
||||
const { body } = await snekfetch
|
||||
.get(`https://bots.discord.pw/api/bots/${bot.id}`)
|
||||
.set({ Authorization: DBOTS_KEY });
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x9797FF)
|
||||
.setAuthor('Discord Bots', 'https://i.imgur.com/tHTKaks.jpg')
|
||||
.setTitle(body.name)
|
||||
.setURL(`https://bots.discord.pw/bots/${bot.id}`)
|
||||
.setDescription(body.description)
|
||||
.addField('❯ Library',
|
||||
body.library, true)
|
||||
.addField('❯ Invite',
|
||||
`[Here](${body.invite_url})`, true)
|
||||
.addField('❯ Prefix',
|
||||
body.prefix, true);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
if (err.status === 404) return msg.say('Could not find any results.');
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class RecipeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'recipe',
|
||||
aliases: ['recipe-puppy'],
|
||||
group: 'search',
|
||||
memberName: 'recipe',
|
||||
description: 'Searches for recipes based on your query.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'query',
|
||||
prompt: 'What recipe would you like to search for?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { query }) {
|
||||
try {
|
||||
const { text } = await snekfetch
|
||||
.get('http://www.recipepuppy.com/api/')
|
||||
.query({ q: query });
|
||||
const body = JSON.parse(text);
|
||||
if (!body.results.length) return msg.say('Could not find any results.');
|
||||
const recipe = body.results[Math.floor(Math.random() * body.results.length)];
|
||||
const embed = new MessageEmbed()
|
||||
.setAuthor('Recipe Puppy', 'https://i.imgur.com/mn05Z8y.png')
|
||||
.setColor(0xC20000)
|
||||
.setURL(recipe.href)
|
||||
.setTitle(recipe.title)
|
||||
.setDescription(`**Ingredients**: ${recipe.ingredients}`)
|
||||
.setThumbnail(recipe.thumbnail);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
if (err.status === 500) return msg.say('Could not find any results.');
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,58 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { W3W_KEY, GOOGLE_KEY } = process.env;
|
||||
|
||||
module.exports = class What3WordsCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'what-3-words',
|
||||
aliases: ['what-three-words', 'w3w'],
|
||||
group: 'search',
|
||||
memberName: 'what-3-words',
|
||||
description: 'Responds with a map based upon the 3 words you provide.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
args: [
|
||||
{
|
||||
key: 'zoom',
|
||||
label: 'zoom level',
|
||||
prompt: 'What would you like the zoom level to be? Must be a number from 1-20.',
|
||||
type: 'integer',
|
||||
min: 1,
|
||||
max: 20
|
||||
},
|
||||
{
|
||||
key: 'location',
|
||||
prompt: 'What location would you like to get a map of? Use three nouns, like "cat.dog.parrot".',
|
||||
type: 'string',
|
||||
validate: location => {
|
||||
if (location.split('.').length === 3) return true;
|
||||
return 'Invalid location, please enter a valid location, like "cat.dog.parrot".';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { zoom, location }) {
|
||||
try {
|
||||
const { body } = await snekfetch
|
||||
.get('https://api.what3words.com/v2/forward')
|
||||
.query({
|
||||
addr: location,
|
||||
key: W3W_KEY
|
||||
});
|
||||
if (body.status.code === 300) return msg.say('Could not find any results.');
|
||||
const map = await snekfetch
|
||||
.get('https://maps.googleapis.com/maps/api/staticmap')
|
||||
.query({
|
||||
center: `${body.geometry.lat},${body.geometry.lng}`,
|
||||
zoom,
|
||||
size: '500x500',
|
||||
key: GOOGLE_KEY
|
||||
});
|
||||
return msg.say(`<${body.map}>`, { files: [{ attachment: map.body, name: 'what-3-words.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "55.2.1",
|
||||
"version": "56.0.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "XiaoBot.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user