Skip to content

Commit

Permalink
typings/docs: Various Typescript adjustement (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsian03 authored May 5, 2020
1 parent 2d8b708 commit 41315e3
Show file tree
Hide file tree
Showing 38 changed files with 53 additions and 22 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"requireLast": true
}
}
]
],
"@typescript-eslint/ban-ts-ignore": 0
}
}
]
Expand Down
6 changes: 5 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/* eslint-disable @typescript-eslint/ban-ts-ignore */
import * as AxonCore from './types';
export = AxonCore;
declare module 'axoncore' {
// @ts-ignore
export = AxonCore;
}
3 changes: 1 addition & 2 deletions types/AxonClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { EventEmitter } from 'events';
import {
AxonConfs, AxonParams, Info, AxonInfo, ALogger, AxonUtils, LibClient, LibraryInterface, Utils, ADBProvider, ModuleRegistry, CommandRegistry, ListenerRegistry,
EventManager, GuildConfigCache, AxonConfig, ModuleLoader, CommandDispatcher, MessageManager, AxonStaffIDs, AxonOptions, Collection, AHandler, Listener, Resolver,
Webhooks, AxonTemplate, Module, Command, LOG_LEVELS, Ctx, LibMessage, GuildConfig, DEBUG_FLAGS,
Webhooks, AxonTemplate, Module, Command, LOG_LEVELS, Ctx, LibMessage, GuildConfig, DEBUG_FLAGS, Executor,
} from './';
import { Executor } from '..';

export declare class AxonClient extends EventEmitter {
/** Configs (webhooks, template, custom) */
Expand Down
2 changes: 1 addition & 1 deletion types/Database/ADBProvider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
AxonClient, AxonOptions, AxonConfig, GuildConfig, updateDBVal,
} from '../../';
} from '..';

