aboutsummaryrefslogtreecommitdiff
path: root/src/lib
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/lib
parente5bc336f9586b1f5515be3f1d239d2194489e9c5 (diff)
downloadtanzanite-d5d5fd6f77f2d778ab099d52f1acaad762712822.tar.gz
tanzanite-d5d5fd6f77f2d778ab099d52f1acaad762712822.tar.bz2
tanzanite-d5d5fd6f77f2d778ab099d52f1acaad762712822.zip
explicit member accessibility & jsdocs & typings
Diffstat (limited to 'src/lib')
-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
13 files changed, 38 insertions, 11 deletions
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;
}
}