From 8d8343543d82034c184ab4ac7ed5e65215020521 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sat, 10 Aug 2019 01:47:45 +0300 Subject: [PATCH] Fix userid/channelid argument types; rename userid/userID to userId for consistency; misc code style fix --- src/plugins/AutoReactionsPlugin.ts | 4 ++-- src/plugins/LocateUser.ts | 16 ++++++++-------- src/plugins/NameHistory.ts | 4 ++-- src/plugins/PingableRolesPlugin.ts | 4 ++-- src/plugins/Starboard.ts | 4 ++-- src/plugins/Utility.ts | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/plugins/AutoReactionsPlugin.ts b/src/plugins/AutoReactionsPlugin.ts index e937dc7d..c8cfe67a 100644 --- a/src/plugins/AutoReactionsPlugin.ts +++ b/src/plugins/AutoReactionsPlugin.ts @@ -49,7 +49,7 @@ export class AutoReactionsPlugin extends ZeppelinPlugin { this.savedMessages.events.off("create", this.onMessageCreateFn); } - @d.command("auto_reactions", " ") + @d.command("auto_reactions", " ") @d.permission("can_manage") async setAutoReactionsCmd(msg: Message, args: { channelId: string; reactions: string[] }) { const finalReactions = []; @@ -83,7 +83,7 @@ export class AutoReactionsPlugin extends ZeppelinPlugin { msg.channel.createMessage(successMessage(`Auto-reactions set for <#${args.channelId}>`)); } - @d.command("auto_reactions disable", "") + @d.command("auto_reactions disable", "") @d.permission("can_manage") async disableAutoReactionsCmd(msg: Message, args: { channelId: string }) { const autoReaction = await this.autoReactions.getForChannel(args.channelId); diff --git a/src/plugins/LocateUser.ts b/src/plugins/LocateUser.ts index 59d0d612..ada922aa 100644 --- a/src/plugins/LocateUser.ts +++ b/src/plugins/LocateUser.ts @@ -52,7 +52,7 @@ export class LocatePlugin extends ZeppelinPlugin { for (const alert of outdatedAlerts) { await this.alerts.delete(alert.id); - await this.removeUserIDFromActiveAlerts(alert.user_id); + await this.removeUserIdFromActiveAlerts(alert.user_id); } this.outdatedAlertsTimeout = setTimeout(() => this.outdatedAlertsLoop(), ALERT_LOOP_TIME); @@ -137,7 +137,7 @@ export class LocatePlugin extends ZeppelinPlugin { async userJoinedVC(member: Member, channel: Channel) { if (this.usersWithAlerts.includes(member.id)) { this.sendAlerts(member.id); - await this.removeUserIDFromActiveAlerts(member.id); + await this.removeUserIdFromActiveAlerts(member.id); } } @@ -145,7 +145,7 @@ export class LocatePlugin extends ZeppelinPlugin { async userSwitchedVC(member: Member, newChannel: Channel, oldChannel: Channel) { if (this.usersWithAlerts.includes(member.id)) { this.sendAlerts(member.id); - await this.removeUserIDFromActiveAlerts(member.id); + await this.removeUserIdFromActiveAlerts(member.id); } } @@ -157,9 +157,9 @@ export class LocatePlugin extends ZeppelinPlugin { }); } - async sendAlerts(userid: string) { - const triggeredAlerts = await this.alerts.getAlertsByUserId(userid); - const member = await resolveMember(this.bot, this.guild, userid); + async sendAlerts(userId: string) { + const triggeredAlerts = await this.alerts.getAlertsByUserId(userId); + const member = await resolveMember(this.bot, this.guild, userId); triggeredAlerts.forEach(alert => { const prepend = `<@!${alert.requestor_id}>, an alert requested by you has triggered!\nReminder: \`${ @@ -170,8 +170,8 @@ export class LocatePlugin extends ZeppelinPlugin { }); } - async removeUserIDFromActiveAlerts(userid: string) { - const index = this.usersWithAlerts.indexOf(userid); + async removeUserIdFromActiveAlerts(userId: string) { + const index = this.usersWithAlerts.indexOf(userId); if (index > -1) { this.usersWithAlerts.splice(index, 1); } diff --git a/src/plugins/NameHistory.ts b/src/plugins/NameHistory.ts index d869b04e..673372d5 100644 --- a/src/plugins/NameHistory.ts +++ b/src/plugins/NameHistory.ts @@ -40,7 +40,7 @@ export class NameHistoryPlugin extends ZeppelinPlugin { this.usernameHistory = new UsernameHistory(); } - @d.command("names", "") + @d.command("names", "") @d.permission("can_view") async namesCmd(msg: Message, args: { userId: string }) { const nicknames = await this.nicknameHistory.getByUserId(args.userId); @@ -72,7 +72,7 @@ export class NameHistoryPlugin extends ZeppelinPlugin { @d.event("guildMemberUpdate") async onGuildMemberUpdate(_, member: Member) { const latestEntry = await this.nicknameHistory.getLastEntry(member.id); - if (!latestEntry || latestEntry.nickname != member.nick) { + if (!latestEntry || latestEntry.nickname !== member.nick) { // tslint:disable-line await this.nicknameHistory.addEntry(member.id, member.nick); } diff --git a/src/plugins/PingableRolesPlugin.ts b/src/plugins/PingableRolesPlugin.ts index 7638c976..7c3fff54 100644 --- a/src/plugins/PingableRolesPlugin.ts +++ b/src/plugins/PingableRolesPlugin.ts @@ -53,7 +53,7 @@ export class PingableRolesPlugin extends ZeppelinPlugin { return this.cache.get(channelId); } - @d.command("pingable_role disable", " ") + @d.command("pingable_role disable", " ") @d.permission("can_manage") async disablePingableRoleCmd(msg: Message, args: { channelId: string; role: Role }) { const pingableRole = await this.pingableRoles.getByChannelAndRoleId(args.channelId, args.role.id); @@ -70,7 +70,7 @@ export class PingableRolesPlugin extends ZeppelinPlugin { ); } - @d.command("pingable_role", " ") + @d.command("pingable_role", " ") @d.permission("can_manage") async setPingableRoleCmd(msg: Message, args: { channelId: string; role: Role }) { const existingPingableRole = await this.pingableRoles.getByChannelAndRoleId(args.channelId, args.role.id); diff --git a/src/plugins/Starboard.ts b/src/plugins/Starboard.ts index 02af31e8..dcf637a6 100644 --- a/src/plugins/Starboard.ts +++ b/src/plugins/Starboard.ts @@ -177,7 +177,7 @@ export class StarboardPlugin extends ZeppelinPlugin { /** * Deletes the starboard from the specified channel. The already-posted starboard messages are retained. */ - @d.command("starboard delete", "") + @d.command("starboard delete", "") @d.permission("can_manage") async deleteCmd(msg: Message, args: { channelId: string }) { const starboard = await this.starboards.getStarboardByChannelId(args.channelId); @@ -336,7 +336,7 @@ export class StarboardPlugin extends ZeppelinPlugin { } } - @d.command("starboard migrate_pins", " ") + @d.command("starboard migrate_pins", " ") async migratePinsCmd(msg: Message, args: { pinChannelId: string; starboardChannelId }) { const starboard = await this.starboards.getStarboardByChannelId(args.starboardChannelId); if (!starboard) { diff --git a/src/plugins/Utility.ts b/src/plugins/Utility.ts index be5be4e4..1e66c80f 100644 --- a/src/plugins/Utility.ts +++ b/src/plugins/Utility.ts @@ -554,7 +554,7 @@ export class UtilityPlugin extends ZeppelinPlugin { }, CLEAN_COMMAND_DELETE_DELAY); } - @d.command("clean user", " ") + @d.command("clean user", " ") @d.permission("can_clean") async cleanUserCmd(msg: Message, args: { userId: string; count: number }) { if (args.count > MAX_CLEAN_COUNT || args.count <= 0) {