mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-27 14:18:36 +02:00
Add random hat option
This commit is contained in:
@@ -131,7 +131,7 @@ module.exports = class HatCommand extends Command {
|
|||||||
{
|
{
|
||||||
key: 'type',
|
key: 'type',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
oneOf: hats,
|
oneOf: ['random', ...hats],
|
||||||
parse: type => type.toLowerCase()
|
parse: type => type.toLowerCase()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -144,6 +144,7 @@ module.exports = class HatCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, { type, user }) {
|
async run(msg, { type, user }) {
|
||||||
|
if (type === 'random') type = hats[Math.floor(Math.random() * hats.length)];
|
||||||
const avatarURL = user.displayAvatarURL({ extension: 'png', size: 512 });
|
const avatarURL = user.displayAvatarURL({ extension: 'png', size: 512 });
|
||||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'hat', `${type}.png`));
|
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'hat', `${type}.png`));
|
||||||
const { body } = await request.get(avatarURL);
|
const { body } = await request.get(avatarURL);
|
||||||
|
|||||||
Reference in New Issue
Block a user