jillo-bot/built/commands/change.js

90 lines
3.5 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const builders_1 = require("@discordjs/builders");
const discord_js_1 = require("discord.js");
const rand = [
'This change has no significance.',
'You do not know what this can do.',
'Nothing has changed.',
'Nothing of value has been changed.',
'You\'ll want to find something of value to change next time.'
];
const names = [
'Fire\'s Pit',
'Flaming Pit',
'Pit of Fire',
'Pit Fire',
'Pire Fit',
'White Space',
'The void',
'Fire pit',
'fire pit'
];
const channels = [
'toyota',
'ъ',
'deadlocked',
'stereo-madness',
'basketball',
'send-help'
];
const nicknames = [
'напиток безалкогольный сильногаз',
'forg',
'foggy',
'frog',
'fog'
];
module.exports = {
data: new builders_1.SlashCommandBuilder()
.setName('change')
.setDescription('Change')
.addStringOption((option) => option.setName('what').setDescription('Change what? Examples include: "environment", "perspective", etc...').setRequired(true)),
execute: async (interaction, member) => {
let what = interaction.options.getString('what');
let title = `**${member.displayName}** changed the **${what}**`;
let response;
switch (what.toLowerCase()) {
case 'environment':
case 'surroundings':
const name = names[Math.floor(Math.random() * names.length)];
response = `You feel as if you're in a new space entirely. You find yourself in **${name}**.`;
await interaction.guild.setName(name, 'environment change');
break;
case 'perspective':
case 'vision':
const channel = channels[Math.floor(Math.random() * channels.length)];
response = `You've decided you want to change your perspective on the place you find yourself in. You are now in **#${channel}**.`;
await interaction.channel.setName(channel);
break;
case 'persona':
case 'self':
title = 'I\'m afraid I can\'t do that.';
response = `You're locked in as is, **${member.user.username}**. Noone but you can change this.`;
break;
case 'identity':
response = `I've changed my nickname in accordance. I hope this identity pleases you.`;
await interaction.guild.me.setNickname(nicknames[Math.floor(Math.random() * nicknames.length)]);
break;
case 'location':
case 'position':
response = `You do not feel like your surroundings have changed, but rather where you are relative to your surroundings has changed.`;
const categories = Array(...interaction.guild.channels.cache.filter(v => v.type === 'GUILD_CATEGORY').values());
const category = categories[Math.floor(Math.random() * categories.length)];
await interaction.channel.setParent(category);
await interaction.channel.setPosition(Math.floor(Math.random() * category.children.size));
break;
default:
response = rand[Math.floor(Math.random() * rand.length)];
}
const embed = new discord_js_1.MessageEmbed()
.setTitle(title)
.setDescription(response)
.setTimestamp();
await interaction.reply({
embeds: [embed],
ephemeral: false,
});
}
};