* added message style command * docker setup scripts * reformat messageStyle.ts * fix: register unregister on deploy * add: messageStream preference * add: json config handler * update: messageCreate gets config * update: shifted chat to config callback * fix: naming conventions based on discord * update: setup in docs now * add: static docker ips * version increment * add: bot message for no config * fix: no config case * add: clarification for subnetting * update: version increment in lock file --------- Co-authored-by: JT2M0L3Y <jtsmoley@icloud.com>
33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import { ApplicationCommandOptionType, ChannelType, Client, CommandInteraction } from 'discord.js'
|
|
import { SlashCommand } from '../utils/commands.js'
|
|
import { openFile } from '../utils/jsonHandler.js'
|
|
|
|
export const MessageStream: SlashCommand = {
|
|
name: 'message-stream',
|
|
description: 'change preference on message streaming from ollama. WARNING: can be very slow.',
|
|
|
|
// user option(s) for setting stream
|
|
options: [
|
|
{
|
|
name: 'stream',
|
|
description: 'enable or disable stream preference',
|
|
type: ApplicationCommandOptionType.Boolean,
|
|
required: true
|
|
}
|
|
],
|
|
|
|
// change preferences based on command
|
|
run: async (client: Client, interaction: CommandInteraction) => {
|
|
// verify channel
|
|
const channel = await client.channels.fetch(interaction.channelId)
|
|
if (!channel || channel.type !== ChannelType.GuildText) return
|
|
|
|
// save value to json and write to it
|
|
openFile('config.json', interaction.commandName, interaction.options.get('stream')?.value)
|
|
|
|
interaction.reply({
|
|
content: `Message streaming preferences for embed set to: \`${interaction.options.get('stream')?.value}\``,
|
|
ephemeral: true
|
|
})
|
|
}
|
|
} |