Files
IKEA-Canada-Support/src/rolemanager/commands.ts

38 lines
1.4 KiB
TypeScript

import { CommandInteraction, TextChannel } from "discord.js";
import { InteractionRoles } from "./data";
import { sendRoles } from "../util/interactions";
export function RolesCommand(interaction: CommandInteraction) {
let category = interaction.options.getInteger('category', true);
sendRoles(interaction, InteractionRoles[category].id, true);
}
export async function RolesAllCommand(interaction: CommandInteraction) {
if (interaction.user.id === '167336999844315137') {
let givenChannel = interaction.options.getChannel('channel'),
channel: TextChannel = await interaction.client.channels.fetch(interaction.channelId) as TextChannel;
if (givenChannel && givenChannel.type === 'GUILD_TEXT')
channel = givenChannel as TextChannel;
if (channel) {
let category = interaction.options.getInteger('category');
sendRoles(channel, category ? InteractionRoles[category].id : undefined);
interaction.reply({
content: `sending message in <#${channel.id}>`,
ephemeral: true
})
} else
interaction.reply({
content: 'error finding channel to send message in',
ephemeral: true
})
} else
interaction.reply({
content: 'missing permissions',
ephemeral: true
})
}