aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-04 14:08:09 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-04 14:08:09 -0500
commitd5d5fd6f77f2d778ab099d52f1acaad762712822 (patch)
treeababfba81c28c102b932e2713c1614260a424285 /src
parente5bc336f9586b1f5515be3f1d239d2194489e9c5 (diff)
downloadtanzanite-d5d5fd6f77f2d778ab099d52f1acaad762712822.tar.gz
tanzanite-d5d5fd6f77f2d778ab099d52f1acaad762712822.tar.bz2
tanzanite-d5d5fd6f77f2d778ab099d52f1acaad762712822.zip
explicit member accessibility & jsdocs & typings
Diffstat (limited to 'src')
-rw-r--r--src/commands/config/config.ts4
-rw-r--r--src/commands/dev/superUser.ts2
-rw-r--r--src/commands/info/avatar.ts4
-rw-r--r--src/commands/info/icon.ts4
-rw-r--r--src/commands/info/pronouns.ts2
-rw-r--r--src/commands/moderation/evidence.ts2
-rw-r--r--src/commands/moderation/role.ts6
-rw-r--r--src/commands/utilities/activity.ts6
-rw-r--r--src/commands/utilities/steal.ts4
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts4
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts6
-rw-r--r--src/lib/extensions/discord-akairo/BushListenerHandler.ts2
-rw-r--r--src/lib/models/instance/ActivePunishment.ts5
-rw-r--r--src/lib/models/instance/Guild.ts3
-rw-r--r--src/lib/models/instance/Level.ts3
-rw-r--r--src/lib/models/instance/ModLog.ts3
-rw-r--r--src/lib/models/instance/Reminder.ts3
-rw-r--r--src/lib/models/instance/StickyRole.ts3
-rw-r--r--src/lib/models/shared/Global.ts3
-rw-r--r--src/lib/models/shared/Shared.ts3
-rw-r--r--src/lib/models/shared/Stat.ts3
-rw-r--r--src/lib/utils/CanvasProgressBar.ts8
-rw-r--r--src/listeners/commands/commandError.ts2
23 files changed, 56 insertions, 29 deletions
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index 580f8d2..2fae2fd 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -9,7 +9,7 @@ import {
type GuildSettingType
} from '#lib';
import assert from 'assert';
-import { SlashOption, type ArgumentOptions, type Flag } from 'discord-akairo';
+import { type ArgumentGeneratorReturn, type SlashOption } from 'discord-akairo';
import {
ActionRow,
ApplicationCommandOptionType,
@@ -130,7 +130,7 @@ export default class ConfigCommand extends BushCommand {
});
}
- public override *args(message: BushMessage): Generator<ArgumentOptions | Flag, any, any> {
+ public override *args(message: BushMessage): ArgumentGeneratorReturn {
const optional = message.util.parsed!.alias === 'settings';
const setting: GuildSettings = yield {
id: 'setting',
diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts
index 7b75672..b184f6f 100644
--- a/src/commands/dev/superUser.ts
+++ b/src/commands/dev/superUser.ts
@@ -31,7 +31,7 @@ export default class SuperUserCommand extends BushCommand {
});
}
- override *args(): ArgumentGeneratorReturn {
+ public override *args(): ArgumentGeneratorReturn {
const action: 'add' | 'remove' = yield {
id: 'action',
type: ['add', 'remove'],
diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts
index 0ea9179..6b4afa1 100644
--- a/src/commands/info/avatar.ts
+++ b/src/commands/info/avatar.ts
@@ -2,7 +2,7 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } fr
import { ApplicationCommandOptionType, Embed, GuildMember, PermissionFlagsBits } from 'discord.js';
export default class AvatarCommand extends BushCommand {
- constructor() {
+ public constructor() {
super('avatar', {
aliases: ['avatar', 'av'],
category: 'info',
@@ -27,7 +27,7 @@ export default class AvatarCommand extends BushCommand {
});
}
- override async exec(message: BushMessage | BushSlashMessage, args: { user: ArgType<'member'> | ArgType<'globalUser'> }) {
+ public override async exec(message: BushMessage | BushSlashMessage, args: { user: ArgType<'member'> | ArgType<'globalUser'> }) {
const params: { size: 2048; extension: 'png'; dynamic: true } = { size: 2048, extension: 'png', dynamic: true };
const defaultAvatar = `https://cdn.discordapp.com/embed/avatars/${Math.ceil(Math.random() * 6) - 1}.png`;
diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts
index b40b814..2b5b8fb 100644
--- a/src/commands/info/icon.ts
+++ b/src/commands/info/icon.ts
@@ -2,7 +2,7 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import { Embed, PermissionFlagsBits } from 'discord.js';
export default class IconCommand extends BushCommand {
- constructor() {
+ public constructor() {
super('icon', {
aliases: ['icon', 'guildavatar', 'severicon', 'guildicon'],
category: 'info',
@@ -16,7 +16,7 @@ export default class IconCommand extends BushCommand {
});
}
- override async exec(message: BushMessage | BushSlashMessage) {
+ public override async exec(message: BushMessage | BushSlashMessage) {
const embed = new Embed()
.setTimestamp()
.setColor(util.colors.default)
diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts
index 652881b..3eccd85 100644
--- a/src/commands/info/pronouns.ts
+++ b/src/commands/info/pronouns.ts
@@ -26,7 +26,7 @@ export default class PronounsCommand extends BushCommand {
});
}
- override async exec(message: BushMessage | BushSlashMessage, args: { user?: ArgType<'globalUser'> }) {
+ public override async exec(message: BushMessage | BushSlashMessage, args: { user?: ArgType<'globalUser'> }) {
const user = args.user ?? message.author;
const author = user.id === message.author.id;
diff --git a/src/commands/moderation/evidence.ts b/src/commands/moderation/evidence.ts
index d951f3d..444a173 100644
--- a/src/commands/moderation/evidence.ts
+++ b/src/commands/moderation/evidence.ts
@@ -36,7 +36,7 @@ export default class EvidenceCommand extends BushCommand {
});
}
- override *args(message: BushMessage): ArgumentGeneratorReturn {
+ public override *args(message: BushMessage): ArgumentGeneratorReturn {
const case_id: ArgumentTypeCasterReturn<'string'> = yield {
id: 'case_id',
type: 'string',
diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts
index b76795b..920ef81 100644
--- a/src/commands/moderation/role.ts
+++ b/src/commands/moderation/role.ts
@@ -8,7 +8,7 @@ import {
type BushSlashMessage,
type OptionalArgType
} from '#lib';
-import { type ArgumentOptions, type Flag } from 'discord-akairo';
+import { type ArgumentGeneratorReturn } from 'discord-akairo';
import { ApplicationCommandOptionType, PermissionFlagsBits, type Snowflake } from 'discord.js';
export default class RoleCommand extends BushCommand {
@@ -66,7 +66,7 @@ export default class RoleCommand extends BushCommand {
});
}
- public override *args(message: BushMessage): Generator<ArgumentOptions | Flag> {
+ public override *args(message: BushMessage): ArgumentGeneratorReturn {
const action = (['rr'] as const).includes(message.util.parsed?.alias ?? '')
? 'remove'
: (['ar', 'ra'] as const).includes(message.util.parsed?.alias ?? '')
@@ -211,7 +211,7 @@ export default class RoleCommand extends BushCommand {
await message.util.reply({ content: responseMessage(), allowedMentions: AllowedMentions.none() });
}
- punishmentRoleNames = [
+ private punishmentRoleNames = [
'No Files',
'No Links',
'No Threads',
diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts
index 52cad26..882c15d 100644
--- a/src/commands/utilities/activity.ts
+++ b/src/commands/utilities/activity.ts
@@ -1,5 +1,5 @@
import { BushCommand, type ArgType, type BushArgumentTypeCaster, type BushMessage, type BushSlashMessage } from '#lib';
-import { type ArgumentOptions, type ArgumentTypeCaster, type Flag } from 'discord-akairo';
+import { type ArgumentGeneratorReturn, type ArgumentTypeCaster } from 'discord-akairo';
import { ApplicationCommandOptionType, ChannelType, type DiscordAPIError, type Snowflake } from 'discord.js';
const activityMap = {
@@ -74,7 +74,7 @@ const activityTypeCaster: BushArgumentTypeCaster<Snowflake | null> = (message: B
};
export default class ActivityCommand extends BushCommand {
- constructor() {
+ public constructor() {
super('activity', {
aliases: ['activity', ...Object.values(activityMap).flatMap((a) => a.aliases)],
category: 'utilities',
@@ -120,7 +120,7 @@ export default class ActivityCommand extends BushCommand {
});
}
- public override *args(message: BushMessage): Generator<ArgumentOptions | Flag, any, any> {
+ public override *args(message: BushMessage): ArgumentGeneratorReturn {
const channel: ArgType<'voiceChannel'> = yield {
id: 'channel',
description: 'The channel to create the activity in.',
diff --git a/src/commands/utilities/steal.ts b/src/commands/utilities/steal.ts
index 820fa89..d603222 100644
--- a/src/commands/utilities/steal.ts
+++ b/src/commands/utilities/steal.ts
@@ -1,6 +1,6 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
import assert from 'assert';
-import { type ArgumentOptions, type ArgumentType, type ArgumentTypeCaster, type Flag } from 'discord-akairo';
+import { type ArgumentGeneratorReturn, type ArgumentType, type ArgumentTypeCaster } from 'discord-akairo';
import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
import _ from 'lodash';
import { URL } from 'url';
@@ -44,7 +44,7 @@ export default class StealCommand extends BushCommand {
});
}
- public override *args(message: BushMessage): Generator<ArgumentOptions | Flag> {
+ public override *args(message: BushMessage): ArgumentGeneratorReturn {
const hasImage = message.attachments.size && message.attachments.first()?.contentType?.includes('image/');
const emoji = hasImage
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts
index 0fc8896..eb1fe88 100644
--- a/src/lib/extensions/discord-akairo/BushClient.ts
+++ b/src/lib/extensions/discord-akairo/BushClient.ts
@@ -326,7 +326,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
/**
* Initializes the bot.
*/
- async init() {
+ public async init() {
if (!process.version.startsWith('v17.')) {
void (await this.console.error('version', `Please use node <<v17.x.x>>, not <<${process.version}>>.`, false));
process.exit(2);
@@ -394,7 +394,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
/**
* Connects to the database, initializes models, and creates tables if they do not exist.
*/
- async dbPreInit() {
+ public async dbPreInit() {
try {
await this.instanceDB.authenticate();
GuildModel.initModel(this.instanceDB, this);
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index 7026539..6889ae0 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -184,21 +184,21 @@ export class BushClientUtil extends ClientUtil {
/**
* Commonly Used Colors
*/
- get colors() {
+ public get colors() {
return client.consts.colors;
}
/**
* Commonly Used Emojis
*/
- get emojis() {
+ public get emojis() {
return client.consts.emojis;
}
/**
* Just the ids of Commonly Used Emojis
*/
- get emojisRaw() {
+ public get emojisRaw() {
return client.consts.emojisRaw;
}
diff --git a/src/lib/extensions/discord-akairo/BushListenerHandler.ts b/src/lib/extensions/discord-akairo/BushListenerHandler.ts
index 5a556c3..517fb55 100644
--- a/src/lib/extensions/discord-akairo/BushListenerHandler.ts
+++ b/src/lib/extensions/discord-akairo/BushListenerHandler.ts
@@ -2,5 +2,5 @@ import { type BushClient } from '#lib';
import { ListenerHandler } from 'discord-akairo';
export class BushListenerHandler extends ListenerHandler {
- declare client: BushClient;
+ public declare client: BushClient;
}
diff --git a/src/lib/models/instance/ActivePunishment.ts b/src/lib/models/instance/ActivePunishment.ts
index 1d6104f..38012ca 100644
--- a/src/lib/models/instance/ActivePunishment.ts
+++ b/src/lib/models/instance/ActivePunishment.ts
@@ -31,6 +31,9 @@ export interface ActivePunishmentModelCreationAttributes {
modlog: string;
}
+/**
+ * Keeps track of active punishments so they can be removed later.
+ */
export class ActivePunishment
extends BaseModel<ActivePunishmentModel, ActivePunishmentModelCreationAttributes>
implements ActivePunishmentModel
@@ -77,7 +80,7 @@ export class ActivePunishment
public static initModel(sequelize: Sequelize): void {
ActivePunishment.init(
{
- id: { type: DataTypes.STRING, primaryKey: true, allowNull: false, defaultValue: nanoid },
+ id: { type: DataTypes.STRING, primaryKey: true, defaultValue: nanoid },
type: { type: DataTypes.STRING, allowNull: false },
user: { type: DataTypes.STRING, allowNull: false },
guild: { type: DataTypes.STRING, allowNull: false, references: { model: 'Guilds', key: 'id' } },
diff --git a/src/lib/models/instance/Guild.ts b/src/lib/models/instance/Guild.ts
index 11469d2..b41eb9e 100644
--- a/src/lib/models/instance/Guild.ts
+++ b/src/lib/models/instance/Guild.ts
@@ -47,6 +47,9 @@ export interface GuildModelCreationAttributes {
levelUpChannel?: Snowflake;
}
+/**
+ * Settings for a guild.
+ */
export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> implements GuildModel {
/**
* The ID of the guild
diff --git a/src/lib/models/instance/Level.ts b/src/lib/models/instance/Level.ts
index e18753d..77bc3d4 100644
--- a/src/lib/models/instance/Level.ts
+++ b/src/lib/models/instance/Level.ts
@@ -15,6 +15,9 @@ export interface LevelModelCreationAttributes {
xp?: number;
}
+/**
+ * Leveling information for a user in a guild.
+ */
export class Level extends BaseModel<LevelModel, LevelModelCreationAttributes> implements LevelModel {
/**
* The user's id.
diff --git a/src/lib/models/instance/ModLog.ts b/src/lib/models/instance/ModLog.ts
index bcccbb4..c25f043 100644
--- a/src/lib/models/instance/ModLog.ts
+++ b/src/lib/models/instance/ModLog.ts
@@ -49,6 +49,9 @@ export interface ModLogModelCreationAttributes {
hidden?: boolean;
}
+/**
+ * A mod log case.
+ */
export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes> implements ModLogModel {
/**
* The primary key of the modlog entry.
diff --git a/src/lib/models/instance/Reminder.ts b/src/lib/models/instance/Reminder.ts
index 9ca78f1..964ea63 100644
--- a/src/lib/models/instance/Reminder.ts
+++ b/src/lib/models/instance/Reminder.ts
@@ -24,6 +24,9 @@ export interface ReminderModelCreationAttributes {
notified?: boolean;
}
+/**
+ * Represents a reminder the a user has set.
+ */
export class Reminder extends BaseModel<ReminderModel, ReminderModelCreationAttributes> implements ReminderModel {
/**
* The id of the reminder.
diff --git a/src/lib/models/instance/StickyRole.ts b/src/lib/models/instance/StickyRole.ts
index fb1c30d..00e98ce 100644
--- a/src/lib/models/instance/StickyRole.ts
+++ b/src/lib/models/instance/StickyRole.ts
@@ -16,6 +16,9 @@ export interface StickyRoleModelCreationAttributes {
nickname?: string;
}
+/**
+ * Information about a user's roles and nickname when they leave a guild.
+ */
export class StickyRole extends BaseModel<StickyRoleModel, StickyRoleModelCreationAttributes> implements StickyRoleModel {
/**
* The id of the user the roles belongs to.
diff --git a/src/lib/models/shared/Global.ts b/src/lib/models/shared/Global.ts
index 6dfc36f..b1aa0cc 100644
--- a/src/lib/models/shared/Global.ts
+++ b/src/lib/models/shared/Global.ts
@@ -19,6 +19,9 @@ export interface GlobalModelCreationAttributes {
blacklistedChannels?: Snowflake[];
}
+/**
+ * Data specific to a certain instance of the bot.
+ */
export class Global extends BaseModel<GlobalModel, GlobalModelCreationAttributes> implements GlobalModel {
/**
* The bot's environment.
diff --git a/src/lib/models/shared/Shared.ts b/src/lib/models/shared/Shared.ts
index 642ff85..4d13011 100644
--- a/src/lib/models/shared/Shared.ts
+++ b/src/lib/models/shared/Shared.ts
@@ -24,6 +24,9 @@ export interface SharedModelCreationAttributes {
autoBanCode?: string;
}
+/**
+ * Data shared between all bot instances.
+ */
export class Shared extends BaseModel<SharedModel, SharedModelCreationAttributes> implements SharedModel {
/**
* The primary key of the shared model.
diff --git a/src/lib/models/shared/Stat.ts b/src/lib/models/shared/Stat.ts
index 8f77b58..d138620 100644
--- a/src/lib/models/shared/Stat.ts
+++ b/src/lib/models/shared/Stat.ts
@@ -14,6 +14,9 @@ export interface StatModelCreationAttributes {
commandsUsed?: bigint;
}
+/**
+ * Statistics for each instance of the bot.
+ */
export class Stat extends BaseModel<StatModel, StatModelCreationAttributes> implements StatModel {
/**
* The bot's environment.
diff --git a/src/lib/utils/CanvasProgressBar.ts b/src/lib/utils/CanvasProgressBar.ts
index cd86532..1ba0e8b 100644
--- a/src/lib/utils/CanvasProgressBar.ts
+++ b/src/lib/utils/CanvasProgressBar.ts
@@ -22,7 +22,7 @@ export class CanvasProgressBar {
this.ctx = ctx;
}
- draw(): void {
+ public draw(): void {
// -----------------
this.p = this.percentage * this.w;
if (this.p <= this.h) {
@@ -57,7 +57,7 @@ export class CanvasProgressBar {
this.ctx.fill();
}
- // showWholeProgressBar(){
+ // public showWholeProgressBar(){
// this.ctx.beginPath();
// this.ctx.arc(this.h / 2 + this.x, this.h / 2 + this.y, this.h / 2, Math.PI / 2, 3 / 2 * Math.PI);
// this.ctx.lineTo(this.w - this.h + this.x, 0 + this.y);
@@ -68,11 +68,11 @@ export class CanvasProgressBar {
// this.ctx.closePath();
// }
- get PPercentage(): number {
+ public get PPercentage(): number {
return this.percentage * 100;
}
- set PPercentage(x: number) {
+ public set PPercentage(x: number) {
this.percentage = x / 100;
}
}
diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts
index 6f1c097..ba27706 100644
--- a/src/listeners/commands/commandError.ts
+++ b/src/listeners/commands/commandError.ts
@@ -222,7 +222,7 @@ export default class CommandErrorListener extends BushListener {
return ret;
}
- static async getErrorStack(error: Error | any): Promise<string> {
+ public static async getErrorStack(error: Error | any): Promise<string> {
return await util.inspectCleanRedactCodeblock(error?.stack ?? error, 'js');
}
}