8058
Ir
irvc / files
irvc / web / src / lib / types.ts
1.3 KB
1export interface User { 2 id: number; 3 username: string; 4 createdAt: number; 5} 6 7export interface UserSummary { 8 id: number; 9 username: string; 10} 11 12export interface Channel { 13 id: number; 14 type: "text" | "voice" | "dm"; 15 name: string; 16 position: number; 17 permanent: boolean; 18 unread?: number; 19} 20 21export type Reaction = "+1" | "-1" | "heart" | "laugh"; 22 23export interface Preview { 24 url: string; 25 kind: "card" | "image" | "other" | "none"; 26 title?: string; 27 description?: string; 28 image?: string; 29 site?: string; 30} 31 32export interface Message { 33 id: number; 34 channelId: number; 35 userId: number; 36 username: string; 37 body: string; 38 createdAt: number; 39 editedAt?: number; 40 reactions?: Partial<Record<Reaction, string[]>>; 41 preview?: Preview; 42} 43 44export interface Gif { 45 url: string; 46 preview: string; 47} 48 49// One user sitting in a voice channel, as broadcast with presence. 50export interface VoiceOccupant { 51 name: string; 52 muted: boolean; 53 deafened: boolean; 54} 55 56export interface WSEvent { 57 type: 58 | "message" 59 | "message_edit" 60 | "message_delete" 61 | "presence" 62 | "pong" 63 | "channel" 64 | "channel_delete" 65 | "ring" 66 | "ring_end" 67 | "typing"; 68 message?: Message; 69 users?: string[]; 70 roster?: UserSummary[]; 71 voice?: Record<string, VoiceOccupant[]>; 72 channel?: Channel; 73 channelId?: number; 74 username?: string; 75}