reformatted to use my template
This commit is contained in:
38
src/rolemanager/commands.ts
Normal file
38
src/rolemanager/commands.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
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
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user