Jarvo
Jarvo
Explore posts from servers
SIASapphire - Imagine a framework
Created by Jarvo on 1/21/2024 in #sapphire-support
interaction.options.getMember() not definable?
Somehow interaction.options.getMember() is not valid... While on the Discord.js docs it is. I already made Member to be outputted to a message, and it says @Jarvo, so it should be correct...
import { Command } from "@sapphire/framework";

export class RenameCommand extends Command {
public constructor(context: Command.LoaderContext, options: Command.Options) {
super(context, {
...options,
});
}
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder
.setName("setnickname")
.setDescription("Let the bot rename someone")
.addUserOption(option =>
option.setName('member')
.setDescription('For what member is it?')
.setRequired(true)
)
.addStringOption(option =>
option.setName('name')
.setDescription('What will their new name be?')
.setRequired(true)
);
);
}

public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
const Member = interaction.options.getMember('member')
const NewName = interaction.options.getString('name')

await interaction.reply({ content: `Done!`, ephemeral: true})
}
};
import { Command } from "@sapphire/framework";

export class RenameCommand extends Command {
public constructor(context: Command.LoaderContext, options: Command.Options) {
super(context, {
...options,
});
}
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder
.setName("setnickname")
.setDescription("Let the bot rename someone")
.addUserOption(option =>
option.setName('member')
.setDescription('For what member is it?')
.setRequired(true)
)
.addStringOption(option =>
option.setName('name')
.setDescription('What will their new name be?')
.setRequired(true)
);
);
}

public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
const Member = interaction.options.getMember('member')
const NewName = interaction.options.getString('name')

await interaction.reply({ content: `Done!`, ephemeral: true})
}
};
17 replies
SIASapphire - Imagine a framework
Created by Jarvo on 1/20/2024 in #sapphire-support
Clear Command Cache?
Since the other one removed his message... How to clear the cache using Sapphire?
11 replies
SIASapphire - Imagine a framework
Created by Jarvo on 1/19/2024 in #sapphire-support
InteractionHandler Buttons
I have a problem with my buttons. Somehow they don't work... I guess it's something easy, but I can't figure out what it could be. The buttons are in a folder named interaction-handler/Buttons The error I am getting is:
[ERROR] Encountered error while handling an interaction handler run method for interaction-handler "CancelSetup" at path "C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\src\interaction-handlers\Buttons\Setup\CancelSetup p.ts" Error [InteractionNotReplied]: The reply to this interaction has not been sent or deferred.
at ButtonInteraction.editReply (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:157:48)
at ButtonHandler.run (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\src\interaction-handlers\Buttons\Setup\CancelSetup.ts:27:23)
at C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\framework\src\lib\structures\InteractionHandlerStore.ts:47:29
at Object.fromAsync (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\result\src\lib\Result.ts:53:25)
at Object.some (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\framework\src\lib\structures\InteractionHandlerStore.ts:47:29)
at _OptionSome.match (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\result\src\lib\Option\Some.ts:181:26)
at Object.ok (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\framework\src\lib\structures\InteractionHandlerStore.ts:33:19)
at _ResultOk.match (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\result\src\lib\Result\Ok.ts:188:26)
at _InteractionHandlerStore.run (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\framework\src\lib\structures\InteractionHandlerStore.ts:29:10)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'InteractionNotReplied'
}
[ERROR] Encountered error while handling an interaction handler run method for interaction-handler "CancelSetup" at path "C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\src\interaction-handlers\Buttons\Setup\CancelSetup p.ts" Error [InteractionNotReplied]: The reply to this interaction has not been sent or deferred.
at ButtonInteraction.editReply (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:157:48)
at ButtonHandler.run (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\src\interaction-handlers\Buttons\Setup\CancelSetup.ts:27:23)
at C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\framework\src\lib\structures\InteractionHandlerStore.ts:47:29
at Object.fromAsync (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\result\src\lib\Result.ts:53:25)
at Object.some (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\framework\src\lib\structures\InteractionHandlerStore.ts:47:29)
at _OptionSome.match (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\result\src\lib\Option\Some.ts:181:26)
at Object.ok (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\framework\src\lib\structures\InteractionHandlerStore.ts:33:19)
at _ResultOk.match (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\result\src\lib\Result\Ok.ts:188:26)
at _InteractionHandlerStore.run (C:\Users\ItzEx\OneDrive\Desktop\Projects\TicketPulse\node_modules\@sapphire\framework\src\lib\structures\InteractionHandlerStore.ts:29:10)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'InteractionNotReplied'
}
10 replies
SIASapphire - Imagine a framework
Created by Jarvo on 1/18/2024 in #sapphire-support
Need help for ContextMenuCommand
I have the below code:
import { PaginatedMessage } from "@sapphire/discord.js-utilities";
import { Command } from "@sapphire/framework";
import { config } from "../../utils/config";
import { ApplicationCommandType, Colors } from "discord.js";

