mirror of
https://github.com/kevinthedang/discord-ollama.git
synced 2025-12-13 03:56:07 -05:00
Pull/Switch Model Commands Fix (#137)
* Update: Channel checker and channel name gone * Add: note of where problem can be * Update: Check if model already exists for Pull Command * Add: User/Admin Command Constants * Update: version increment
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ChannelType, Client, CommandInteraction, TextChannel } from 'discord.js'
|
||||
import { clearChannelInfo, SlashCommand } from '../utils/index.js'
|
||||
import { Channel, Client, CommandInteraction, TextChannel } from 'discord.js'
|
||||
import { clearChannelInfo, SlashCommand, UserCommand } from '../utils/index.js'
|
||||
|
||||
export const ClearUserChannelHistory: SlashCommand = {
|
||||
name: 'clear-user-channel-history',
|
||||
@@ -8,10 +8,10 @@ export const ClearUserChannelHistory: SlashCommand = {
|
||||
// Clear channel history for intended user
|
||||
run: async (client: Client, interaction: CommandInteraction) => {
|
||||
// fetch current channel
|
||||
const channel = await client.channels.fetch(interaction.channelId)
|
||||
const channel: Channel | null = await client.channels.fetch(interaction.channelId)
|
||||
|
||||
// if not an existing channel or a GuildText, fail command
|
||||
if (!channel || channel.type !== ChannelType.GuildText) return
|
||||
if (!channel || !UserCommand.includes(channel.type)) return
|
||||
|
||||
// clear channel info for user
|
||||
const successfulWipe = await clearChannelInfo(interaction.channelId,
|
||||
@@ -21,12 +21,12 @@ export const ClearUserChannelHistory: SlashCommand = {
|
||||
// check result of clearing history
|
||||
if (successfulWipe)
|
||||
interaction.reply({
|
||||
content: `Channel history in **${channel.name}** cleared for **${interaction.user.username}**.`,
|
||||
content: `Channel history in **this channel** successfully cleared for **${interaction.user.username}**.`,
|
||||
ephemeral: true
|
||||
})
|
||||
else
|
||||
interaction.reply({
|
||||
content: `Channel history could not be found for **${interaction.user.username}** in **${channel.name}**.\n\nPlease chat with **${client.user?.username}** to start a chat history.`,
|
||||
content: `Channel history could not be found for **${interaction.user.username}** in **this channel**.\n\nPlease chat with **${client.user?.username}** to start a chat history.`,
|
||||
ephemeral: true
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user