-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
171 lines (150 loc) · 4.08 KB
/
index.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/** Declaration file generated by dts-gen */
export = webcord;
interface Options {
url: string,
name?: string,
avatar?: string,
tts?: boolean,
mentions?: boolean
}
interface Footer {
text: string,
icon?: string
}
interface Author {
name: string,
icon?: string,
url?: string
}
declare class webcord {
/**
* @param {object} options - Webcord options
* ```js
* import webcord from "webcord"
* new webcord({
* url: "https://discordapp.com/api/webhooks/817645388345186120/7FT_nELazMwK3iY7X8yXdjIsmdoS07rXIONszaT2qnv3lJgRIkqGGLfCnzihej",
* name: "Webcord",
* avatar: "https://upload.wikimedia.org/wikipedia/commons/6/6a/JavaScript-logo.png"
* })
* ```
* @param {string} options.url - Discord webhook link
* @param {?string} [options.name] - Webhook display name
* @param {?string} [options.avatar] - Webhook avatar image
* @param {boolean} [options.tts] - Should webhook use tts
* @param {boolean} [options.mentions] - Can the webhook mention users/bots
*/
constructor(options: Options);
/**
* @description Increments to the next embed.
* @returns {Webcord} this
*/
inc(): this;
/**
* @description Decrement to the previous embed.
* @returns {Webcord} this
*/
dec(): this;
/**
* @description Adds a field to the embed (max 25).
* @param {string} name The name of this field
* @param {string} value The value of this field
* @param {boolean} [inline=false] If this field will be displayed inline
* @returns {Webcord} this
*/
addField(name: string, value: string, inline?: boolean): this;
/**
* @description Adds one or more fields to the embed (max 25).
* @param {...object} fields Field object
* ```js
* .addFields({
* name: "Title",
* value: "Some text",
* inline: true
* },
* {
* name: "Another title",
* value: "Some more text",
* inline: false
* })
* ```
* @returns {Webcord} this
*/
addFields(...fields: object): this;
/**
* @description Sets a title on the embed.
* @param {string} title The title of the embed
* @returns {Webcord} this
*/
setTitle(title: string): this;
/**
* @description Sets a description on the embed.
* @param {string} description The description of the embed
* @returns {Webcord} this
*/
setDescription(description: string): this;
/**
* @description Sets a url on the embed.
* @param {string} url The url of the embed
* @returns {Webcord} this
*/
setURL(url: string): this;
/**
* @description Sets a timestamp on the embed.
* @returns {Webcord} this
*/
setTimestamp(): this;
/**
* @description Sets a color of the embed.
* @param {string|number} [hex] Hex color
* @returns {Webcord} this
*/
setColor(hex: string | number): this;
/**
* @description Sets the footer of the embed.
* @param {object} options - Footer options
* ```js
* .setFooter({
* text: "I'm a footer!",
* icon: "https://somesite.com/image.png"
* })
* ```
* @param {string} options.text - Footer value
* @param {?string} [options.icon] - Footer icon
* @returns {Webcord} this
*/
setFooter(options: Footer): this;
/**
* @description Sets the image of the embed.
* @param {string} url - Image url
* @returns {Webcord} this
*/
setImage(url: string): this;
/**
* @description Sets the thumbnail of the embed.
* @param {string} url - Thumbnail url
* @returns {Webcord} this
*/
setThumbnail(url: string): this;
/**
* @description Sets the author of the embed.
* @param {object} options - Author options
* ```js
* .setAuthor({
* name: "Webcord devs",
* icon: "https://somesite.com/icon.png",
* url: "https://discord.com/"
* })
* ```
* @param {string} options.name - Author value
* @param {?string} [options.icon] - Author icon
* @param {?string} [options.url] - Author url
* @returns {Webcord} this
*/
setAuthor(options: Author): this;
/**
* @description Sends webhook.
* @param {string} [msg] Optional basic message
* @returns {Promise.<Object>} POST request response data
*/
send(msg?: string): Promise<object>;
}