mirror of
https://github.com/kevinthedang/discord-ollama.git
synced 2025-12-13 20:06:07 -05:00
* Update: ephemeral flag added in place of field * Update: remove unused import * Update: version increment --------- Co-authored-by: Kevin Dang <kevinthedang_1@outlook.com>
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import { Client, CommandInteraction, ApplicationCommandOptionType, MessageFlags } from 'discord.js'
|
|
import { openConfig, SlashCommand, UserCommand } from '../utils/index.js'
|
|
|
|
export const Capacity: SlashCommand = {
|
|
name: 'modify-capacity',
|
|
description: 'maximum amount messages bot will hold for context.',
|
|
|
|
// set available user options to pass to the command
|
|
options: [
|
|
{
|
|
name: 'context-capacity',
|
|
description: 'number of allowed messages to remember',
|
|
type: ApplicationCommandOptionType.Number,
|
|
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 || !UserCommand.includes(channel.type)) return
|
|
|
|
// set state of bot chat features
|
|
openConfig(`${interaction.user.username}-config.json`, interaction.commandName,
|
|
interaction.options.get('context-capacity')?.value
|
|
)
|
|
|
|
interaction.reply({
|
|
content: `Max message history is now set to \`${interaction.options.get('context-capacity')?.value}\``,
|
|
flags: MessageFlags.Ephemeral
|
|
})
|
|
}
|
|
} |