Skip to content

Commit

Permalink
feat(client): remove events
Browse files Browse the repository at this point in the history
  • Loading branch information
piloking committed Jan 19, 2025
1 parent fa604c9 commit b4b873c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/linejs/client/features/chat/mod.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Client } from "../../mod.ts";
import type * as line from "@evex/linejs-types";
import { TalkMessage } from "../message/talk.ts";
import { createMessageFetcher, type MessageFetcher } from './fetcher.ts'
import { createMessageFetcher, type MessageFetcher } from "./fetcher.ts";

interface ChatInit {
client: Client;
Expand Down Expand Up @@ -123,7 +123,7 @@ export class Chat {
* @param limit The number of messages to fetch. Defaults to 10.
* @returns A promise that resolves to an array of TalkMessage instances.
*/
async fetchMessages(limit: number = 10) {
async fetchMessages(limit: number = 10): Promise<TalkMessage[]> {
const boxes = await this.#client.base.talk.getMessageBoxes({
messageBoxListRequest: {},
});
Expand All @@ -144,12 +144,14 @@ export class Chat {
});

return await Promise.all(
messages.map((message) => TalkMessage.fromRawTalk(message, this.#client)),
messages.map((message) =>
TalkMessage.fromRawTalk(message, this.#client)
),
);
}

messageFetcher(): Promise<MessageFetcher> {
return createMessageFetcher(this.#client, this)
return createMessageFetcher(this.#client, this);
}

/**
Expand All @@ -158,7 +160,7 @@ export class Chat {
* @param client client
* @returns Chat
*/
static fromRaw(raw: line.Chat, client: Client) {
static fromRaw(raw: line.Chat, client: Client): Chat {
return new Chat({
client,

Expand Down

0 comments on commit b4b873c

Please sign in to comment.