Skip to content

Commit

Permalink
Remove Message Style Command (#149)
Browse files Browse the repository at this point in the history
* Remove: Message Style Command

* Update: version increment
  • Loading branch information
kevinthedang authored Dec 14, 2024
1 parent 6ac45af commit fe1f7ce
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 179 deletions.
2 changes: 1 addition & 1 deletion 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.7.4
image: kevinthedang/discord-ollama:0.7.5
environment:
CLIENT_TOKEN: ${CLIENT_TOKEN}
OLLAMA_IP: ${OLLAMA_IP}
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.7.4",
"version": "0.7.5",
"description": "Ollama Integration into discord",
"main": "build/index.js",
"exports": "./build/index.js",
Expand Down
2 changes: 0 additions & 2 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { SlashCommand } from '../utils/commands.js'
import { ThreadCreate } from './threadCreate.js'
import { MessageStyle } from './messageStyle.js'
import { MessageStream } from './messageStream.js'
import { Disable } from './disable.js'
import { Shutoff } from './shutoff.js'
Expand All @@ -13,7 +12,6 @@ import { SwitchModel } from './switchModel.js'
export default [
ThreadCreate,
PrivateThreadCreate,
MessageStyle,
MessageStream,
Disable,
Shutoff,
Expand Down
32 changes: 0 additions & 32 deletions src/commands/messageStyle.ts

This file was deleted.

12 changes: 3 additions & 9 deletions src/events/messageCreate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TextChannel } from 'discord.js'
import { embedMessage, event, Events, normalMessage, UserMessage, clean } from '../utils/index.js'
import { event, Events, normalMessage, UserMessage, clean } from '../utils/index.js'
import { getChannelInfo, getServerConfig, getUserConfig, openChannelInfo, openConfig, UserConfig, getAttachmentData } from '../utils/index.js'

/**
Expand Down Expand Up @@ -134,9 +134,6 @@ export default event(Events.MessageCreate, async ({ log, msgHist, ollama, client
})
}

// response string for ollama to put its response
let response: string

if (!userConfig)
throw new Error(`Failed to initialize User Preference for **${message.author.username}**.\n\nIt's likely you do not have a model set. Please use the \`switch-model\` command to do that.`)

Expand All @@ -157,11 +154,8 @@ export default event(Events.MessageCreate, async ({ log, msgHist, ollama, client
images: messageAttachment || []
})

// undefined or false, use normal, otherwise use embed
if (userConfig.options['message-style'])
response = await embedMessage(message, ollama, model, msgHist, shouldStream)
else
response = await normalMessage(message, ollama, model, msgHist, shouldStream)
// response string for ollama to put its response
const response: string = await normalMessage(message, ollama, model, msgHist, shouldStream)

// If something bad happened, remove user query and stop
if (response == undefined) { msgHist.pop(); return }
Expand Down
1 change: 0 additions & 1 deletion src/utils/configInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { UserMessage } from './index.js'

export interface UserConfiguration {
'message-stream'?: boolean,
'message-style'?: boolean,
'modify-capacity': number,
'switch-model': string
}
Expand Down
1 change: 0 additions & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Centralized import index
export * from './env.js'
export * from './events.js'
export * from './messageEmbed.js'
export * from './messageNormal.js'
export * from './commands.js'
export * from './configInterfaces.js'
Expand Down
129 changes: 0 additions & 129 deletions src/utils/messageEmbed.ts

This file was deleted.

2 changes: 1 addition & 1 deletion tests/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('Commands Existence', () => {
// test specific commands in the object
it('references specific commands', () => {
const commandsString = commands.map(e => e.name).join(', ')
expect(commandsString).toBe('thread, private-thread, message-style, message-stream, toggle-chat, shutoff, modify-capacity, clear-user-channel-history, pull-model, switch-model')
expect(commandsString).toBe('thread, private-thread, message-stream, toggle-chat, shutoff, modify-capacity, clear-user-channel-history, pull-model, switch-model')
})
})

Expand Down

0 comments on commit fe1f7ce

Please sign in to comment.