mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-07 23:05:04 +02:00
Bug Fixes
This commit is contained in:
@@ -148,7 +148,7 @@ on the [home server](https://discord.gg/sbMe32W).
|
||||
* **neopet:** Responds with the image of a specific Neopet.
|
||||
* **neopets-item:** Responds with information on a specific Neopets item.
|
||||
* **npm:** Responds with information on an NPM package.
|
||||
* **osu:** Responds with information on an Osu! user.
|
||||
* **osu:** Responds with information on an osu! user.
|
||||
* **periodic-table:** Finds an element on the periodic table.
|
||||
* **pokedex:** Searches the Pokédex for a Pokémon.
|
||||
* **recipe:** Searches for recipes based on your query.
|
||||
|
||||
+10
-4
@@ -1,4 +1,5 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { firstUpperCase } = require('../../util/Util');
|
||||
|
||||
module.exports = class TimeCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -15,7 +16,7 @@ module.exports = class TimeCommand extends Command {
|
||||
label: 'time zone',
|
||||
prompt: 'Which time zone do you want to get the time of?',
|
||||
type: 'string',
|
||||
parse: timeZone => timeZone.replace(/ /g, '_').toUpperCase()
|
||||
parse: timeZone => timeZone.replace(/ /g, '_').toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -23,13 +24,18 @@ module.exports = class TimeCommand extends Command {
|
||||
|
||||
run(msg, { timeZone }) {
|
||||
let neopia = false;
|
||||
if (timeZone === 'NEOPIA/STANDARD' || timeZone === 'NEOPIA') {
|
||||
timeZone = 'AMERICA/VANCOUVER';
|
||||
if (timeZone === 'neopia/standard' || timeZone === 'neopia') {
|
||||
timeZone = 'america/vancouver';
|
||||
neopia = true;
|
||||
}
|
||||
try {
|
||||
const time = new Date().toLocaleTimeString('en-US', { timeZone });
|
||||
return msg.say(`The current time in ${neopia ? 'NEOPIA' : timeZone} is ${time}.`);
|
||||
const location = neopia ? ['neopia'] : timeZone.split('/');
|
||||
const main = firstUpperCase(location[0], /[_ ]/);
|
||||
const sub = location[1] ? firstUpperCase(location[1], /[_ ]/) : null;
|
||||
const subMain = location[2] ? firstUpperCase(location[2], /[_ ]/) : null;
|
||||
const parens = sub ? ` (${subMain ? `${sub}, ` : ''}${main})` : '';
|
||||
return msg.say(`The current time in ${subMain || sub || main}${parens} is ${time}.`);
|
||||
} catch (err) {
|
||||
return msg.reply('Invalid time zone. Refer to <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones>.');
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ module.exports = class TodayInHistoryCommand extends Command {
|
||||
.setTimestamp()
|
||||
.setDescription(`${event.year}: ${event.text}`)
|
||||
.addField('❯ See More',
|
||||
event.links.map(link => `[${link.title}](${link.link.replace(/\)/g, '%29')})`).join(', '));
|
||||
event.links.map(link => `[${link.title}](${link.link.replace(/\)/g, '%29')})`).join('\n'));
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
if (err.status === 404 || err.status === 500) return msg.say('Invalid date.');
|
||||
|
||||
@@ -5,7 +5,7 @@ module.exports = class WouldYouRatherCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'would-you-rather',
|
||||
aliases: ['wy-rather'],
|
||||
aliases: ['wy-rather', 'wyr'],
|
||||
group: 'random',
|
||||
memberName: 'would-you-rather',
|
||||
description: 'Responds with a random "Would you rather ...?" question.'
|
||||
|
||||
@@ -10,7 +10,7 @@ module.exports = class OsuCommand extends Command {
|
||||
aliases: ['osu-user', 'osu-stats'],
|
||||
group: 'search',
|
||||
memberName: 'osu',
|
||||
description: 'Responds with information on an Osu! user.',
|
||||
description: 'Responds with information on an osu! user.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
@@ -39,7 +39,7 @@ module.exports = class OsuCommand extends Command {
|
||||
.addField('❯ Username', data.username, true)
|
||||
.addField('❯ ID', data.user_id, true)
|
||||
.addField('❯ Level', data.level || '???', true)
|
||||
.addField('❯ Accuracy', data.accuracy || '???', true)
|
||||
.addField('❯ Accuracy', data.accuracy ? `${Math.round(data.accuracy)}%` : '???', true)
|
||||
.addField('❯ Rank', data.pp_rank || '???', true)
|
||||
.addField('❯ Play Count', data.playcount || '???', true)
|
||||
.addField('❯ Country', data.country || '???', true)
|
||||
|
||||
@@ -16,15 +16,18 @@ module.exports = class MockingCommand extends Command {
|
||||
prompt: 'WHaT tEXt WoUlD yOu LiKE to COnvErt?',
|
||||
type: 'string',
|
||||
max: 1950,
|
||||
parse: text => text.toLowerCase().split('')
|
||||
parse: text => text.toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
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('')} <:mocking:${MOCKING_EMOJI_ID}>`);
|
||||
const letters = text.split('');
|
||||
for (let i = 0; i < letters.length; i += Math.floor(Math.random() * 4)) {
|
||||
letters[i] = letters[i].toUpperCase();
|
||||
}
|
||||
return msg.say(`${letters.join('')} <:mocking:${MOCKING_EMOJI_ID}>`);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,11 +1,26 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { shuffle } = require('../../util/Util');
|
||||
const { shuffle, firstUpperCase } = require('../../util/Util');
|
||||
|
||||
module.exports = class OrganizationXIIINameCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'organization-xiii-name',
|
||||
aliases: ['xiii-name', 'nobody-name', 'organization-xiii', 'org-xiii', 'xiii', 'organization-13-name', 'org-13'],
|
||||
aliases: [
|
||||
'organization-xiii',
|
||||
'xiii-name',
|
||||
'xiii',
|
||||
'13-name',
|
||||
'org-xiii-name',
|
||||
'org-xiii',
|
||||
'organization-13-name',
|
||||
'organization-13',
|
||||
'org-13-name',
|
||||
'org-13',
|
||||
'organization-name',
|
||||
'org-name',
|
||||
'org',
|
||||
'nobody-name'
|
||||
],
|
||||
group: 'text-edit',
|
||||
memberName: 'organization-xiii-name',
|
||||
description: 'Converts a name into the Organization XIII style.',
|
||||
@@ -15,16 +30,16 @@ module.exports = class OrganizationXIIINameCommand extends Command {
|
||||
prompt: 'What name would you like to convert?',
|
||||
type: 'string',
|
||||
max: 1950,
|
||||
parse: text => text.toLowerCase().split('')
|
||||
parse: text => text.toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
text.push('x');
|
||||
const shuffled = shuffle(text);
|
||||
shuffled[0] = shuffled[0].toUpperCase();
|
||||
return msg.say(shuffled.join(''));
|
||||
const letters = text.split('');
|
||||
letters.push('x');
|
||||
const shuffled = shuffle(letters);
|
||||
return msg.say(firstUpperCase(shuffled.join('')));
|
||||
}
|
||||
};
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "91.1.6",
|
||||
"version": "91.1.7",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
+2
-2
@@ -48,8 +48,8 @@ module.exports = class Util {
|
||||
return arr;
|
||||
}
|
||||
|
||||
static firstUpperCase(text) {
|
||||
return `${text.charAt(0).toUpperCase()}${text.slice(1)}`;
|
||||
static firstUpperCase(text, split = ' ') {
|
||||
return text.split(split).map(word => `${word.charAt(0).toUpperCase()}${word.slice(1)}`).join(' ');
|
||||
}
|
||||
|
||||
static base64(text, mode = 'encode') {
|
||||
|
||||
Reference in New Issue
Block a user