Hopefully temporary (probably not) fix

master
Tymon 1 year ago
parent 1aeb95dc16
commit 5bb927af05

@ -45,7 +45,7 @@ export default class Chat {
#client: Client; #client: Client;
public characterId: string; public characterId: string;
public characterInternalId: string; public characterInternalId?: string;
public historyId: string; public historyId: string;
constructor(client: Client, id: string, history: any) { constructor(client: Client, id: string, history: any) {
@ -53,9 +53,9 @@ export default class Chat {
this.characterId = id; this.characterId = id;
this.historyId = history.external_id; this.historyId = history.external_id;
this.characterInternalId = history.participants.find( // this.characterInternalId = history.participants.find(
(participant: any) => participant.is_human === false // (participant: any) => participant.is_human === false
).user.username; // ).user.username;
} }
/** /**
@ -84,6 +84,11 @@ export default class Chat {
* @returns Object with replies * @returns Object with replies
*/ */
public async sendMessage(message: string): Promise<Reply> { public async sendMessage(message: string): Promise<Reply> {
if (!this.characterInternalId)
this.characterInternalId = (
await this.#client.fetchCharacterInfo(this.characterId)
).participant__user__username;
const payload = { const payload = {
history_external_id: this.historyId, history_external_id: this.historyId,
character_external_id: this.characterId, character_external_id: this.characterId,

Loading…
Cancel
Save