Skip to content

Commit bb33c70

Browse files
TibixDevADKaster
authored andcommitted
Fix: Some TS errors that originate from migrating to a newer version of Discord.js or null checks, remove some unnecessary imports
1 parent 00849c5 commit bb33c70

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

src/commands/command.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
*/
66

77
import {
8-
ApplicationCommandData,
98
ButtonInteraction,
109
ChatInputCommandInteraction,
1110
ContextMenuCommandInteraction,
11+
RESTPostAPIApplicationCommandsJSONBody,
1212
SelectMenuInteraction,
1313
} from "discord.js";
1414

@@ -22,7 +22,7 @@ export default abstract class Command {
2222

2323
handleButton?(interaction: ButtonInteraction): Promise<void>;
2424

25-
abstract data(): ApplicationCommandData[];
25+
abstract data(): RESTPostAPIApplicationCommandsJSONBody[];
2626

2727
buttonData?(): Array<string>;
2828
}

src/commands/commitStatsCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ export class CommitStatsCommand extends Command {
131131
.addFields(
132132
...userCommits
133133
.slice(0, 3)
134-
.filter(({ totalCount }) => totalCount! > 0)
134+
.filter(({ totalCount }) => totalCount !== undefined && totalCount > 0)
135135
.map(({ repo, commits, totalCount }, index) => ({
136136
name: `${toMedal(index + 1)} **${repo.owner}/${
137137
repo.name
138138
}** - **${totalCount?.toLocaleString("en-US")} commit${
139-
totalCount! > 1 ? "s" : ""
139+
totalCount > 1 ? "s" : ""
140140
}**`,
141141
value: [
142142
...commits

src/commands/githubCommand.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
import {
8-
ApplicationCommandData,
98
ChatInputCommandInteraction,
109
SlashCommandBuilder,
1110
TextChannel,
@@ -190,7 +189,7 @@ export class GithubCommand extends Command {
190189
}
191190

192191
export class ReviewList extends Command {
193-
override data(): ApplicationCommandData[] {
192+
override data() {
194193
const aliases = ["reviewlist", "prlist"];
195194

196195
const baseCommand = new SlashCommandBuilder()

src/commands/quickLinksCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: BSD-2-Clause
55
*/
66

7-
import { ApplicationCommandData, ChatInputCommandInteraction } from "discord.js";
7+
import { ChatInputCommandInteraction } from "discord.js";
88
import Command from "./command";
99

1010
export class QuickLinksCommand extends Command {
@@ -92,7 +92,7 @@ export class QuickLinksCommand extends Command {
9292
},
9393
];
9494

95-
override data(): ApplicationCommandData[] {
95+
override data() {
9696
return this.links.map(link => ({
9797
name: link.name,
9898
description: link.help,

0 commit comments

Comments
 (0)