Skip to content

Commit 9c8afe1

Browse files
committed
fix: fixed type errors
1 parent cd947d3 commit 9c8afe1

File tree

8 files changed

+29
-18
lines changed

8 files changed

+29
-18
lines changed

src/commands/Utility/nick.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class UserCommand extends RadonCommand {
2929
}
3030
}
3131

32-
public override async contextMenuRun(interaction: RadonCommand.ContextMenuCommandInteraction) {
32+
public override async contextMenuRun(interaction: RadonCommand.UserContextMenuCommandInteraction) {
3333
return this.decancer(interaction);
3434
}
3535

@@ -141,7 +141,7 @@ export class UserCommand extends RadonCommand {
141141
);
142142
}
143143

144-
private async decancer(interaction: RadonCommand.ChatInputCommandInteraction | RadonCommand.ContextMenuCommandInteraction) {
144+
private async decancer(interaction: RadonCommand.ChatInputCommandInteraction | RadonCommand.UserContextMenuCommandInteraction) {
145145
const member = interaction.options.getMember('target') ?? interaction.options.getMember('user');
146146
if (!member) {
147147
return interaction.reply({
@@ -173,7 +173,10 @@ export class UserCommand extends RadonCommand {
173173
});
174174
}
175175
await member.setNickname(nickname, reason);
176-
return interaction.reply(`${member.user.tag}'s display name has been decancered!`);
176+
return interaction.reply({
177+
content: `Nickname \`${nickname}\` set for ${member} [DECANCER]`,
178+
flags: interaction.isContextMenuCommand() ? MessageFlags.Ephemeral : undefined
179+
});
177180
}
178181

179182
private async set(interaction: RadonCommand.ChatInputCommandInteraction) {

src/lib/structures/classes/Confirmation.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import {
55
ButtonInteraction,
66
ButtonStyle,
77
ChatInputCommandInteraction,
8-
Collection,
98
type ColorResolvable,
109
type ComponentEmojiResolvable,
1110
ComponentType,
1211
Message,
12+
MessageFlags,
13+
ReadonlyCollection,
1314
User
1415
} from 'discord.js';
1516
import { Button } from './Button.js';
@@ -75,19 +76,21 @@ export class Confirmation {
7576
row._components(this.buttons);
7677
let msg: Message<boolean>;
7778
if (message instanceof Message) {
79+
if (!message.channel.isSendable()) return;
7880
msg = await message.channel.send({
7981
content: this.options.content,
8082
embeds: this.options?.content ? [] : [embed],
8183
components: [row]
8284
});
8385
} else {
84-
msg = (await message.reply({
86+
const interactionResponse = await message.reply({
8587
content: this.options.content,
8688
embeds: this.options?.content ? [] : [embed],
8789
components: [row],
88-
fetchReply: true,
89-
ephemeral: this.options.ephemeral
90-
})) as Message;
90+
withResponse: true,
91+
flags: this.options.ephemeral ? MessageFlags.Ephemeral : undefined
92+
});
93+
msg = message.channel?.messages.cache.get(interactionResponse.interaction.responseMessageId!) as Message<boolean>;
9194
}
9295

9396
const collector = msg.createMessageComponentCollector({
@@ -174,7 +177,7 @@ interface payload {
174177
}
175178

176179
interface endPayload {
177-
collection: Collection<string, ButtonInteraction>;
180+
collection: ReadonlyCollection<string, ButtonInteraction>;
178181
msg: Message;
179182
}
180183

src/lib/utility/functions/formatter.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const order: Record<PermissionsString, number> = {
6666
SendTTSMessages: 10,
6767
UseVAD: 11,
6868
UseExternalSounds: 11,
69+
UseExternalApps: 11,
6970
ChangeNickname: 12,
7071
UseApplicationCommands: 13,
7172
RequestToSpeak: 14,
@@ -76,6 +77,8 @@ const order: Record<PermissionsString, number> = {
7677
ManageThreads: 20,
7778
MoveMembers: 20,
7879
MuteMembers: 20,
80+
CreateEvents: 20,
81+
CreateGuildExpressions: 20,
7982
ManageEmojisAndStickers: 21,
8083
ManageGuildExpressions: 21,
8184
ManageEvents: 21,
@@ -91,5 +94,6 @@ const order: Record<PermissionsString, number> = {
9194
ManageGuild: 31,
9295
MentionEveryone: 32,
9396
ViewCreatorMonetizationAnalytics: 33,
94-
Administrator: 40
97+
Administrator: 40,
98+
SendPolls: 41
9599
};

src/preconditions/Administrator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import type { GuildMessage } from '#lib/types';
33
import { isAdmin } from '#lib/utility';
44

55
export class UserPermissionsPrecondition extends PermissionsPrecondition {
6-
public override async handle(message: GuildMessage): PermissionsPrecondition.AsyncResult {
7-
const roles = (await message.guild.settings?.roles.admins) ?? [];
6+
public override async handle(message: GuildMessage<boolean>): PermissionsPrecondition.AsyncResult {
7+
const roles = (await message.guild?.settings?.roles.admins) ?? [];
88
const allowed = isAdmin(message.member) || message.member.roles.cache.some((r) => roles.includes(r.id));
99

1010
return allowed

src/preconditions/BotOwner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { type AsyncPreconditionResult, Precondition } from '@sapphire/framework'
44
import type { ChatInputCommandInteraction } from 'discord.js';
55

66
export class UserPrecondition extends Precondition {
7-
public override async messageRun(message: GuildMessage) {
7+
public override async messageRun(message: GuildMessage<boolean>) {
88
return this.isBotOwner(message.author.id);
99
}
1010

src/preconditions/Community.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { Precondition, type AsyncPreconditionResult } from '@sapphire/framework'
33
import type { ChatInputCommandInteraction, Guild } from 'discord.js';
44

55
export class UserPrecondition extends Precondition {
6-
public override async messageRun(message: GuildMessage) {
6+
public override async messageRun(message: GuildMessage<boolean>) {
7+
if (!message.guild) return this.error({ message: 'This command can only be used in a community server.' });
78
return this.isCommunity(message.guild);
89
}
910

src/preconditions/Moderator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import type { GuildMessage } from '#lib/types';
33
import { isAdmin, isModerator } from '#lib/utility';
44

55
export class UserPermissionsPrecondition extends PermissionsPrecondition {
6-
public override async handle(message: GuildMessage): PermissionsPrecondition.AsyncResult {
7-
const modRoles = (await message.guild.settings?.roles.mods) ?? [];
8-
const adminRoles = (await message.guild.settings?.roles.admins) ?? [];
6+
public override async handle(message: GuildMessage<boolean>): PermissionsPrecondition.AsyncResult {
7+
const modRoles = (await message.guild?.settings?.roles.mods) ?? [];
8+
const adminRoles = (await message.guild?.settings?.roles.admins) ?? [];
99
const allowed =
1010
isAdmin(message.member) ||
1111
isModerator(message.member) ||

src/preconditions/ServerOwner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { PermissionsPrecondition } from '#lib/structures';
22
import type { GuildMessage } from '#lib/types';
33

44
export class UserPermissionsPrecondition extends PermissionsPrecondition {
5-
public handle(message: GuildMessage): PermissionsPrecondition.Result {
5+
public handle(message: GuildMessage<true>): PermissionsPrecondition.Result {
66
return message.author.id === message.guild.ownerId
77
? this.ok()
88
: this.error({

0 commit comments

Comments
 (0)