111 lines
3.5 KiB
TypeScript
111 lines
3.5 KiB
TypeScript
import { CategoryChannel, GuildMember, EmbedBuilder, TextChannel, Interaction, ChannelType, SlashCommandBuilder } from 'discord.js';
|
|
import { knownServers } from '../lib/knownServers';
|
|
|
|
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 = [
|
|
'напиток безалкогольный сильногаз',
|
|
'the gelatin',
|
|
'goo',
|
|
'jillo',
|
|
'goobert'
|
|
];
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName('change')
|
|
.setDescription('Change')
|
|
.addStringOption((option) =>
|
|
option
|
|
.setName('what')
|
|
.setDescription('Change what? Examples include: "environment", "perspective", etc...')
|
|
.setRequired(true)
|
|
),
|
|
|
|
serverWhitelist: [...knownServers.firepit, ...knownServers.fbi],
|
|
|
|
execute: async (interaction: Interaction, member: GuildMember) => {
|
|
if (!interaction.isChatInputCommand()) return;
|
|
|
|
const what = interaction.options.getString('what', true);
|
|
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 as TextChannel).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!.members.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 === ChannelType.GuildCategory).values());
|
|
const category = categories[Math.floor(Math.random() * categories.length)] as CategoryChannel;
|
|
await (interaction.channel as TextChannel).setParent(category);
|
|
await (interaction.channel as TextChannel).setPosition(Math.floor(Math.random() * category.children.cache.size));
|
|
break;
|
|
}
|
|
case '04':
|
|
response = 'Correct. `16`';
|
|
break;
|
|
default:
|
|
response = rand[Math.floor(Math.random() * rand.length)];
|
|
}
|
|
|
|
const embed = new EmbedBuilder()
|
|
.setTitle(title)
|
|
.setDescription(response)
|
|
.setTimestamp();
|
|
|
|
await interaction.reply({
|
|
embeds: [embed],
|
|
ephemeral: false,
|
|
});
|
|
}
|
|
}; |