mirror of
https://github.com/kevinthedang/discord-ollama.git
synced 2025-12-12 11:56:06 -05:00
* Add: Some Commands work in GuildText * Add: Channel Toggle Command * Add: Channel History handler by user * Update: version increment * Update: Testing scope * Update: env sample * Update: Readme goal checks * Update: builds run on PR to validate them
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
import { ChannelType, Client, CommandInteraction, ApplicationCommandOptionType } from 'discord.js'
|
|
import { SlashCommand } from '../utils/commands.js'
|
|
import { openConfig } from '../utils/jsonHandler.js'
|
|
|
|
export const MessageStyle: SlashCommand = {
|
|
name: 'message-style',
|
|
description: 'sets the message style to embed or normal',
|
|
|
|
// set available user options to pass to the command
|
|
options: [
|
|
{
|
|
name: 'embed',
|
|
description: 'toggle embedded or normal message',
|
|
type: ApplicationCommandOptionType.Boolean,
|
|
required: true
|
|
}
|
|
],
|
|
|
|
// Query for message information and set the style
|
|
run: async (client: Client, interaction: CommandInteraction) => {
|
|
// fetch channel and message
|
|
const channel = await client.channels.fetch(interaction.channelId)
|
|
if (!channel || channel.type !== (ChannelType.PublicThread && ChannelType.GuildText)) return
|
|
|
|
// set the message style
|
|
openConfig('config.json', interaction.commandName, interaction.options.get('embed')?.value)
|
|
|
|
interaction.reply({
|
|
content: `Message style preferences for embed set to: \`${interaction.options.get('embed')?.value}\``,
|
|
ephemeral: true
|
|
})
|
|
}
|
|
} |