-
Notifications
You must be signed in to change notification settings - Fork 60
/
typings.d.ts
213 lines (198 loc) · 5.53 KB
/
typings.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
import {
ApplicationCommandOptionData,
Client,
CommandInteraction,
Guild,
GuildMember,
Interaction,
Message,
PermissionString,
TextChannel,
User,
} from 'discord.js'
import { EventEmitter } from 'events'
import WOKCommands from './src'
export default class WOKCommands extends EventEmitter {
private _client: Client
private _defaultPrefix: string
private _commandsDir: string
private _featuresDir: string
private _mongo: string | undefined
private _mongoConnection: Connection | null
private _displayName: string
private _prefixes: { [name: string]: string }
private _categories: Map<String, String | GuildEmoji>
private _hiddenCategories: string[]
private _color: string
private _commandHandler: CommandHandler
private _featureHandler: FeatureHandler | null
private _tagPeople: boolean
private _showWarns: boolean
private _delErrMsgCooldown: number
private _ignoreBots: boolean
private _botOwner: string[]
private _testServers: string[]
private _defaultLanguage: string
private _messageHandler: MessageHandler
private _slashCommand: SlashCommands
constructor(client: Client, options?: Options)
public get mongoPath(): string
public setMongoPath(mongoPath: string | undefined): WOKCommands
public get client(): Client
public get displayName(): string
public setDisplayName(displayName: string): WOKCommands
public get prefixes(): { [name: string]: string }
public get defaultPrefix(): string
public setDefaultPrefix(defaultPrefix: string): WOKCommands
public getPrefix(guild: Guild | null): string
public setPrefix(guild: Guild | null, prefix: string): WOKCommands
public get categories(): Map<String, String | GuildEmoji>
public get hiddenCategories(): string[]
public get color(): string
public setColor(color: string): WOKCommands
public getEmoji(category: string): string
public getCategory(emoji: string): string
public setCategorySettings(
category: string | Array<Record<string, any>>,
emoji?: string
): WOKCommands
public isEmojiUsed(emoji: string): boolean
public get commandHandler(): CommandHandler
public get mongoConnection(): Connection | null
public isDBConnected(): boolean
public setTagPeople(tagPeople: boolean): WOKCommands
public get tagPeople(): boolean
public get showWarns(): boolean
public get delErrMsgCooldown(): number
public get ignoreBots(): boolean
public get botOwner(): string[]
public setBotOwner(botOwner: string | string[]): WOKCommands
public get testServers(): string[]
public get defaultLanguage(): string
public setDefaultLanguage(defaultLanguage: string): WOKCommands
public get messageHandler(): MessageHandler
public get slashCommands(): SlashCommands
}
interface OptionsWithS {
commandDir?: never
featureDir?: never
commandsDir: string
featuresDir?: string
messagesPath?: string
mongoUri?: string
showWarns?: boolean
delErrMsgCooldown?: number
defaultLanguage?: string
ignoreBots?: boolean
dbOptions?: {}
testServers?: string | string[]
botOwners?: string | string[]
disabledDefaultCommands?: string | string[]
typeScript?: boolean
ephemeral?: boolean
debug?: boolean
}
interface OptionsWithoutS {
commandsDir?: never
featuresDir?: never
commandDir: string
featureDir?: string
messagesPath?: string
mongoUri?: string
showWarns?: boolean
delErrMsgCooldown?: number
defaultLanguage?: string
ignoreBots?: boolean
dbOptions?: {}
testServers?: string | string[]
botOwners?: string | string[]
disabledDefaultCommands?: string | string[]
typeScript?: boolean
ephemeral?: boolean
debug?: boolean
}
export type Options = OptionsWithS | OptionsWithoutS
export interface ICallbackObject {
channel: TextChannel
message: Message
args: string[]
text: string
client: Client
prefix: string
instance: WOKCommands
interaction: CommandInteraction
options: ApplicationCommandOptionData[]
user: User
member: GuildMember
guild: Guild | null
cancelCoolDown(): any
}
export interface IErrorObject {
error: CommandErrors
command: string
message: Message
info: object
}
export type optionTypes =
| 'SUB_COMMAND'
| 'SUB_COMMAND_GROUP'
| 'STRING'
| 'INTEGER'
| 'BOOLEAN'
| 'USER'
| 'CHANNEL'
| 'ROLE'
| 'MENTIONABLE'
| 'NUMBER'
export interface ICommand {
names?: string[] | string
aliases?: string[] | string
category: string
description: string
callback?(obj: ICallbackObject): any
error?(obj: IErrorObject): any
minArgs?: number
maxArgs?: number
syntaxError?: { [key: string]: string }
expectedArgs?: string
expectedArgsTypes?: optionTypes[]
syntax?: string
requiredPermissions?: PermissionString[]
permissions?: PermissionString[]
cooldown?: string
globalCooldown?: string
ownerOnly?: boolean
hidden?: boolean
guildOnly?: boolean
testOnly?: boolean
slash?: boolean | 'both'
options?: ApplicationCommandOptionData[]
requireRoles?: boolean
}
export interface ISlashCommand {
id: string
application_id: string
name: string
description: string
version: string
default_permission: boolean
}
export interface ICategorySetting {
name: string
emoji: string
hidden?: boolean
customEmoji?: boolean
}
export enum CommandErrors {
EXCEPTION = 'EXCEPTION',
COOLDOWN = 'COOLDOWN',
INVALID_ARGUMENTS = 'INVALID ARGUMENTS',
MISSING_PERMISSIONS = 'MISSING PERMISSIONS',
MISSING_ROLES = 'MISSING ROLES',
COMMAND_DISABLED = 'COMMAND DISABLED',
}
export enum Events {
DATABASE_CONNECTED = 'databaseConnected',
LANGUAGE_NOT_SUPPORTED = 'languageNotSupported',
COMMAND_EXCEPTION = 'commandException',
}