Deprecated ephemeral field (#158)

* Update: ephemeral flag added in place of field

* Update: remove unused import

* Update: version increment

---------

Co-authored-by: Kevin Dang <kevinthedang_1@outlook.com>
This commit is contained in:
Jonathan Smoley
2025-02-02 15:10:58 -08:00
committed by GitHub
parent 5b542aca1a
commit 456f70b9e1
12 changed files with 26 additions and 27 deletions

View File

@@ -7,7 +7,7 @@ services:
build: ./ # find docker file in designated path build: ./ # find docker file in designated path
container_name: discord container_name: discord
restart: always # rebuild container always restart: always # rebuild container always
image: kevinthedang/discord-ollama:0.8.2 image: kevinthedang/discord-ollama:0.8.3
environment: environment:
CLIENT_TOKEN: ${CLIENT_TOKEN} CLIENT_TOKEN: ${CLIENT_TOKEN}
OLLAMA_IP: ${OLLAMA_IP} OLLAMA_IP: ${OLLAMA_IP}
@@ -28,7 +28,6 @@ services:
networks: networks:
ollama-net: ollama-net:
ipv4_address: ${OLLAMA_IP} ipv4_address: ${OLLAMA_IP}
runtime: nvidia # use Nvidia Container Toolkit for GPU support runtime: nvidia # use Nvidia Container Toolkit for GPU support
devices: devices:
- /dev/nvidia0 - /dev/nvidia0

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "discord-ollama", "name": "discord-ollama",
"version": "0.8.2", "version": "0.8.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "discord-ollama", "name": "discord-ollama",
"version": "0.8.2", "version": "0.8.3",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"discord.js": "^14.17.3", "discord.js": "^14.17.3",

View File

@@ -1,6 +1,6 @@
{ {
"name": "discord-ollama", "name": "discord-ollama",
"version": "0.8.2", "version": "0.8.3",
"description": "Ollama Integration into discord", "description": "Ollama Integration into discord",
"main": "build/index.js", "main": "build/index.js",
"exports": "./build/index.js", "exports": "./build/index.js",

View File

@@ -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' import { openConfig, SlashCommand, UserCommand } from '../utils/index.js'
export const Capacity: SlashCommand = { export const Capacity: SlashCommand = {
@@ -28,7 +28,7 @@ export const Capacity: SlashCommand = {
interaction.reply({ interaction.reply({
content: `Max message history is now set to \`${interaction.options.get('context-capacity')?.value}\``, content: `Max message history is now set to \`${interaction.options.get('context-capacity')?.value}\``,
ephemeral: true flags: MessageFlags.Ephemeral
}) })
} }
} }

View File

@@ -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' import { clearChannelInfo, SlashCommand, UserCommand } from '../utils/index.js'
export const ClearUserChannelHistory: SlashCommand = { export const ClearUserChannelHistory: SlashCommand = {
@@ -24,12 +24,12 @@ export const ClearUserChannelHistory: SlashCommand = {
if (successfulWipe) if (successfulWipe)
interaction.reply({ interaction.reply({
content: `History cleared in **this channel** cleared for **${interaction.user.username}**.`, content: `History cleared in **this channel** cleared for **${interaction.user.username}**.`,
ephemeral: true flags: MessageFlags.Ephemeral
}) })
else else
interaction.reply({ 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.`, 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
}) })
} }
} }

View File

@@ -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 { UserCommand, SlashCommand } from '../utils/index.js'
import { ollama } from '../client.js' import { ollama } from '../client.js'
import { ModelResponse } from 'ollama' import { ModelResponse } from 'ollama'
@@ -31,7 +31,7 @@ export const DeleteModel: SlashCommand = {
if (!interaction.memberPermissions?.has('Administrator')) { if (!interaction.memberPermissions?.has('Administrator')) {
interaction.reply({ interaction.reply({
content: `${interaction.commandName} is an admin command.\n\nPlease contact a server admin to pull the model you want.`, 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 return
} }
@@ -53,7 +53,7 @@ export const DeleteModel: SlashCommand = {
// could not delete the model // could not delete the model
interaction.reply({ 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.`, 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
}) })
} }
} }

View File

