diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-31 13:46:27 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-31 13:46:27 -0400 |
commit | edcc0dd0a9228192ff6c4f6d6797dd6238e98f92 (patch) | |
tree | 70c3f5436342d7f6b0e81222467d2773a3bb0b33 /src/lib | |
parent | b63a6b0cb61f0abf8a946a7f0f04a2a19a31e690 (diff) | |
download | tanzanite-edcc0dd0a9228192ff6c4f6d6797dd6238e98f92.tar.gz tanzanite-edcc0dd0a9228192ff6c4f6d6797dd6238e98f92.tar.bz2 tanzanite-edcc0dd0a9228192ff6c4f6d6797dd6238e98f92.zip |
upgraded to typescript 4.3.5
The reason I had to use getters and setters for the db models is because in the newer version of typescript the properties would be defined at runtime and override the getter and setters that sequalize uses later, causing all the values to be undefined and not being able to save any information.
Diffstat (limited to 'src/lib')
21 files changed, 374 insertions, 59 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 7b270f6..4c2b940 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -34,12 +34,17 @@ import { BushConstants } from '../../utils/BushConstants'; import { BushLogger } from '../../utils/BushLogger'; import { Config } from '../../utils/Config'; import { BushApplicationCommand } from '../discord.js/BushApplicationCommand'; +import { BushBaseGuildEmojiManager } from '../discord.js/BushBaseGuildEmojiManager'; import { BushButtonInteraction } from '../discord.js/BushButtonInteraction'; import { BushCategoryChannel } from '../discord.js/BushCategoryChannel'; +import { BushChannel } from '../discord.js/BushChannel'; +import { BushChannelManager } from '../discord.js/BushChannelManager'; +import { BushClientUser } from '../discord.js/BushClientUser'; import { BushCommandInteraction } from '../discord.js/BushCommandInteraction'; import { BushDMChannel } from '../discord.js/BushDMChannel'; import { BushGuild } from '../discord.js/BushGuild'; import { BushGuildEmoji } from '../discord.js/BushGuildEmoji'; +import { BushGuildManager } from '../discord.js/BushGuildManager'; import { BushGuildMember } from '../discord.js/BushGuildMember'; import { BushMessage } from '../discord.js/BushMessage'; import { BushMessageReaction } from '../discord.js/BushMessageReaction'; @@ -53,6 +58,7 @@ import { BushTextChannel } from '../discord.js/BushTextChannel'; import { BushThreadChannel } from '../discord.js/BushThreadChannel'; import { BushThreadMember } from '../discord.js/BushThreadMember'; import { BushUser } from '../discord.js/BushUser'; +import { BushUserManager } from '../discord.js/BushUserManager'; import { BushVoiceChannel } from '../discord.js/BushVoiceChannel'; import { BushVoiceState } from '../discord.js/BushVoiceState'; import { BushClientUtil } from './BushClientUtil'; @@ -75,6 +81,8 @@ export type BushEmojiResolvable = Snowflake | BushGuildEmoji | BushReactionEmoji export type BushEmojiIdentifierResolvable = string | BushEmojiResolvable; export type BushThreadChannelResolvable = BushThreadChannel | Snowflake; export type BushApplicationCommandResolvable = BushApplicationCommand | Snowflake; +export type BushGuildTextChannelResolvable = BushTextChannel | BushNewsChannel | Snowflake; +export type BushChannelResolvable = BushChannel | Snowflake; export interface BushFetchedThreads { threads: Collection<Snowflake, BushThreadChannel>; hasMore?: boolean; @@ -86,7 +94,9 @@ const rl = readline.createInterface({ terminal: false }); -export class BushClient extends AkairoClient { +type If<T extends boolean, A, B = null> = T extends true ? A : T extends false ? B : A | B; + +export class BushClient<Ready extends boolean = boolean> extends AkairoClient { public static preStart(): void { Structures.extend('GuildEmoji', () => BushGuildEmoji); Structures.extend('DMChannel', () => BushDMChannel); @@ -110,6 +120,12 @@ export class BushClient extends AkairoClient { Structures.extend('SelectMenuInteraction', () => BushSelectMenuInteraction); } + public declare channels: BushChannelManager; + public declare readonly emojis: BushBaseGuildEmojiManager; + public declare guilds: BushGuildManager; + public declare user: If<Ready, BushClientUser>; + public declare users: BushUserManager; + public config: Config; public listenerHandler: BushListenerHandler; public inhibitorHandler: BushInhibitorHandler; @@ -289,17 +305,17 @@ export class BushClient extends AkairoClient { } /** Logs out, terminates the connection to Discord, and destroys the client. */ - public destroy(relogin = false): void | Promise<string> { + public override destroy(relogin = false): void | Promise<string> { super.destroy(); if (relogin) { return this.login(this.token); } } - public isOwner(user: BushUserResolvable): boolean { + public override isOwner(user: BushUserResolvable): boolean { return this.config.owners.includes(this.users.resolveId(user)); } - public isSuperUser(user: BushUserResolvable): boolean { + public override isSuperUser(user: BushUserResolvable): boolean { const userID = this.users.resolveId(user); return !!BushCache?.global?.superUsers?.includes(userID) || this.config.owners.includes(userID); } diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index aecc635..ac39611 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -521,7 +521,7 @@ export class BushClientUtil extends ClientUtil { /** Gets the channel configs as a TextChannel */ public async getConfigChannel(channel: 'log' | 'error' | 'dm'): Promise<TextChannel> { - return (await client.channels.fetch(client.config.channels[channel])) as TextChannel; + return (await client.channels.fetch(client.config.channels[channel])) as unknown as TextChannel; } /** diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts index 6616d1d..6dd5449 100644 --- a/src/lib/extensions/discord-akairo/BushCommand.ts +++ b/src/lib/extensions/discord-akairo/BushCommand.ts @@ -182,8 +182,8 @@ export class BushCommand extends Command { } } - public exec(message: BushMessage, args: any): any; - public exec(message: BushMessage | BushSlashMessage, args: any): any { + public override exec(message: BushMessage, args: any): any; + public override exec(message: BushMessage | BushSlashMessage, args: any): any { super.exec(message, args); } } diff --git a/src/lib/extensions/discord-akairo/BushCommandHandler.ts b/src/lib/extensions/discord-akairo/BushCommandHandler.ts index f16554c..7eca05b 100644 --- a/src/lib/extensions/discord-akairo/BushCommandHandler.ts +++ b/src/lib/extensions/discord-akairo/BushCommandHandler.ts @@ -35,7 +35,7 @@ export class BushCommandHandler extends CommandHandler { super(client, options); } - public async runPostTypeInhibitors(message: BushMessage, command: BushCommand, slash = false): Promise<boolean> { + public override async runPostTypeInhibitors(message: BushMessage, command: BushCommand, slash = false): Promise<boolean> { if (command.ownerOnly) { const isOwner = client.isOwner(message.author); if (!isOwner) { diff --git a/src/lib/extensions/discord-akairo/BushInhibitor.ts b/src/lib/extensions/discord-akairo/BushInhibitor.ts index f924458..8a199fc 100644 --- a/src/lib/extensions/discord-akairo/BushInhibitor.ts +++ b/src/lib/extensions/discord-akairo/BushInhibitor.ts @@ -8,8 +8,8 @@ import { BushSlashMessage } from './BushSlashMessage'; export class BushInhibitor extends Inhibitor { public declare client: BushClient; - public exec(message: BushMessage, command: BushCommand): any; - public exec(message: BushMessage | BushSlashMessage, command: BushCommand): any { + public override exec(message: BushMessage, command: BushCommand): any; + public override exec(message: BushMessage | BushSlashMessage, command: BushCommand): any { return super.exec(message, command); } } diff --git a/src/lib/extensions/discord.js/BushBaseGuildEmojiManager.d.ts b/src/lib/extensions/discord.js/BushBaseGuildEmojiManager.d.ts new file mode 100644 index 0000000..165ea6e --- /dev/null +++ b/src/lib/extensions/discord.js/BushBaseGuildEmojiManager.d.ts @@ -0,0 +1,9 @@ +import { Snowflake } from 'discord-api-types'; +import { CachedManager } from 'discord.js'; +import { BushClient, BushEmojiIdentifierResolvable, BushEmojiResolvable } from '../discord-akairo/BushClient'; +import { BushGuildEmoji } from './BushGuildEmoji'; + +export class BushBaseGuildEmojiManager extends CachedManager<Snowflake, BushGuildEmoji, BushEmojiResolvable> { + public constructor(client: BushClient, iterable?: Iterable<unknown>); + public resolveIdentifier(emoji: BushEmojiIdentifierResolvable): string | null; +} diff --git a/src/lib/extensions/discord.js/BushChannel.d.ts b/src/lib/extensions/discord.js/BushChannel.d.ts new file mode 100644 index 0000000..482dd9b --- /dev/null +++ b/src/lib/extensions/discord.js/BushChannel.d.ts @@ -0,0 +1,23 @@ +import { Snowflake } from 'discord-api-types'; +import { Channel, ChannelMention } from 'discord.js'; +import { ChannelTypes } from 'discord.js/typings/enums'; +import { BushClient } from '../discord-akairo/BushClient'; +import { BushDMChannel } from './BushDMChannel'; +import { BushNewsChannel } from './BushNewsChannel'; +import { BushTextChannel } from './BushTextChannel'; +import { BushThreadChannel } from './BushThreadChannel'; + +export class BushChannel extends Channel { + public constructor(client: BushClient, data?: unknown, immediatePatch?: boolean); + public readonly createdAt: Date; + public readonly createdTimestamp: number; + public deleted: boolean; + public id: Snowflake; + public readonly partial: false; + public type: keyof typeof ChannelTypes; + public delete(): Promise<BushChannel>; + public fetch(force?: boolean): Promise<BushChannel>; + public isText(): this is BushTextChannel | BushDMChannel | BushNewsChannel | BushThreadChannel; + public isThread(): this is BushThreadChannel; + public toString(): ChannelMention; +} diff --git a/src/lib/extensions/discord.js/BushChannelManager.d.ts b/src/lib/extensions/discord.js/BushChannelManager.d.ts new file mode 100644 index 0000000..1aa19c5 --- /dev/null +++ b/src/lib/extensions/discord.js/BushChannelManager.d.ts @@ -0,0 +1,9 @@ +import { Snowflake } from 'discord-api-types'; +import { CachedManager, Client, FetchChannelOptions } from 'discord.js'; +import { BushChannelResolvable } from '../discord-akairo/BushClient'; +import { BushChannel } from './BushChannel'; + +export class BushChannelManager extends CachedManager<Snowflake, BushChannel, BushChannelResolvable> { + public constructor(client: Client, iterable: Iterable<unknown>); + public fetch(id: Snowflake, options?: FetchChannelOptions): Promise<BushChannel | null>; +} diff --git a/src/lib/extensions/discord.js/BushClientUser.d.ts b/src/lib/extensions/discord.js/BushClientUser.d.ts new file mode 100644 index 0000000..119f8ce --- /dev/null +++ b/src/lib/extensions/discord.js/BushClientUser.d.ts @@ -0,0 +1,23 @@ +import { + ActivityOptions, + Base64Resolvable, + BufferResolvable, + ClientUserEditData, + Presence, + PresenceData, + PresenceStatusData +} from 'discord.js'; +import { BushUser } from './BushUser'; + +export class BushClientUser extends BushUser { + public mfaEnabled: boolean; + public verified: boolean; + public edit(data: ClientUserEditData): Promise<this>; + public setActivity(options?: ActivityOptions): Presence; + public setActivity(name: string, options?: ActivityOptions): Presence; + public setAFK(afk: boolean, shardId?: number | number[]): Presence; + public setAvatar(avatar: BufferResolvable | Base64Resolvable): Promise<this>; + public setPresence(data: PresenceData): Presence; + public setStatus(status: PresenceStatusData, shardId?: number | number[]): Presence; + public setUsername(username: string): Promise<this>; +} diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index dd41dad..acfe5da 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -1,8 +1,10 @@ -import { Guild, User } from 'discord.js'; -import { BushGuildMember, ModLogType } from '../..'; +import { Guild } from 'discord.js'; import { Guild as GuildDB, GuildModel } from '../../models/Guild'; +import { ModLogType } from '../../models/ModLog'; import { BushClient, BushUserResolvable } from '../discord-akairo/BushClient'; +import { BushGuildMember } from './BushGuildMember'; import { BushGuildMemberManager } from './BushGuildMemberManager'; +import { BushUser } from './BushUser'; export class BushGuild extends Guild { public declare readonly client: BushClient; @@ -27,7 +29,7 @@ export class BushGuild extends Guild { } public async unban(options: { - user: BushUserResolvable | User; + user: BushUserResolvable | BushUser; reason?: string; moderator?: BushUserResolvable; }): Promise< diff --git a/src/lib/extensions/discord.js/BushGuildManager.d.ts b/src/lib/extensions/discord.js/BushGuildManager.d.ts new file mode 100644 index 0000000..5bfe706 --- /dev/null +++ b/src/lib/extensions/discord.js/BushGuildManager.d.ts @@ -0,0 +1,20 @@ +import { Snowflake } from 'discord-api-types'; +import { + CachedManager, + Collection, + FetchGuildOptions, + FetchGuildsOptions, + Guild, + GuildCreateOptions, + OAuth2Guild +} from 'discord.js'; +import { BushClient } from '../discord-akairo/BushClient'; +import { BushGuildResolvable } from './BushCommandInteraction'; +import { BushGuild } from './BushGuild'; + +export class BushGuildManager extends CachedManager<Snowflake, BushGuild, BushGuildResolvable> { + public constructor(client: BushClient, iterable?: Iterable<unknown>); + public create(name: string, options?: GuildCreateOptions): Promise<Guild>; + public fetch(options: Snowflake | FetchGuildOptions): Promise<BushGuild>; + public fetch(options?: FetchGuildsOptions): Promise<Collection<Snowflake, OAuth2Guild>>; +} diff --git a/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts b/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts index 96b99e5..7bdad83 100644 --- a/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts +++ b/src/lib/extensions/discord.js/BushGuildMemberManager.d.ts @@ -1,5 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { + AddGuildMemberOptions, BanOptions, CachedManager, Collection, @@ -10,8 +11,7 @@ import { GuildPruneMembersOptions, GuildSearchMembersOptions, Snowflake, - User, - UserResolvable + User } from 'discord.js'; import { BushClient, BushGuildMemberResolvable, BushUserResolvable } from '../discord-akairo/BushClient'; import { BushGuild } from './BushGuild'; @@ -21,15 +21,20 @@ export class BushGuildMemberManager extends CachedManager<Snowflake, BushGuildMe public constructor(guild: BushGuild, iterable?: Iterable<unknown>); public declare readonly client: BushClient; public guild: BushGuild; + public add( + user: BushUserResolvable, + options: AddGuildMemberOptions & { fetchWhenExisting: false } + ): Promise<GuildMember | null>; + public add(user: BushUserResolvable, options: AddGuildMemberOptions): Promise<GuildMember>; public ban(user: BushUserResolvable, options?: BanOptions): Promise<GuildMember | User | Snowflake>; public edit(user: BushUserResolvable, data: GuildMemberEditData, reason?: string): Promise<void>; public fetch( - options: UserResolvable | FetchMemberOptions | (FetchMembersOptions & { user: UserResolvable }) + options: BushUserResolvable | FetchMemberOptions | (FetchMembersOptions & { user: BushUserResolvable }) ): Promise<GuildMember>; public fetch(options?: FetchMembersOptions): Promise<Collection<Snowflake, GuildMember>>; - public kick(user: UserResolvable, reason?: string): Promise<BushGuildMember | User | Snowflake>; + public kick(user: BushUserResolvable, reason?: string): Promise<BushGuildMember | User | Snowflake>; public prune(options: GuildPruneMembersOptions & { dry?: false; count: false }): Promise<null>; public prune(options?: GuildPruneMembersOptions): Promise<number>; public search(options: GuildSearchMembersOptions): Promise<Collection<Snowflake, GuildMember>>; - public unban(user: UserResolvable, reason?: string): Promise<User>; + public unban(user: BushUserResolvable, reason?: string): Promise<User>; } diff --git a/src/lib/extensions/discord.js/BushMessage.ts b/src/lib/extensions/discord.js/BushMessage.ts index 7971a6d..5638801 100644 --- a/src/lib/extensions/discord.js/BushMessage.ts +++ b/src/lib/extensions/discord.js/BushMessage.ts @@ -26,7 +26,7 @@ export class BushMessage extends Message { super(client, data, channel); // this.util = new BushCommandUtil(client.commandHandler, this); } - public fetch(force?: boolean): Promise<BushMessage> { + public override fetch(force?: boolean): Promise<BushMessage> { return super.fetch(force) as Promise<BushMessage>; } } diff --git a/src/lib/extensions/discord.js/BushUserManager.d.ts b/src/lib/extensions/discord.js/BushUserManager.d.ts new file mode 100644 index 0000000..176b449 --- /dev/null +++ b/src/lib/extensions/discord.js/BushUserManager.d.ts @@ -0,0 +1,9 @@ +import { Snowflake } from 'discord-api-types'; +import { BaseFetchOptions, CachedManager } from 'discord.js'; +import { BushClient, BushUserResolvable } from '../discord-akairo/BushClient'; +import { BushUser } from './BushUser'; + +export class BushUserManager extends CachedManager<Snowflake, BushUser, BushUserResolvable> { + public constructor(client: BushClient, iterable?: Iterable<unknown>); + public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<BushUser>; +} diff --git a/src/lib/models/ActivePunishment.ts b/src/lib/models/ActivePunishment.ts index 9fcafbe..c204c9a 100644 --- a/src/lib/models/ActivePunishment.ts +++ b/src/lib/models/ActivePunishment.ts @@ -36,31 +36,58 @@ export class ActivePunishment /** * The ID of this punishment (no real use just for a primary key) */ - id: string; + public get id(): string { + return null; + } + public set id(value: string) {} + /** * The type of punishment. */ - type: ActivePunishmentType; + public get type(): ActivePunishmentType { + return null; + } + public set type(value: ActivePunishmentType) {} + /** * The user who is punished. */ - user: Snowflake; + public get user(): Snowflake { + return null; + } + public set user(value: Snowflake) {} + /** * The guild they are punished in. */ - guild: Snowflake; + public get guild(): Snowflake { + return null; + } + public set guild(value: Snowflake) {} + /** * Additional info about the punishment if applicable. The channel id for channel blocks and role for punishment roles. */ - extraInfo: Snowflake; + public get extraInfo(): Snowflake { + return null; + } + public set extraInfo(value: Snowflake) {} + /** * The date when this punishment expires (optional). */ - expires: Date | null; + public get expires(): Date | null { + return null; + } + public set expires(value: Date | null) {} + /** * The reference to the modlog entry. */ - modlog: string; + public get modlog(): string { + return null; + } + public set modlog(value: string) {} static initModel(sequelize: Sequelize): void { ActivePunishment.init( diff --git a/src/lib/models/BaseModel.ts b/src/lib/models/BaseModel.ts index fdbd706..340e0aa 100644 --- a/src/lib/models/BaseModel.ts +++ b/src/lib/models/BaseModel.ts @@ -1,6 +1,17 @@ import { Model } from 'sequelize'; export abstract class BaseModel<A, B> extends Model<A, B> { - public readonly createdAt: Date; - public readonly updatedAt: Date; + /** + * The date when the row was created. + */ + public get createdAt(): Date { + return null; + } + + /** + * The date when the row was last updated. + */ + public get updatedAt(): Date { + return null; + } } diff --git a/src/lib/models/Global.ts b/src/lib/models/Global.ts index e37ef2b..80f11ca 100644 --- a/src/lib/models/Global.ts +++ b/src/lib/models/Global.ts @@ -24,27 +24,51 @@ export class Global extends BaseModel<GlobalModel, GlobalModelCreationAttributes /** * The bot's environment. */ - environment: 'production' | 'development' | 'beta'; + public get environment(): 'production' | 'development' | 'beta' { + return null; + } + public set environment(value: 'production' | 'development' | 'beta') {} + /** * Trusted users. */ - superUsers: Snowflake[]; + public get superUsers(): Snowflake[] { + return null; + } + public set superUsers(value: Snowflake[]) {} + /** * Globally disabled commands. */ - disabledCommands: string[]; + public get disabledCommands(): string[] { + return null; + } + public set disabledCommands(value: string[]) {} + /** * Globally blacklisted users. */ - blacklistedUsers: Snowflake[]; + public get blacklistedUsers(): Snowflake[] { + return null; + } + public set blacklistedUsers(value: Snowflake[]) {} + /** * Guilds blacklisted from using the bot. */ - blacklistedGuilds: Snowflake[]; + public get blacklistedGuilds(): Snowflake[] { + return null; + } + public set blacklistedGuilds(value: Snowflake[]) {} + /** * Channels where the bot is prevented from running. */ - blacklistedChannels: Snowflake[]; + public get blacklistedChannels(): Snowflake[] { + return null; + } + public set blacklistedChannels(value: Snowflake[]) {} + static initModel(sequelize: Sequelize): void { Global.init( { diff --git a/src/lib/models/Guild.ts b/src/lib/models/Guild.ts index 7a0384c..aac4267 100644 --- a/src/lib/models/Guild.ts +++ b/src/lib/models/Guild.ts @@ -32,17 +32,93 @@ export interface GuildModelCreationAttributes { } export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> implements GuildModel { - id!: Snowflake; - prefix!: string; - autoPublishChannels: Snowflake[]; - blacklistedChannels: Snowflake[]; - blacklistedUsers: Snowflake[]; - welcomeChannel: Snowflake; - muteRole: Snowflake; - punishmentEnding: string; - disabledCommands: string[]; - lockdownChannels: Snowflake[]; - autoModPhases: string[]; + /** + * The ID of the guild + */ + public get id(): Snowflake { + return null; + } + public set id(value: Snowflake) {} + + /** + * The bot's prefix for the guild + */ + public get prefix(): string { + return null; + } + public set prefix(value: string) {} + + /** + * Channels that will have their messages automatically published + */ + public get autoPublishChannels(): Snowflake[] { + return null; + } + public set autoPublishChannels(value: Snowflake[]) {} + + /** + * Channels where the bot won't respond in. + */ + public get blacklistedChannels(): Snowflake[] { + return null; + } + public set blacklistedChannels(value: Snowflake[]) {} + + /** + * Users that the bot ignores in this guild + */ + public get blacklistedUsers(): Snowflake[] { + return null; + } + public set blacklistedUsers(value: Snowflake[]) {} + + /** + * The channels where the welcome messages are sent + */ + public get welcomeChannel(): Snowflake { + return null; + } + public set welcomeChannel(value: Snowflake) {} + + /** + * The role given out when muting someone + */ + public get muteRole(): Snowflake { + return null; + } + public set muteRole(value: Snowflake) {} + + /** + * The message that gets sent after someone gets a punishment dm + */ + public get punishmentEnding(): string { + return null; + } + public set punishmentEnding(value: string) {} + + /** + * Guild specific disabled commands + */ + public get disabledCommands(): string[] { + return null; + } + public set disabledCommands(value: string[]) {} + + /** + * Channels that should get locked down when the lockdown command gets used. + */ + public get lockdownChannels(): Snowflake[] { + return null; + } + public set lockdownChannels(value: Snowflake[]) {} + + /** + * Custom automod phases + */ + public get autoModPhases(): string[] { + return null; + } + public set autoModPhases(value: string[]) {} static initModel(sequelize: Sequelize, client: BushClient): void { Guild.init( diff --git a/src/lib/models/Level.ts b/src/lib/models/Level.ts index 755b1c6..d8b98bf 100644 --- a/src/lib/models/Level.ts +++ b/src/lib/models/Level.ts @@ -18,16 +18,28 @@ export class Level extends BaseModel<LevelModel, LevelModelCreationAttributes> { /** * The user's id. */ - public user: Snowflake; + public get user(): Snowflake { + return null; + } + public set user(value: Snowflake) {} + /** * The guild where the user is gaining xp. */ - public guild: Snowflake; + public get guild(): Snowflake { + return null; + } + public set guild(value: Snowflake) {} + /** * The user's xp. */ - public xp: number; - get level(): number { + public get xp(): number { + return null; + } + public set xp(value: number) {} + + public get level(): number { return Level.convertXpToLevel(this.xp); } diff --git a/src/lib/models/ModLog.ts b/src/lib/models/ModLog.ts index 3375751..6933432 100644 --- a/src/lib/models/ModLog.ts +++ b/src/lib/models/ModLog.ts @@ -44,31 +44,58 @@ export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes /** * The primary key of the modlog entry. */ - id: string; + public get id(): string { + return null; + } + public set id(value: string) {} + /** * The type of punishment. */ - type: ModLogType; + public get type(): ModLogType { + return null; + } + public set type(value: ModLogType) {} + /** * The user being punished. */ - user: Snowflake; + public get user(): Snowflake { + return null; + } + public set user(value: Snowflake) {} + /** * The user carrying out the punishment. */ - moderator: Snowflake; + public get moderator(): Snowflake { + return null; + } + public set moderator(value: Snowflake) {} + /** * The reason the user is getting punished */ - reason: string | null; + public get reason(): string | null { + return null; + } + public set reason(value: string | null) {} + /** * The amount of time the user is getting punished for. */ - duration: number | null; + public get duration(): number | null { + return null; + } + public set duration(value: number | null) {} + /** * The guild the user is getting punished in. */ - guild: Snowflake; + public get guild(): Snowflake { + return null; + } + public set guild(value: Snowflake) {} static initModel(sequelize: Sequelize): void { ModLog.init( diff --git a/src/lib/models/StickyRole.ts b/src/lib/models/StickyRole.ts index a3928e7..c71ecb7 100644 --- a/src/lib/models/StickyRole.ts +++ b/src/lib/models/StickyRole.ts @@ -14,9 +14,31 @@ export interface StickyRoleModelCreationAttributes { } export class StickyRole extends BaseModel<StickyRoleModel, StickyRoleModelCreationAttributes> implements StickyRoleModel { - user: Snowflake; - guild: Snowflake; - roles: Snowflake[]; + /** + * The id of the user the roles belongs to + */ + + public get user(): Snowflake { + return null; + } + public set user(value: Snowflake) {} + + /** + * The guild where this should happen + */ + public get guild(): Snowflake { + return null; + } + public set guild(value: Snowflake) {} + + /** + * The roles that the user should have returned + */ + public get roles(): Snowflake[] { + return null; + } + public set roles(value: Snowflake[]) {} + static initModel(sequelize: Sequelize): void { StickyRole.init( { |