Hopefully temporary (probably not) fix

master
Tymon 1 year ago
parent 1aeb95dc16
commit 5bb927af05

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

Loading…
Cancel
Save