Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typings/ci: Split typings #59

Merged
merged 85 commits into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
baa2ede
Enum documentation fixes
bsian03 Feb 20, 2020
520b2e3
Lint types folder (soon)
bsian03 Feb 20, 2020
5cc782f
Split typings
bsian03 Feb 20, 2020
123ead3
Codefactor
bsian03 Feb 20, 2020
5a04e45
k
bsian03 Feb 20, 2020
45734e0
Removed unnecessary overload. Try and link #58 to PR?
bsian03 Feb 20, 2020
b5c3c61
Should fix CI
bsian03 Feb 20, 2020
f02de74
Merge remote-tracking branch 'upstream/dev' into dev-docs
bsian03 Feb 20, 2020
c118363
Reflect correction in 27d7d9c
bsian03 Feb 20, 2020
e23bb6a
Added library typings
bsian03 Feb 20, 2020
fc4b0b5
Add rest of typings
bsian03 Feb 20, 2020
7808745
Typo
bsian03 Feb 21, 2020
0752af2
Finished rest of library typings, bug fixes etc
bsian03 Feb 22, 2020
51376c5
Export file, bug fixes, typos etc
bsian03 Feb 22, 2020
6908332
Typings change
bsian03 Feb 23, 2020
31860df
Naming typos
bsian03 Feb 23, 2020
310e16a
Attempt 2
bsian03 Feb 23, 2020
a10d7fb
Merge remote-tracking branch 'upstream/dev' into dev-docs
bsian03 Feb 23, 2020
5facafd
b85c399, 22610d8 and df13457 reflections
bsian03 Feb 23, 2020
eab2b40
b854f61 reflections
bsian03 Feb 23, 2020
8038c1c
b8f415f reflections
bsian03 Feb 23, 2020
51e9575
9139554 reflections
bsian03 Feb 23, 2020
4ae49bd
7631742 reflections
bsian03 Feb 23, 2020
116173e
b0563ac reflections
bsian03 Feb 23, 2020
84c3671
95c586c reflections and bug fixes from previous commit
bsian03 Feb 23, 2020
5a1382a
6296f7c reflections
bsian03 Feb 23, 2020
ffabc99
21b3014 reflections
bsian03 Feb 23, 2020
9d4c466
21b3014 reflections
bsian03 Feb 23, 2020
91d6ce4
38d7b34 reflections
bsian03 Feb 23, 2020
9b54aef
Added WinstonLogger
bsian03 Feb 23, 2020
d5bfe1a
Lint
bsian03 Feb 23, 2020
8f16a05
Don't emit file outputs on tsc check
bsian03 Feb 23, 2020
cee5874
Add updateDBVal type
bsian03 Feb 23, 2020
0d9f0b0
Changed name
bsian03 Feb 25, 2020
9f70e21
Add path references
bsian03 Feb 28, 2020
9c2cb5a
fix
bsian03 Feb 28, 2020
518ae2d
Fix the damn CI
bsian03 Feb 28, 2020
96f0818
Merge remote-tracking branch 'upstream/dev' into dev-docs
bsian03 Feb 28, 2020
a145810
Correct path
bsian03 Feb 28, 2020
48d7304
37a4838 and previous reflections
bsian03 Feb 28, 2020
451e5ee
Merge branch 'dev-docs' of https://github.com/bsian03/AxonCore; branc…
bsian03 Mar 8, 2020
b845800
f0978c2 reflections
bsian03 Mar 8, 2020
e69bf1c
#64 reflections
bsian03 Mar 8, 2020
5a8026c
Clear warnings from e69bf1c
bsian03 Mar 8, 2020
7766b45
3ff2100 reflections
bsian03 Mar 8, 2020
ce73608
e5bcc33 reflections
bsian03 Mar 8, 2020
680d180
Confirmed typo
bsian03 Mar 8, 2020
f2bc248
Merge branch 'dev' of https://github.com/Khaazz/AxonCore into dev-docs
bsian03 Mar 9, 2020
e0c3514
#65 reflections
bsian03 Mar 9, 2020
1111af4
Rename
bsian03 Mar 9, 2020
5da7cca
#67 reflections
bsian03 Mar 9, 2020
238da55
Remove unused imports
bsian03 Mar 10, 2020
07e82af
Added Library selector postinstall script, needs testing
bsian03 Mar 11, 2020
5c7efea
Merge branch 'dev' of https://github.com/Khaazz/AxonCore into dev-docs
bsian03 Mar 11, 2020
a38c36a
Remove language check/selection
bsian03 Mar 12, 2020
f9e8879
Remove variable in global
bsian03 Mar 13, 2020
7898b04
Constant
bsian03 Mar 13, 2020
de6ad19
Move to scripts folder
bsian03 Mar 13, 2020
1c93097
Exit process if CI detected
bsian03 Mar 14, 2020
cdc4dbc
Add CI env vars
bsian03 Mar 14, 2020
3fd41e0
#69 reflections
bsian03 Mar 14, 2020
5557d68
Added name to dep install and test
bsian03 Mar 15, 2020
5c72c97
Consistency
bsian03 Mar 15, 2020
e8e3ab3
#72 reflections
bsian03 Mar 15, 2020
a84f179
Merge branch 'dev' of https://github.com/Khaazz/AxonCore into dev-docs
bsian03 Mar 15, 2020
becec9a
Add first and sweep methods
bsian03 Mar 15, 2020
ac1a7b2
Merge branch 'dev' of https://github.com/Khaazz/AxonCore into dev-docs
bsian03 Mar 15, 2020
5e87a34
Test something
bsian03 Mar 15, 2020
35b4459
Fix pathing
bsian03 Mar 15, 2020
09de973
Trying something...
bsian03 Mar 15, 2020
50408e7
module declaration?
bsian03 Mar 15, 2020
a190bcb
Fix typings
bsian03 Mar 18, 2020
6956780
Return `this` where appropriate
bsian03 Mar 19, 2020
2e703cb
Save json only if invalid config
bsian03 Mar 19, 2020
5fcaee1
Merge branch 'dev' of https://github.com/Khaazz/AxonCore into dev-docs
bsian03 Mar 19, 2020
9708c9f
Bump events to 13.9.2
bsian03 Mar 19, 2020
e18572c
Merge branch 'dev' of https://github.com/Khaazz/AxonCore into dev-docs
bsian03 Mar 19, 2020
2c418b5
#70 reflections
bsian03 Mar 19, 2020
a9d7114
Merge branch 'dev' of https://github.com/Khaazz/AxonCore into dev-docs
bsian03 Mar 19, 2020
27777b8
merge conflict
bsian03 Mar 19, 2020
c636ab3
#66 reflections
bsian03 Mar 19, 2020
3f49b56
0af8a88 reflections
bsian03 Mar 19, 2020
ee4bdca
Merge branch 'dev' of https://github.com/Khaazz/AxonCore into dev-docs
bsian03 Mar 19, 2020
3f55651
#73 reflections
bsian03 Mar 19, 2020
eae9643
061de33 reflections
bsian03 Mar 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"scripts": {
"lint": "yarn run lint:js && yarn run lint:ts",
"lint:js": "eslint src examples *.js",
"lint:ts": "eslint index.d.ts",
"lint:ts": "eslint index.d.ts types/**/*.ts",
"tsc": "tsc index.d.ts",
"test": "yarn run lint && yarn run tsc",
"test:push": "eslint src examples *.js",
Expand Down
244 changes: 244 additions & 0 deletions types/AxonClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@

export declare class AxonClient extends EventEmitter {
/** Configs (webhooks, template, custom) */
private _configs: AxonConfs;
/** Bot settings */
public settings: AxonParams;
/** General infos about the current application */
public infos: Infos;
public axoncore: AxonInfos;
/** The Logger instance */
public logger: ALogger;
/** Util methods (AxonCore) */
public axonUtils: AxonUtils;

/** Discord library Client */
private _botClient: LibClient;
public library: LibraryInterface;
/** Utils methods (general) */
public utils: Utils;
/** The DBProvider instance */
public DBProvider: ADBProvider

/** Registry holding all modules */
public moduleRegistry: ModuleRegistry;
/** Registry holding all commands */
public commandRegistry: CommandRegistry;
/** Registry holding all listeners */
public listenerRegistry: ListenerRegistry;
/** The EventManager instance that handle all AxonCore listeners */
public eventManager: EventManager;

/** The Manager that handles GuildConfigs (cache / DB etc) */
public guildConfigs: GuildConfigCache;
/** The AxonConfig object that handles globally blacklisted users and guilds */
public axonConfig?: AxonConfig;

/** Load, unload modules. */
public moduleLoader: ModuleLoader;
/** Dispatch commands onMessageCreate. */
public dispatcher: CommandDispatcher;
/** Message manager object accessible with `<AxonClient>.l` */
private _messageManager: MessageManager;

/** Bot Staff (owners, admins, +...) */
public staff: AxonStaffIDs;

/**
* Creates an AxonClient instance.
*
* @param botClient - Eris or Discordjs Client instance
* @param axonOptions - Axon options
* @param modules - Object with all modules to add in the bot
* @memberof AxonClient
*/
constructor(botClient: LibClient, AxonOptions: AxonOptions, modules: object);

/**
* Returns the bot client instance
*
* @readonly
* @memberof AxonClient
*/
readonly botClient: LibClient;
/**
* Returns all event handlers in eventManager
*
* @readonly
* @memberof AxonClient
*/
readonly handlers: Collection<AHandler>;
/**
* Returns all registered listeners for the discord event name
*
* @memberof AxonClient
*/
getListeners(eventName: string): Listener[];
/**
* Returns all the resolver for the default current library used.
* Can be easily overridden with a custom Resolver by overriding this getter.
*
* @readonly
* @memberof AxonClient
*/
readonly Resolver: Resolver;
/**
* Return the webhooks config
*
* @readonly
* @memberof AxonClient
*/
readonly webhooks: Webhooks;
/**
* Returns the template config
*
* @readonly
* @memberof AxonClient
*/
readonly template: AxonTemplate;
/**
* Returns the custom config
*
* @readonly
* @memberof AxonClient
*/
readonly custom: object | null;
/**
* Return the MessageManager instance
*
* @readonly
* @memberof AxonClient
*/
readonly l: MessageManager;

/**
* Get a module from AxonClient with the given label.
*
* @param module - Module label
* @memberof AxonClient
*/
getModule(module: string): Module | null;
/**
* Get a command/subcommand from AxonClient with the given full label.
*
* @param fullLabel - Full command (or subcommand) label
* @memberof AxonClient
*/
getCommand(fullLabel: string): Command | null;

/**
* Start AxonClient.
* Start bot client.
* Bind error listeners and event listeners.
*
* Calls custom onStart() method at the beginning.
* Calls custom onReady() method when AxonClient is ready.
*
* @async
* @memberof AxonClient
*/
public start(): Promise<void>;
/**
* Override this method.
* Method executed after the object is finished to be constructed (in the constructor)
*
* @memberof AxonClient
*/
public onInit(): true;
/**
* Override this method.
* Method executed at the beginning of the start method.
*
* @memberof AxonClient
*/
public onStart(): Promise<true>;
/**
* Override this method.
* Method executed at the end of the start method (when the AxonClient is ready).
*
* @memberof AxonClient
*/
public onReady(): Promise<true>;
/**
* Log both to console and to the correct webhook
*
* @param level - The LOG-LEVEL
* @param content - The content or the error to log
* @param ctx - Additional context to be passed to logger
* @param execWebhook - Whether to execute the webhook
* @memberof AxonClient
*/
public log(level: LOG_LEVELS, content: Error | string, ctx?: Ctx, execWebhook?: boolean): void;
/**
* Function executed on the global messageCreate event and dispatch to the correct command and execution
*
* @memberof AxonClient
*/
private _onMessageCreate(msg: LibMessage): void;

/**
* Function executed when the bot client is ready.
* Bind events and initialise client status/game.
* @memberof AxonClient
*/
private _onReady(): void;
/**
* Initialize error listeners and webhooks.
* Override this method to setup your own error listeners.
* @memberof AxonClient
*/
public initErrorListeners(): void;
/**
* Set the bot status. Override to setup your own status.
* Called after the client ready event.
* @memberof AxonClient
*/
public initStatus(): void;

public _execCommand(msg: LibMessage, args: string[], command: Command, guildConfig: GuildConfig, optionals: { isAdmin: boolean; isOwner: boolean; } ): void;
public _execHelp(msg: LibMessage, args: string[], command: Command, guildConfig: GuildConfig, optionals: { isAdmin: boolean; isOwner: boolean; } ): void;
public _execListener(listener: Listener, guildConfig: GuildConfig, ...args: any[] ): void;

/**
* Send full help in DM.
* Doesn't show commands that the user can't execute.
* This method can be overridden in child.
*
* @param msg - The message object
*
* @memberof AxonClient
*/
public sendFullHelp(msg: LibMessage, guildConfig?: GuildConfig): Promise<void>;
/**
* Register a guild prefix.
* Shortcut to guildConfig.registerPrefix()
*
* @param gID - The guild ID
* @param prefixArr - The array of prefixes
* @returns The guild Schema from the DB / Error if error
*
* @memberof AxonClient
*/
public registerGuildPrefixes(gID: string, prefixArr: string[] ): Promise<GuildConfig>;
/**
* Custom toString method.
*
* @memberof AxonClient
*/
toString(): string;
/**
* Custom ToJSON method.
* (Based of Eris')
*
* @returns JSON-like Object
* @memberof AxonClient
*/
toJSON(): object;

// events
on(event: 'debug', listener: (debugMessage: string) => void): this;
on(event: 'commandExecution', listener: (status: boolean, commandFullLabel: string, data: { msg: LibMessage; command: Command; guildConfig: GuildConfig; context: CommandContext;} ) => void): this;
on(event: 'commandError', listener: (commandFullLabel: string, data: { msg: LibMessage; command: Command; guildConfig: GuildConfig; error: AxonCommandError; } ) => void): this;
on(event: 'listenerExecution', listener: (status: boolean, eventName: string, listenerName: string, data: { listener: Listener; guildConfig: GuildConfig; } ) => void): this;
on(event: 'listenerError', listener: (eventName: string, listenerName: string, data: { listener: Listener; guildConfig: GuildConfig; error: Error; } ) => void): this;
}
56 changes: 56 additions & 0 deletions types/AxonOptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

export declare class AxonOptions {
/**
* The discord token to automatically connect the bot client
*/
private _token: string;
/**
* Bot prefixes
*/
public prefixes: AxonOptionsPrefixes;
/**
* Bot settings
*/
public settings: AOptionsSettings;
/**
* Translation file
*/
public lang: Languages;
/**
* Custom function that will log a custom logo on startup
*/
public logo: ( () => void) | null;
/**
* General info about the bot
*/
public info: AxonOptionsInfo;
/**
* The bot staff (owner, admins)
*/
public staff: AxonOptionsStaff;
/**
* Template information (colours / formatting / emojis)
*/
public template: AxonTemplate;
/**
* Custom configs that can be provided
*/
public custom: object | null;
/**
* Webhooks tokens / id
*/
public webhooks: Webhooks;
/**
* Classes overrides
*/
public extensions: AxonOptionsExtensions;
/**
* Creates an instance of AxonOptions.
*
* @param data - AxonOptions data
* @param webhooks - Webhooks tokens / id
* @param extensions - Classes overrides
* @memberof AxonOptions
*/
constructor(data?: AxonOptionsBase | {}, webhooks?: Webhooks | {}, extensions?: AxonOptionsExtensions | {} )
}
Loading