anya/interfaces/platform-adapter.ts

29 lines
806 B
TypeScript
Raw Permalink Normal View History

2024-10-06 13:56:33 +05:30
import { UserConfig } from "../config";
import { Message, User } from "./message";
export interface FetchOptions {
limit?: number;
before?: string;
after?: string;
}
export interface PlatformAdapter {
onMessage(callback: (message: Message) => void): void;
sendMessage(channelId: string, content: string): Promise<void>;
fetchMessages(channelId: string, options: FetchOptions): Promise<Message[]>;
fetchMessageById(
channelId: string,
messageId: string
): Promise<Message | null>;
getBotId(): string; // For identifying bot's own messages
getUserById(userId: string): UserConfig | null;
sendSystemLog?(content: string): Promise<void>;
searchUser(query: string): Promise<User[]>;
config: {
indicators: {
typing: boolean;
processing: boolean;
};
};
}