Initial commit
This commit is contained in:
commit
2f5e10140c
133 changed files with 10429 additions and 0 deletions
3
packages/chat/src/behaviour/community.ts
Normal file
3
packages/chat/src/behaviour/community.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export function getMessages() {
|
||||
return 0;
|
||||
}
|
||||
22
packages/chat/src/behaviour/conversation.ts
Normal file
22
packages/chat/src/behaviour/conversation.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { useSocket } from "@tensamin/ttp/context";
|
||||
import type { RawMessages } from "../values";
|
||||
|
||||
export async function getMessages(
|
||||
amount: number,
|
||||
offset: number,
|
||||
user_id: number,
|
||||
): Promise<RawMessages> {
|
||||
const { send } = useSocket();
|
||||
|
||||
const messages = await send("messages_get", {
|
||||
amount: amount,
|
||||
offset: offset,
|
||||
user_id: user_id,
|
||||
});
|
||||
|
||||
if (messages.type.startsWith("error")) {
|
||||
throw new Error(messages.type);
|
||||
}
|
||||
|
||||
return messages.data.messages;
|
||||
}
|
||||
Loading…
Reference in a new issue