Roll NPM Dependencies Forward (#136)
* update channel as sendable * Update: Casting SendableChannels Once * Remove: another semicolon * Update: version increment --------- Co-authored-by: kevinthedang <kevinthedang_1@outlook.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { EmbedBuilder, Message } from 'discord.js'
|
||||
import { EmbedBuilder, Message, SendableChannels } from 'discord.js'
|
||||
import { ChatResponse, Ollama } from 'ollama'
|
||||
import { ChatParams, UserMessage, streamResponse, blockResponse } from './index.js'
|
||||
import { Queue } from '../queues/queue.js'
|
||||
@@ -28,7 +28,8 @@ export async function embedMessage(
|
||||
.setColor('#00FF00')
|
||||
|
||||
// send the message
|
||||
const sentMessage = await message.channel.send({ embeds: [botMessage] })
|
||||
const channel = message.channel as SendableChannels
|
||||
const sentMessage = await channel.send({ embeds: [botMessage] })
|
||||
|
||||
// create params
|
||||
const params: ChatParams = {
|
||||
@@ -48,12 +49,12 @@ export async function embedMessage(
|
||||
// exceeds handled length
|
||||
if (result.length > 5000) {
|
||||
const errorEmbed = new EmbedBuilder()
|
||||
.setTitle(`Responding to ${message.author.tag}`)
|
||||
.setDescription(`Response length ${result.length} has exceeded Discord maximum.\n\nLong Stream messages not supported.`)
|
||||
.setColor('#00FF00')
|
||||
.setTitle(`Responding to ${message.author.tag}`)
|
||||
.setDescription(`Response length ${result.length} has exceeded Discord maximum.\n\nLong Stream messages not supported.`)
|
||||
.setColor('#00FF00')
|
||||
|
||||
// send error
|
||||
message.channel.send({ embeds: [errorEmbed] })
|
||||
channel.send({ embeds: [errorEmbed] })
|
||||
break // cancel loop and stop
|
||||
}
|
||||
|
||||
@@ -90,7 +91,7 @@ export async function embedMessage(
|
||||
.setDescription(result.slice(0, 5000) || 'No Content to Provide...')
|
||||
.setColor('#00FF00')
|
||||
|
||||
message.channel.send({ embeds: [whileEmbed] })
|
||||
channel.send({ embeds: [whileEmbed] })
|
||||
result = result.slice(5000)
|
||||
}
|
||||
|
||||
@@ -100,7 +101,7 @@ export async function embedMessage(
|
||||
.setColor('#00FF00')
|
||||
|
||||
// rest of the response
|
||||
message.channel.send({ embeds: [lastEmbed] })
|
||||
channel.send({ embeds: [lastEmbed] })
|
||||
} else {
|
||||
// only need to create 1 embed, handles 6000 characters
|
||||
const newEmbed = new EmbedBuilder()
|
||||
|
||||
Reference in New Issue
Block a user