-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
38 lines (32 loc) · 1.04 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { MessageOriginChannel, MessageOriginChat, MessageOriginHiddenUser, MessageOriginUser } from "https://deno.land/x/grammy_types@v3.14.0/mod.ts";
// Define the User interface
export interface User {
id: number;
first_name: string;
last_name?: string;
username?: string;
// Add other User fields if necessary
}
// Define the Chat interface
export interface Chat {
id: number;
title: string;
type: string;
// Add other Chat fields if necessary
}
// Base MessageOrigin interface
export interface MessageOriginBase {
type: string; // Keep as string to allow unknown types
date: number;
}
// MessageOriginUnknown: For any other unknown types
export interface MessageOriginUnknown extends MessageOriginBase {
// No additional fields
}
// Union type for all possible MessageOrigin subtypes
export type AnyMessageOrigin =
| MessageOriginUser
| MessageOriginHiddenUser
| MessageOriginChat
| MessageOriginChannel
| MessageOriginUnknown; // Include the unknown type