From 456f70b9e16b2a6dd5ad05884fc16f95344fba27 Mon Sep 17 00:00:00 2001 From: Jonathan Smoley Date: Sun, 2 Feb 2025 15:10:58 -0800 Subject: [PATCH] Deprecated ephemeral field (#158) * Update: ephemeral flag added in place of field * Update: remove unused import * Update: version increment --------- Co-authored-by: Kevin Dang --- docker-compose.yml | 3 +-- package-lock.json | 4 ++-- package.json | 2 +- src/commands/capacity.ts | 4 ++-- src/commands/cleanUserChannelHistory.ts | 6 +++--- src/commands/deleteModel.ts | 6 +++--- src/commands/disable.ts | 6 +++--- src/commands/messageStream.ts | 4 ++-- src/commands/pullModel.ts | 4 ++-- src/commands/shutoff.ts | 6 +++--- src/commands/threadCreate.ts | 4 ++-- src/commands/threadPrivateCreate.ts | 4 ++-- 12 files changed, 26 insertions(+), 27 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 12d72ce..62fbb78 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: build: ./ # find docker file in designated path container_name: discord restart: always # rebuild container always - image: kevinthedang/discord-ollama:0.8.2 + image: kevinthedang/discord-ollama:0.8.3 environment: CLIENT_TOKEN: ${CLIENT_TOKEN} OLLAMA_IP: ${OLLAMA_IP} @@ -28,7 +28,6 @@ services: networks: ollama-net: ipv4_address: ${OLLAMA_IP} - runtime: nvidia # use Nvidia Container Toolkit for GPU support devices: - /dev/nvidia0 diff --git a/package-lock.json b/package-lock.json index 4d34415..1adf97d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "discord-ollama", - "version": "0.8.2", + "version": "0.8.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "discord-ollama", - "version": "0.8.2", + "version": "0.8.3", "license": "ISC", "dependencies": { "discord.js": "^14.17.3", diff --git a/package.json b/package.json index 4180577..d81cb74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discord-ollama", - "version": "0.8.2", + "version": "0.8.3", "description": "Ollama Integration into discord", "main": "build/index.js", "exports": "./build/index.js", diff --git a/src/commands/capacity.ts b/src/commands/capacity.ts index a0e219f..20a2391 100644 --- a/src/commands/capacity.ts +++ b/src/commands/capacity.ts @@ -1,4 +1,4 @@ -import { Client, CommandInteraction, ApplicationCommandOptionType } from 'discord.js' +import { Client, CommandInteraction, ApplicationCommandOptionType, MessageFlags } from 'discord.js' import { openConfig, SlashCommand, UserCommand } from '../utils/index.js' export const Capacity: SlashCommand = { @@ -28,7 +28,7 @@ export const Capacity: SlashCommand = { interaction.reply({ content: `Max message history is now set to \`${interaction.options.get('context-capacity')?.value}\``, - ephemeral: true + flags: MessageFlags.Ephemeral }) } } \ No newline at end of file diff --git a/src/commands/cleanUserChannelHistory.ts b/src/commands/cleanUserChannelHistory.ts index 59c1b62..0eb2c84 100644 --- a/src/commands/cleanUserChannelHistory.ts +++ b/src/commands/cleanUserChannelHistory.ts @@ -1,4 +1,4 @@ -import { Channel, Client, CommandInteraction, TextChannel } from 'discord.js' +import { Channel, Client, CommandInteraction, MessageFlags, TextChannel } from 'discord.js' import { clearChannelInfo, SlashCommand, UserCommand } from '../utils/index.js' export const ClearUserChannelHistory: SlashCommand = { @@ -24,12 +24,12 @@ export const ClearUserChannelHistory: SlashCommand = { if (successfulWipe) interaction.reply({ content: `History cleared in **this channel** cleared for **${interaction.user.username}**.`, - ephemeral: true + flags: MessageFlags.Ephemeral }) else interaction.reply({ content: `History was not be found for **${interaction.user.username}** in **this channel**.\n\nPlease chat with **${client.user?.username}** to start a chat history.`, - ephemeral: true + flags: MessageFlags.Ephemeral }) } } \ No newline at end of file diff --git a/src/commands/deleteModel.ts b/src/commands/deleteModel.ts index 7315989..e07193e 100644 --- a/src/commands/deleteModel.ts +++ b/src/commands/deleteModel.ts @@ -1,4 +1,4 @@ -import { ApplicationCommandOptionType, Client, CommandInteraction } from 'discord.js' +import { ApplicationCommandOptionType, Client, CommandInteraction, MessageFlags } from 'discord.js' import { UserCommand, SlashCommand } from '../utils/index.js' import { ollama } from '../client.js' import { ModelResponse } from 'ollama' @@ -31,7 +31,7 @@ export const DeleteModel: SlashCommand = { if (!interaction.memberPermissions?.has('Administrator')) { interaction.reply({ content: `${interaction.commandName} is an admin command.\n\nPlease contact a server admin to pull the model you want.`, - ephemeral: true + flags: MessageFlags.Ephemeral }) return } @@ -53,7 +53,7 @@ export const DeleteModel: SlashCommand = { // could not delete the model interaction.reply({ content: `Could not delete the **${modelInput}** model. It probably doesn't exist or you spelled it incorrectly.\n\nPlease try again if this is a mistake.`, - ephemeral: true + flags: MessageFlags.Ephemeral }) } } diff --git a/src/commands/disable.ts b/src/commands/disable.ts index 499de71..6a5cb57 100644 --- a/src/commands/disable.ts +++ b/src/commands/disable.ts @@ -1,4 +1,4 @@ -import { Client, CommandInteraction, ApplicationCommandOptionType } from 'discord.js' +import { Client, CommandInteraction, ApplicationCommandOptionType, MessageFlags } from 'discord.js' import { AdminCommand, openConfig, SlashCommand } from '../utils/index.js' export const Disable: SlashCommand = { @@ -25,7 +25,7 @@ export const Disable: SlashCommand = { if (!interaction.memberPermissions?.has('Administrator')) { interaction.reply({ content: `${interaction.commandName} is an admin command.\n\nPlease contact an admin to use this command for you.`, - ephemeral: true + flags: MessageFlags.Ephemeral }) return } @@ -37,7 +37,7 @@ export const Disable: SlashCommand = { interaction.reply({ content: `${client.user?.username} is now **${interaction.options.get('enabled')?.value ? "enabled" : "disabled"}**.`, - ephemeral: true + flags: MessageFlags.Ephemeral }) } } \ No newline at end of file diff --git a/src/commands/messageStream.ts b/src/commands/messageStream.ts index b8fee6d..b66fc8f 100644 --- a/src/commands/messageStream.ts +++ b/src/commands/messageStream.ts @@ -1,4 +1,4 @@ -import { ApplicationCommandOptionType, Client, CommandInteraction } from 'discord.js' +import { ApplicationCommandOptionType, Client, CommandInteraction, MessageFlags } from 'discord.js' import { openConfig, SlashCommand, UserCommand } from '../utils/index.js' export const MessageStream: SlashCommand = { @@ -28,7 +28,7 @@ export const MessageStream: SlashCommand = { interaction.reply({ content: `Message streaming is now set to: \`${interaction.options.get('stream')?.value}\``, - ephemeral: true + flags: MessageFlags.Ephemeral }) } } \ No newline at end of file diff --git a/src/commands/pullModel.ts b/src/commands/pullModel.ts index 61bd2dc..7fba93d 100644 --- a/src/commands/pullModel.ts +++ b/src/commands/pullModel.ts @@ -1,4 +1,4 @@ -import { ApplicationCommandOptionType, Client, CommandInteraction } from "discord.js" +import { ApplicationCommandOptionType, Client, CommandInteraction, MessageFlags } from "discord.js" import { ollama } from "../client.js" import { ModelResponse } from "ollama" import { UserCommand, SlashCommand } from "../utils/index.js" @@ -31,7 +31,7 @@ export const PullModel: SlashCommand = { if (!interaction.memberPermissions?.has('Administrator')) { interaction.reply({ content: `${interaction.commandName} is an admin command.\n\nPlease contact a server admin to pull the model you want.`, - ephemeral: true + flags: MessageFlags.Ephemeral }) return } diff --git a/src/commands/shutoff.ts b/src/commands/shutoff.ts index de84aee..ade2a9d 100644 --- a/src/commands/shutoff.ts +++ b/src/commands/shutoff.ts @@ -1,4 +1,4 @@ -import { Client, CommandInteraction } from 'discord.js' +import { Client, CommandInteraction, MessageFlags } from 'discord.js' import { AdminCommand, SlashCommand } from '../utils/index.js' export const Shutoff: SlashCommand = { @@ -18,7 +18,7 @@ export const Shutoff: SlashCommand = { if (!interaction.memberPermissions?.has('Administrator')) { interaction.reply({ content: `**Shutdown Aborted:**\n\n${interaction.user.tag}, You do not have permission to shutoff **${client.user?.tag}**.`, - ephemeral: true + flags: MessageFlags.Ephemeral }) return // stop from shutting down } @@ -26,7 +26,7 @@ export const Shutoff: SlashCommand = { // Shutoff cleared, do it interaction.reply({ content: `${client.user?.tag} is shutting down.`, - ephemeral: true + flags: MessageFlags.Ephemeral }) console.log(`[Command: shutoff] ${client.user?.tag} is shutting down.`) diff --git a/src/commands/threadCreate.ts b/src/commands/threadCreate.ts index 4f917e2..1b9153b 100644 --- a/src/commands/threadCreate.ts +++ b/src/commands/threadCreate.ts @@ -1,4 +1,4 @@ -import { ChannelType, Client, CommandInteraction, TextChannel, ThreadChannel } from 'discord.js' +import { ChannelType, Client, CommandInteraction, MessageFlags, TextChannel, ThreadChannel } from 'discord.js' import { AdminCommand, openChannelInfo, SlashCommand } from '../utils/index.js' export const ThreadCreate: SlashCommand = { @@ -26,7 +26,7 @@ export const ThreadCreate: SlashCommand = { // user only reply return interaction.reply({ content: `I can help you in <#${thread.id}> below.`, - ephemeral: true + flags: MessageFlags.Ephemeral }) } } \ No newline at end of file diff --git a/src/commands/threadPrivateCreate.ts b/src/commands/threadPrivateCreate.ts index 536a71a..578f2eb 100644 --- a/src/commands/threadPrivateCreate.ts +++ b/src/commands/threadPrivateCreate.ts @@ -1,4 +1,4 @@ -import { ChannelType, Client, CommandInteraction, TextChannel, ThreadChannel } from 'discord.js' +import { ChannelType, Client, CommandInteraction, MessageFlags, TextChannel, ThreadChannel } from 'discord.js' import { AdminCommand, openChannelInfo, SlashCommand } from '../utils/index.js' export const PrivateThreadCreate: SlashCommand = { @@ -27,7 +27,7 @@ export const PrivateThreadCreate: SlashCommand = { // user only reply return interaction.reply({ content: `I can help you in <#${thread.id}>.`, - ephemeral: true + flags: MessageFlags.Ephemeral }) } } \ No newline at end of file