Skip to content

Commit

Permalink
Deprecated ephemeral field (#158)
Browse files Browse the repository at this point in the history
* Update: ephemeral flag added in place of field

* Update: remove unused import

* Update: version increment

---------

Co-authored-by: Kevin Dang <kevinthedang_1@outlook.com>
  • Loading branch information
JT2M0L3Y and kevinthedang authored Feb 2, 2025
1 parent 5b542ac commit 456f70b
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 27 deletions.
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -28,7 +28,6 @@ services:
networks:
ollama-net:
ipv4_address: ${OLLAMA_IP}

runtime: nvidia # use Nvidia Container Toolkit for GPU support
devices:
- /dev/nvidia0
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/commands/capacity.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down Expand Up @@ -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
})
}
}
6 changes: 3 additions & 3 deletions src/commands/cleanUserChannelHistory.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -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
})
}
}
6 changes: 3 additions & 3 deletions src/commands/deleteModel.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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
}
Expand All @@ -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
})
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/disable.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -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
}
Expand All @@ -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
})
}
}
4 changes: 2 additions & 2 deletions src/commands/messageStream.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down Expand Up @@ -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
})
}
}
4 changes: 2 additions & 2 deletions src/commands/pullModel.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/shutoff.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -18,15 +18,15 @@ 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
}

// 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.`)
Expand Down
4 changes: 2 additions & 2 deletions src/commands/threadCreate.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down Expand Up @@ -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
})
}
}
4 changes: 2 additions & 2 deletions src/commands/threadPrivateCreate.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down Expand Up @@ -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
})
}
}

0 comments on commit 456f70b

Please sign in to comment.