everything is broken yay
Some checks failed
Builds / Discord-Node-Build (push) Has been cancelled
Builds / Discord-Ollama-Container-Build (push) Has been cancelled
Coverage / Discord-Node-Coverage (push) Has been cancelled

This commit is contained in:
2025-05-21 07:18:28 -04:00
parent ef8561e29b
commit de413f90e1
16 changed files with 489 additions and 459 deletions

View File

@@ -5,7 +5,6 @@ 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',
@@ -15,20 +14,23 @@ export const Capacity: SlashCommand = {
}
],
// 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
)
const capacity = interaction.options.get('context-capacity')?.value
if (typeof capacity !== 'number' || capacity <= 0) {
await interaction.reply({
content: 'Please provide a valid positive number for capacity.',
flags: MessageFlags.Ephemeral
})
return
}
interaction.reply({
content: `Max message history is now set to \`${interaction.options.get('context-capacity')?.value}\``,
await openConfig(`${interaction.user.id}-config.json`, 'modify-capacity', capacity)
await interaction.reply({
content: `Max message history is now set to \`${capacity}\`.`,
flags: MessageFlags.Ephemeral
})
}
}
}