export class UserinfoCommand extends Command {
public constructor(context: Command.LoaderContext, options: Command.Options) {
super(context, { ...options });
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerContextMenuCommand((builder) =>
builder //
.setName('Userinfo')
.setType(ApplicationCommandType.User)
);
}

public async contextMenuRun(interaction: Command.ContextMenuCommandInteraction) {
const User = interaction.user
let Botted = "No"
if(User.bot) Botted = "Yes"
console.log(User.hexAccentColor)

new PaginatedMessage()
.addPageEmbed((embed) => {
embed
.setAuthor({ name: User.displayName, iconURL: User.displayAvatarURL({ forceStatic: true }), url: `https://discord.com/users/${User.id}` })
.setColor(User.hexAccentColor)
.setTitle("General Userinfo")
.addFields([
{
name: "DisplayName",
value: User.displayName,
inline: true
},
{
name: "Username",
value: User.username,
inline: true
},
{
name: "Botted User?",
value: Botted,
inline: true
},
{
name: "Created Time",
value: `<t:${User.createdTimestamp}> (<t:${User.createdTimestamp}:R>)`,
inline: true
},
])

return embed;
})
.addPageEmbed((embed) => {
embed
.setColor(Colors.Blurple)
.setTitle("Information")
.setDescription(``);

return embed;
})
.addPageEmbed((embed) => {
embed
.setColor(Colors.Blurple)
.setTitle("Command List")
.setDescription(``);

return embed;
})
.addPageEmbed((embed) => {
embed
.setColor(Colors.Blurple)
.setTitle("Important Links")
.setDescription(``);

return embed;
})
.run(interaction, interaction.user);
}
};
import { PaginatedMessage } from "@sapphire/discord.js-utilities";
import { Command } from "@sapphire/framework";
import { config } from "../../utils/config";
import { ApplicationCommandType, Colors } from "discord.js";

export class UserinfoCommand extends Command {
public constructor(context: Command.LoaderContext, options: Command.Options) {
super(context, { ...options });
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerContextMenuCommand((builder) =>
builder //
.setName('Userinfo')
.setType(ApplicationCommandType.User)
);
}

public async contextMenuRun(interaction: Command.ContextMenuCommandInteraction) {
const User = interaction.user
let Botted = "No"
if(User.bot) Botted = "Yes"
console.log(User.hexAccentColor)

new PaginatedMessage()
.addPageEmbed((embed) => {
embed
.setAuthor({ name: User.displayName, iconURL: User.displayAvatarURL({ forceStatic: true }), url: `https://discord.com/users/${User.id}` })
.setColor(User.hexAccentColor)
.setTitle("General Userinfo")
.addFields([
{
name: "DisplayName",
value: User.displayName,
inline: true
},
{
name: "Username",
value: User.username,
inline: true
},
{
name: "Botted User?",
value: Botted,
inline: true
},
{
name: "Created Time",
value: `<t:${User.createdTimestamp}> (<t:${User.createdTimestamp}:R>)`,
inline: true
},
])

return embed;
})
.addPageEmbed((embed) => {
embed
.setColor(Colors.Blurple)
.setTitle("Information")
.setDescription(``);

return embed;
})
.addPageEmbed((embed) => {
embed
.setColor(Colors.Blurple)
.setTitle("Command List")
.setDescription(``);

return embed;
})
.addPageEmbed((embed) => {
embed
.setColor(Colors.Blurple)
.setTitle("Important Links")
.setDescription(``);

return embed;
})
.run(interaction, interaction.user);
}
};
And it errors on the
.run(interaction, interaction.user)
.run(interaction, interaction.user)
part. What's the cause and how to fix it?
49 replies