/**
* Abstract class for all DB services.
Expand Down
2 changes: 1 addition & 1 deletion types/Database/DBSelector.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
ASelector, AxonClient, AxonOptions, InMemoryProvider, JsonProvider, MongoProvider,
} from '../../';
} from '..';

/**
* Database Selector
Expand Down
2 changes: 1 addition & 1 deletion types/Database/InMemoryProvider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
ADBProvider, AxonConfig, GuildConfig, Module, Command, Listener,
} from '../../';
} from '..';

/**
* A schema designed use an InMemory solution in AxonCore
Expand Down
2 changes: 1 addition & 1 deletion types/Database/JsonProvider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
ADBProvider, JsonManager, AxonOptions, AxonConfig, GuildConfig, updateDBVal,
} from '../../';
} from '..';

/**
* DB interface to interact with a Json Database.
Expand Down
9 changes: 5 additions & 4 deletions types/Database/MongoProvider.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// @ts-ignore
import { Model } from 'mongoose';
import {
ADBProvider, AxonConfig, GuildConfig, AxonOptions, GuildSchema, updateDBVal,
} from '../../';
ADBProvider, AxonConfig, GuildConfig, AxonOptions, GuildSchema, updateDBVal, AxonSchema,
} from '..';

/**
* DB interface to interact with a MongoDB Database.
Expand All @@ -12,8 +13,8 @@ import {
* @extends ADBProvider
*/
export declare class MongoProvider extends ADBProvider {
public AxonSchema?: AxonConfig;
public GuildSchema?: GuildConfig;
public AxonSchema?: AxonSchema;
public GuildSchema?: GuildSchema;

/**
* Override init method.
Expand Down
2 changes: 1 addition & 1 deletion types/Error/AxonCommandError.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CommandContext } from '../../';
import { CommandContext } from '..';
/**
* Custom error with better formatting and context informations.
* Used for errors thrown by AxonCore commands.
Expand Down
2 changes: 1 addition & 1 deletion types/Error/AxonError.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Module } from '../../';
import { Module } from '..';

/**
* Custom error with better formatting + information about where the error is originated from.
Expand Down
2 changes: 1 addition & 1 deletion types/Langs/MessageManager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
AxonClient, Languages, TranslationManager, MessageParser, AxonLanguageResponse,
} from '../../';
} from '..';

/**
* Holds all messages.
Expand Down
2 changes: 1 addition & 1 deletion types/Langs/MessageParser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AxonLanguageResponse } from '../../';
import { AxonLanguageResponse } from '..';

/**
* Parse a message and replace custom variable with arguments
Expand Down
2 changes: 1 addition & 1 deletion types/Langs/TranslationManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MessageManager, Languages, AxonLanguageResponse } from '../../';
import { MessageManager, Languages, AxonLanguageResponse } from '..';

/**
* Class dedicated to manage translations.
Expand Down
2 changes: 1 addition & 1 deletion types/Libraries/definitions/Message.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
LibraryInterface, LibMessage, LibUser, LibMember, LibTextableChannel, LibGuild, AxonMSGCont,
} from '../../../';
} from '../..';

export declare class Message {
public lib: LibraryInterface;
Expand Down
2 changes: 1 addition & 1 deletion types/Libraries/definitions/Resolver.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
LibClient, LibUser, LibGuild, LibMember, LibRole, LibChannel,
} from '../../../';
} from '../..';

/**
* Static Resolver class for AxonCore
Expand Down
2 changes: 1 addition & 1 deletion types/Libraries/definitions/User.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LibraryInterface, LibUser, LibDMChannel } from '../../../';
import { LibraryInterface, LibUser, LibDMChannel } from '../..';

export declare class User {
public lib: LibraryInterface;
Expand Down
2 changes: 2 additions & 0 deletions types/Libraries/definitions/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// @ts-ignore
import * as Eris from 'eris';
// @ts-ignore
import * as Djs from 'discord.js';

declare type LibMessage = Eris.Message | Djs.Message;
Expand Down
2 changes: 1 addition & 1 deletion types/Libraries/discordjs/Channel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as djs from 'discord.js';
import { DjsContent } from '../../../';
import { DjsContent } from '../../';
import { Channel } from '../definitions/Channel';
import { DISCORD_LIB_PERMISSIONS } from './Enums';

Expand Down
3 changes: 2 additions & 1 deletion types/Libraries/discordjs/Client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DjsPresenceGame, DjsWebhookContent, WebhookResponse } from '../../../';
import { DjsPresenceGame, DjsWebhookContent, WebhookResponse } from '../../';
import { DjsInterface } from './LibraryInterface';
import { Client } from '../definitions/Client';
// @ts-ignore
import * as djs from 'discord.js';

export declare class DjsClient extends Client {
Expand Down
1 change: 1 addition & 0 deletions types/Libraries/discordjs/Guild.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Guild } from '../definitions/Guild';
// @ts-ignore
import * as djs from 'discord.js';

export declare class DjsGuild extends Guild {
Expand Down
1 change: 1 addition & 0 deletions types/Libraries/discordjs/LibraryInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { DjsGuild } from './Guild';
import { DjsResolver } from './Resolver';
import { DjsClient } from './Client';
import { DjsEnums } from './Enums';
// @ts-ignore
import * as djs from 'discord.js';

export declare class DjsInterface extends LibraryInterface {
Expand Down
1 change: 1 addition & 0 deletions types/Libraries/discordjs/Member.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Member } from '../definitions/Member';
// @ts-ignore
import * as djs from 'discord.js';
import { DISCORD_LIB_PERMISSIONS } from './Enums';

Expand Down
1 change: 1 addition & 0 deletions types/Libraries/discordjs/Message.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Message } from '../definitions/Message';
// @ts-ignore
import * as djs from 'discord.js';
import { DjsContent } from '../../';

Expand Down
1 change: 1 addition & 0 deletions types/Libraries/discordjs/Resolver.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Resolver } from '../definitions/Resolver';
// @ts-ignore
import * as djs from 'discord.js';

export declare class DjsResolver extends Resolver {
Expand Down
1 change: 1 addition & 0 deletions types/Libraries/discordjs/User.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { User } from '../definitions/User';
// @ts-ignore
import * as djs from 'discord.js';

export declare class DjsUser extends User {
Expand Down
1 change: 1 addition & 0 deletions types/Libraries/discordjs/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
Message, GuildMember, Client, Guild, User, TextChannel, Role, Channel, DMChannel, PermissionOverwrites, MessageMentionOptions,
// @ts-ignore
} from 'discord.js';

declare type LibMessage = Message;
Expand Down
1 change: 1 addition & 0 deletions types/Libraries/eris/Channel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Channel } from '../definitions/Channel';
// @ts-ignore
import * as Eris from 'eris';
import { DISCORD_LIB_PERMISSIONS } from './Enums';
import { ErisContent } from '../../';
Expand Down
1 change: 1 addition & 0 deletions types/Libraries/eris/Client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Client } from '../definitions/Client';
// @ts-ignore
import * as Eris from 'eris';
import { ErisPresenceGame, ErisWebhookContent, WebhookResponse } from '../../';

Expand Down
1 change: 1 addition & 0 deletions types/Libraries/eris/Guild.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Guild } from '../definitions/Guild';
// @ts-ignore
import * as Eris from 'eris';

export declare class ErisGuild extends Guild {
Expand Down
1 change: 1 addition & 0 deletions types/Libraries/eris/LibraryInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ErisMessage } from './Message';
import { ErisResolver } from './Resolver';
import { ErisClient } from './Client';
import { ErisEnums } from './Enums';
// @ts-ignore
import * as Eris from 'eris';

export declare class ErisInterface extends LibraryInterface {
Expand Down
1 change: 1 addition & 0 deletions types/Libraries/eris/Member.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Member } from '../definitions/Member';
// @ts-ignore
import * as Eris from 'eris';
import { DISCORD_LIB_PERMISSIONS } from './Enums';

Expand Down
1 change: 1 addition & 0 deletions types/Libraries/eris/Message.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Message } from '../definitions/Message';
// @ts-ignore
import * as Eris from 'eris';
import { ErisContent } from '../../';

Expand Down
1 change: 1 addition & 0 deletions types/Libraries/eris/Resolver.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Resolver } from '../definitions/Resolver';
// @ts-ignore
import * as Eris from 'eris';

/**
Expand Down
1 change: 1 addition & 0 deletions types/Libraries/eris/User.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { User } from '../definitions/User';
// @ts-ignore
import * as Eris from 'eris';

export declare class ErisUser extends User {
Expand Down
1 change: 1 addition & 0 deletions types/Libraries/eris/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
Message, Member, Client, Guild, User, TextableChannel, Role, Channel, PrivateChannel, Permission, PermissionOverwrite, AllowedMentions,
// @ts-ignore
} from 'eris';

declare type LibMessage = Message;
Expand Down
1 change: 1 addition & 0 deletions types/Loggers/SignaleLogger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ALogger } from '../';
// @ts-ignore
import { Signale } from 'signale';

/**
Expand Down
1 change: 1 addition & 0 deletions types/Loggers/WinstonLogger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ALogger } from '../';
// @ts-ignore
import * as Winston from 'winston';

export declare class WinstonLogger extends ALogger {
Expand Down
5 changes: 5 additions & 0 deletions types/misc/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import {
CommandOptions, CommandPermissions, LibTextableChannel, LibMember, LibMessage, Command, LibGuild, LibUser, LIBRARY_TYPES, LOGGER_TYPES, DB_TYPES,
Utils, ALogger, ADBProvider, AxonConfig, GuildConfig, User, Member, Message, Channel, Guild, Resolver, Embed, COMMAND_EXECUTION_TYPES, LibAllowedMentions,
} from '../';
// @ts-ignore
import * as djs from 'discord.js';
// @ts-ignore
import * as Eris from 'eris';

interface ModuleInfo {
Expand Down Expand Up @@ -380,6 +382,7 @@ interface CommandData {
interface AxonTemplate {
embeds: {[key: string]: number;};
emotes: {[key: string]: string;};
[key: string]: {[key: string]: unknown;};
}

interface ListenerInfo {
Expand Down Expand Up @@ -719,11 +722,13 @@ interface AxonOptionsInfo {
description: string;
/** The application version */
version: string;
[key: string]: string;
}

interface AxonOptionsStaff {
owners: {name: string; id: string;}[];
admins: {name: string; id: string;}[];
[key: string]: {name: string; id: string;}[];
}

interface AxonOptionsExtensions {
Expand Down

0 comments on commit 41315e3

Please sign in to comment.