@@ -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' import { AdminCommand, openConfig, SlashCommand } from '../utils/index.js'
export const Disable: SlashCommand = { export const Disable: SlashCommand = {
@@ -25,7 +25,7 @@ export const Disable: SlashCommand = {
if (!interaction.memberPermissions?.has('Administrator')) { if (!interaction.memberPermissions?.has('Administrator')) {
interaction.reply({ interaction.reply({
content: `${interaction.commandName} is an admin command.\n\nPlease contact an admin to use this command for you.`, content: `${interaction.commandName} is an admin command.\n\nPlease contact an admin to use this command for you.`,
ephemeral: true flags: MessageFlags.Ephemeral
}) })
return return
} }
@@ -37,7 +37,7 @@ export const Disable: SlashCommand = {
interaction.reply({ interaction.reply({
content: `${client.user?.username} is now **${interaction.options.get('enabled')?.value ? "enabled" : "disabled"}**.`, content: `${client.user?.username} is now **${interaction.options.get('enabled')?.value ? "enabled" : "disabled"}**.`,
ephemeral: true flags: MessageFlags.Ephemeral
}) })
} }
} }

View File

@@ -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' import { openConfig, SlashCommand, UserCommand } from '../utils/index.js'
export const MessageStream: SlashCommand = { export const MessageStream: SlashCommand = {
@@ -28,7 +28,7 @@ export const MessageStream: SlashCommand = {
interaction.reply({ interaction.reply({
content: `Message streaming is now set to: \`${interaction.options.get('stream')?.value}\``, content: `Message streaming is now set to: \`${interaction.options.get('stream')?.value}\``,
ephemeral: true flags: MessageFlags.Ephemeral
}) })
} }
} }

View File

@@ -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 { ollama } from "../client.js"
import { ModelResponse } from "ollama" import { ModelResponse } from "ollama"
import { UserCommand, SlashCommand } from "../utils/index.js" import { UserCommand, SlashCommand } from "../utils/index.js"
@@ -31,7 +31,7 @@ export const PullModel: SlashCommand = {
if (!interaction.memberPermissions?.has('Administrator')) { if (!interaction.memberPermissions?.has('Administrator')) {
interaction.reply({ interaction.reply({
content: `${interaction.commandName} is an admin command.\n\nPlease contact a server admin to pull the model you want.`, 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 return
} }

View File

@@ -1,4 +1,4 @@
import { Client, CommandInteraction } from 'discord.js' import { Client, CommandInteraction, MessageFlags } from 'discord.js'
import { AdminCommand, SlashCommand } from '../utils/index.js' import { AdminCommand, SlashCommand } from '../utils/index.js'
export const Shutoff: SlashCommand = { export const Shutoff: SlashCommand = {
@@ -18,7 +18,7 @@ export const Shutoff: SlashCommand = {
if (!interaction.memberPermissions?.has('Administrator')) { if (!interaction.memberPermissions?.has('Administrator')) {
interaction.reply({ interaction.reply({
content: `**Shutdown Aborted:**\n\n${interaction.user.tag}, You do not have permission to shutoff **${client.user?.tag}**.`, 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 return // stop from shutting down
} }
@@ -26,7 +26,7 @@ export const Shutoff: SlashCommand = {
// Shutoff cleared, do it // Shutoff cleared, do it
interaction.reply({ interaction.reply({
content: `${client.user?.tag} is shutting down.`, content: `${client.user?.tag} is shutting down.`,
ephemeral: true flags: MessageFlags.Ephemeral
}) })
console.log(`[Command: shutoff] ${client.user?.tag} is shutting down.`) console.log(`[Command: shutoff] ${client.user?.tag} is shutting down.`)

View File

@@ -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' import { AdminCommand, openChannelInfo, SlashCommand } from '../utils/index.js'
export const ThreadCreate: SlashCommand = { export const ThreadCreate: SlashCommand = {
@@ -26,7 +26,7 @@ export const ThreadCreate: SlashCommand = {
// user only reply // user only reply
return interaction.reply({ return interaction.reply({
content: `I can help you in <#${thread.id}> below.`, content: `I can help you in <#${thread.id}> below.`,
ephemeral: true flags: MessageFlags.Ephemeral
}) })
} }
} }

View File

@@ -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' import { AdminCommand, openChannelInfo, SlashCommand } from '../utils/index.js'
export const PrivateThreadCreate: SlashCommand = { export const PrivateThreadCreate: SlashCommand = {
@@ -27,7 +27,7 @@ export const PrivateThreadCreate: SlashCommand = {
// user only reply // user only reply
return interaction.reply({ return interaction.reply({
content: `I can help you in <#${thread.id}>.`, content: `I can help you in <#${thread.id}>.`,
ephemeral: true flags: MessageFlags.Ephemeral
}) })
} }
} }