This repository was archived by the owner on Jun 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
276 lines (275 loc) · 10.5 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
declare module '@yamashiro/akashi' {
import Immutable from '@augu/immutable';
import mongoose from 'mongoose';
import Pikmin from 'pikmin';
import Eris from 'eris';
export const version: string;
export class ArgumentParser {
constructor(raw: string[]);
public args: string[];
public gather(sep?: string): string;
public isEmpty(i: number): boolean;
public get(i: number): string;
public slice(arg: number, start?: number, end?: number): string;
}
export class Client extends Eris.Client {
constructor(options: DefaultOptions);
public manager: CommandManager;
public events: EventManager;
public database: DatabaseManager;
public rest: RESTClient;
public settings: GuildSettings;
public logger: Pikmin.instance;
public commandUsage: { [x: string]: CommandUsage };
public messagesSeen: number;
public webhook: WebhookClient;
public commandPrefix: string;
public util: Util;
public build(): Promise<void>;
public getEmbed(): EmbedBuilder;
public addCommandUsage(cmd: Command, user: Eris.User): void;
}
export class Command {
constructor(client: Client, info: CommandInfo);
public command: string;
public description: DescriptionSupplier;
public usage: string;
public category: string;
public aliases: string[];
public guildOnly: boolean;
public ownerOnly: boolean;
public hidden: boolean;
public disabled: CommandDisabled;
public subcommands: Subcommand[];
public run(ctx: CommandContext): Promise<void>;
public format(): string;
public help(): Eris.EmbedOptions;
}
export class CommandContext {
constructor(client: Client, m: Eris.Message, args: string[]);
public client: Client;
public message: Eris.Message;
public args: ArgumentParser;
public guild: Eris.Guild;
public sender: Eris.User;
public collector(): MessageCollector;
public send(content: string): Promise<Eris.Message>;
public embed(content: EmbedBuilder): Promise<Eris.Message>;
}
export class CommandManager {
constructor(client: Client, path: string);
public client: Client;
public commands: Immutable.Collection<Command>;
public path: string;
public service: CommandService;
public start(): Promise<void>;
}
export class CommandService {
constructor(client: Client);
public client: Client;
public run(m: Eris.Message): Promise<void>;
}
export class DatabaseManager {
constructor(url: string);
public url: string;
public m: typeof mongoose;
public connect(): Promise<void>;
}
export class EmbedBuilder {
constructor(data?: Embed);
public title: string;
public description: string;
public color: number;
public timestamp: number;
public url: string;
public author: EmbedAuthor;
public thumbnail: EmbedThumbnail;
public image: EmbedImage;
public footer: EmbedFooter;
public fields: EmbedField[];
public setColor(color: ColorResolvable): this;
public setTitle(title: string): this;
public setDescription(text: StringResolvable): this;
public setAuthor(name: string, url?: string, iconUrl?: string): this;
public setThumbnail(url: string): this;
public setURL(uri: string): this;
public setFooter(text: string, iconUrl?: string): this;
public setTimestamp(t?: Date | number): this;
public setImage(url: string): this;
public addField(name: string, value: string, inline?: boolean): this;
public build(): Eris.EmbedOptions;
}
export class Event {
constructor(client: Client, event: Emittable);
public client: Client;
public event: Emittable;
public emit(...args: any[]): Promise<void>;
}
export class EventManager {
constructor(client: Client, path: string);
public client: Client;
public path: string;
public start(): void;
public emit(event: Event): void;
}
export class GuildSettings implements Settings<GuildModel> {
constructor();
public model: mongoose.Model<GuildModel, {}>;
public get(id: string): Promise<GuildModel>;
public create(id: string): GuildModel;
public remove(id: string): void;
public update(id: string, doc: object, cb: (error: any, raw: any) => void): mongoose.Query<any>;
}
export class MessageCollector {
constructor(client: Client);
public collectors: Immutable.Collection<Collector>;
public awaitMessage(filter: IAwaitFilter, info: IAwaitInfo): Promise<Eris.Message>;
}
export class PaginationBuilder<T> {
constructor(fields?: T[], pageLength?: number);
public paginate(page: string): IPaginated<T>;
}
export class RESTClient {
constructor(client: Client);
public client: Client;
public getRole(query: string, guild: Eris.Guild): Promise<Eris.Role>;
public getUser(query: string): Promise<Eris.User>;
public getGuild(query: string): Promise<Eris.Guild>;
public getChannel(query: string, guild: Eris.Guild): Promise<AnyRESTChannel>;
}
export class Util {
public static rgbToInt(a: number, b: number, c: number): number;
public static formatNumber(num: number): string;
public static uppercase(str: string, spl: string = ' '): string;
public static elipisis(str: string, spl: number = 2000): string;
public static resolveString(str: StringResolvable): string;
public static resolveColor(color: ColorResolvable): number;
public static clone<T>(obj: any): T;
public static randomNumber(o: number, s: number): number;
public static parsePlatform(platform: NodeJS.Platform): 'Linux' | 'MacOS' | 'Windows' | 'Android' | 'Unknown';
public static formatBytes(bits: number): string;
}
export class WebhookClient {
constructor(url: string);
public url: string;
public send(payload: string | EmbedBuilder): Promise<void>;
}
export interface AkashiClientOptions {
token: string;
prefix: string;
commands: string;
events: string;
databaseUrl: string;
webhookUrl: string;
}
export type DefaultOptions = AkashiClientOptions & Eris.ClientOptions;
export interface CommandUsage {
size: number;
users: Eris.User[];
}
export interface CommandInfo {
command: string;
description: DescriptionSupplier;
usage?: string;
category?: string;
aliases?: string[];
guildOnly?: boolean;
ownerOnly?: boolean;
hidden?: boolean;
disabled?: CommandDisabled;
subcommands?: Subcommand[];
}
export type DescriptionSupplier = string | ((client: Client) => string);
export interface CommandDisabled {
is: boolean;
reason?: string;
}
export interface Subcommand {
name: string;
description: DescriptionSupplier;
run: (client: Client, ctx: CommandContext) => Promise<void>;
}
export interface Embed {
title?: string;
description?: string;
author?: EmbedAuthor;
thumbnail?: EmbedThumbnail;
fields?: EmbedField[];
image?: EmbedImage;
footer?: EmbedFooter;
timestamp?: number;
color?: number;
type?: 'rich';
url?: string;
}
export interface EmbedAuthor {
name: string;
url?: string;
iconUrl?: string;
}
export interface EmbedThumbnail {
url?: string;
}
export interface EmbedImage {
url?: string;
}
export interface EmbedField {
name: string;
value: string;
inline?: boolean;
}
export interface EmbedFooter {
text: string;
iconUrl?: string;
}
export type ColorResolvable = number | number[];
export type StringResolvable = string | string[];
export type Emittable = "ready" | "disconnect" | "callCreate" | "callRing" | "callDelete" | "callUpdate" |
"channelCreate" | "channelDelete" | "channelPinUpdate" | "channelRecipientAdd" | "channelRecepientRemove" |
"channelUpdate" | "friendSuggestionCreate" | "friendSuggestionDelete" | "guildAvaliable" | "guildBanAdd" |
"guildBanRemove" | "guildDelete" | "guildUnavaliable" | "guildCreate" | "guildEmojisUpdate" | "guildMemberAdd" |
"guildMemberChunk" | "guildMemberRemove" | "guildMemberUpdate" | "guildRoleCreate" | "guildRoleDelete" |
"guildRoleUpdate" | "guildUpdate" | "hello" | "messageCreate" | "messageDeleteBulk" | "messageReactionRemoveAll" |
"messageDeleteBulk" | "messageDelete" | "messageReactionAdd" | "messageReactionRemove" | "messageUpdate" |
"presenceUpdate" | "rawWS" | "unknown" | "relationshipAdd" | "relationshipRemove" | "relationshipUpdate" |
"typingStart" | "unavaliableGuildCreate" | "userUpdate" | "voiceChannelJoin" | "voiceChannelLeave" |
"voiceChannelSwitch" | "voiceStateUpdate" | "warn" | "debug" | "shardDisconnect" | "error" |
"shardPreReady" | "connect" | "shardReady" | "shardResume";
export interface Settings<T extends mongoose.Document> {
model: mongoose.Model<T, {}>;
get(id: string): Promise<T>;
create(id: string): T;
remove(id: string): void;
update(id: string, doc: object, cb: (error: any) => void): mongoose.Query<any>;
}
export interface GuildModel extends mongoose.Document {
guildID: string;
prefix: string;
autoroles: string[];
selfAssign: string[];
logging: {
enabled: boolean;
channelID: string | null;
}
modlog: {
enabled: boolean;
channelID: string | null;
}
}
export type IAwaitFilter = (m: Eris.Message) => boolean;
export interface Collector {
filter: IAwaitFilter;
accept: (value?: PromiseLike<Eris.Message> | Eris.Message) => void;
}
export interface IAwaitInfo {
channelID: string;
userID: string;
timeout: number;
}
export interface IPaginated<T> {
items: T[];
page: number;
max: number;
}
export type AnyRESTChannel = Eris.TextChannel | Eris.VoiceChannel | Eris.CategoryChannel;
}