-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypings.d.ts
191 lines (170 loc) · 4.21 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
import {
ApplicationCommandOption,
Client,
CommandInteraction,
Guild,
Message,
GuildMember,
TextChannel,
User,
} from "discord.js";
import CommandType from "./src/util/CommandType";
import Cooldowns from "./src/util/Cooldowns";
import DefaultCommands from "./src/util/DefaultCommands";
export default class SWAG {
private _client!: Client;
private _defaultPrefix: string;
private _testServers!: string[];
private _botOwners!: string[];
private _cooldowns: Cooldowns | undefined;
private _disabledDefaultCommands!: DefaultCommands[];
private _validations!: Validations;
private _commandHandler: CommandHandler | undefined;
private _subcommandHandler: SubcommandHandler | undefined;
private _eventHandler!: EventHandler;
private _isConnectedToDB = false;
constructor(options: Options);
public get client(): Client;
public get defaultPrefix(): string;
public get testServers(): string[];
public get botOwners(): string[];
public get cooldowns(): Cooldowns;
public get disabledDefaultCommands(): DefaultCommands[];
public get validations(): Validations;
public get commandHandler(): CommandHandler;
public get subcommandHandler(): SubcommandHandler;
public get eventHandler(): EventHandler;
public get isConnectedToDB(): boolean;
}
export interface Options {
client: Client;
mongoUri?: string;
commandsDir?: string;
subcommandsDir?: string;
featuresDir?: string;
defaultPrefix?: string;
testServers?: string[];
botOwners?: string[];
cooldownConfig?: CooldownConfig;
disabledDefaultCommands?: DefaultCommands[];
events?: Events;
validations?: Validations;
}
export interface CooldownConfig {
errorMessage: string;
botOwnersBypass: boolean;
dbRequired: number;
}
export interface Events {
dir: string;
[key: string]: any;
}
export interface Validations {
runtime?: string;
syntax?: string;
}
export class Cooldowns {
constructor(instance: SWAG, oldownConfig: CooldownConfig) {}
}
export enum CooldownTypes {
perUser = "perUser",
perUserPerGuild = "perUserPerGuild",
perGuild = "perGuild",
global = "global",
}
export interface CooldownUsage {
errorMessage?: string;
type: CooldownTypes;
duration: string;
}
export interface InternalCooldownConfig {
cooldownType: CooldownTypes;
userId: string;
actionId: string;
guildId?: string;
duration?: string;
errorMessage?: string;
}
export interface CommandUsage {
client: Client;
instance: SWAG;
message?: Message | null;
interaction?: CommandInteraction | null;
args: string[];
text: string;
guild?: Guild | null;
member?: GuildMember;
user: User;
channel?: TextChannel;
cancelCooldown?: function;
updateCooldown?: function;
}
export interface SubCommandUsage {
client: Client;
instance: SWAG;
interaction?: CommandInteraction;
args: string[];
text: string;
guild?: Guild | null;
member?: GuildMember;
user: User;
channel?: TextChannel;
cancelCooldown?: function;
updateCooldown?: function;
}
export interface CommandObject {
callback: (commandUsage: CommandUsage) => unknown;
type: CommandType;
init?: function;
description?: string;
aliases?: string[];
testOnly?: boolean;
guildOnly?: boolean;
ownerOnly?: boolean;
permissions?: bigint[];
deferReply?: "ephemeral" | boolean;
cooldowns?: CooldownUsage;
minArgs?: number;
maxArgs?: number;
correctSyntax?: string;
expectedArgs?: string;
options?: ApplicationCommandOption[];
autocomplete?: function;
reply?: boolean;
delete?: boolean;
}
export type FileData = {
filePath: string;
fileContents: any;
};
export class Command {
constructor(
instance: SWAG,
commandName: string,
commandObject: CommandObject
);
public get instance(): SWAG;
public get commandName(): string;
public get commandObject(): CommandObject;
}
export interface SubcommandObject {
description: string;
testOnly?: boolean;
guildOnly?: boolean;
ownerOnly?: boolean;
delete?: boolean;
}
export interface SubcommandOptionObject {
callback: (commandUsage: SubCommandUsage) => unknown;
init?: function;
name: string;
description?: string;
ownerOnly?: boolean;
permissions?: bigint[];
cooldowns?: CooldownUsage;
deferReply?: "ephemeral" | boolean;
options?: ApplicationCommandOption[];
autocomplete?: function;
reply?: boolean;
}
export { CommandObject, Command, CommandType, CooldownTypes, DefaultCommands };