forked from TheCurle/Camelot
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtrickTypes.d.ts
145 lines (114 loc) · 3.02 KB
/
trickTypes.d.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
export interface Snowflake {
id: string;
getCreationDate(): Date;
}
export interface Mentionable extends Snowflake {
asMention(): string;
}
export interface User extends Mentionable {
name: string;
avatarUrl: string;
/**
* @deprecated Discord is replacing discriminators with unique usernames
*/
discriminator: string;
/**
* @deprecated Discord is replacing discriminators with unique usernames
*/
asTag(): string;
}
export interface Member extends Mentionable {
user: User;
avatarUrl: string | null;
effectiveAvatarUrl: string;
nickname: string | null;
effectiveName: string;
color: number;
getJoinTime(): Date;
getPermissions(): string[]; // TODO - replace with an enum
getRoles(): Role[];
}
export interface Role extends Mentionable {
name: string;
color: number;
getGuild(): Guild;
}
export interface Emoji extends Mentionable {
name: string;
}
export interface Guild extends Snowflake {
name: string;
memberCount: number;
iconUrl: string;
getRoles(): Role[];
getEmojis(): Emoji[];
getCounter(counter: string): number | null;
}
export enum ChannelType {
TEXT
}
export interface Channel extends Mentionable {
name: string;
type: ChannelType;
}
export interface JDA {
getUserById(id: string): User | null;
getEmojis(): Emoji[];
}
export declare namespace Options {
export enum Type {
string, member, user, int, boolean
}
export type OptionConfig = {
description: string;
name?: string | null;
required?: boolean | null;
hidden?: boolean | null;
type: Type | any;
default?: any | null;
}
export interface Builder extends Array<any> {
optNamed(name: ListOrOne<string>, config: OptionConfig): Builder;
optPositional(index: number, config: OptionConfig): Builder;
parse(): any[];
}
}
export const user: User;
export const member: Member;
export const guild: Guild;
export const channel: Channel;
export const options: Options.Builder;
export function reply(text: string);
export function replyEmbed(embed: ListOrOne<Embeds.Embed>);
export type ListOrOne<T> = T | T[];
export function catchUndefined<T>(f: () => T): T | null;
/**
* If a trick is privileged, this property gives it access to less 'safe' operations.
*/
export const privileged: Privileged | null;
export interface Privileged {
httpGetJson(url: string): string
}
declare namespace Embeds {
export type Title = {
value?: string | null;
url?: string | null;
}
export type Footer = {
value?: string | null,
iconUrl?: string | null
}
export type Field = {
name: string;
value: string;
inline: boolean | null;
}
export type Embed = {
title?: string | Title | null;
description?: string | null;
image?: string | null;
fields?: ListOrOne<Field> | null;
color?: number | null;
footer?: string | Footer | null
}
}