fix: actually save characterId
This commit is contained in:
parent
a261bbdb9b
commit
fe91bfc813
1 changed files with 13 additions and 10 deletions
|
|
@ -7,6 +7,7 @@ import {
|
|||
} from "npm:discord.js";
|
||||
import { Command } from "../../types.ts";
|
||||
import cai from "../../cai.ts";
|
||||
import { memory } from "../../memory.ts";
|
||||
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
|
|
@ -21,20 +22,18 @@ export default {
|
|||
),
|
||||
async execute(interaction: ChatInputCommandInteraction<CacheType>) {
|
||||
await interaction.deferReply();
|
||||
const characterId = interaction.options.getString("character");
|
||||
const characterId = interaction.options.getString("character")!;
|
||||
const { character } = await cai.character.info(characterId);
|
||||
console.log(`https://characterai.io/i/200/static/avatars/uploaded/${character.avatar_file_name}`)
|
||||
console.log(
|
||||
`https://characterai.io/i/200/static/avatars/uploaded/${character.avatar_file_name}`
|
||||
);
|
||||
const embed = new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: "Selected Character",
|
||||
})
|
||||
.setTitle(character.name)
|
||||
.setURL(
|
||||
`https://character.ai/chat/${character.external_id}`
|
||||
)
|
||||
.setDescription(
|
||||
character.description
|
||||
)
|
||||
.setURL(`https://character.ai/chat/${character.external_id}`)
|
||||
.setDescription(character.description)
|
||||
.addFields(
|
||||
{
|
||||
name: "Title",
|
||||
|
|
@ -52,9 +51,13 @@ export default {
|
|||
)
|
||||
.setColor("#00b0f4")
|
||||
.setFooter({
|
||||
text: `Created and last updated ${Temporal.PlainDateTime.from(character.updated).toLocaleString()} by ${character.participant__user__username} `,
|
||||
text: `Created and last updated ${Temporal.PlainDateTime.from(
|
||||
character.updated
|
||||
).toLocaleString()} by ${character.participant__user__username} `,
|
||||
});
|
||||
|
||||
memory.characterId = characterId;
|
||||
|
||||
await interaction.editReply({ embeds: [embed] });
|
||||
},
|
||||
} as Command;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue