Ephemeral PaginatedMessages are unusable

https://ss.clanware.org/CdquvjYO.png It always says that it's someone else's message. @sapphire/framework@npm:4.7.2 @sapphire/discord.js-utilities@npm:7.0.2
Solution:
Unfollowing this because it's fixed in @sapphire/[email protected]
Jump to solution
48 Replies
Lioness100
Lioness100โ€ข13mo ago
Please show your code ๐Ÿ™‚
disclosuure
disclosuureOPโ€ข13mo ago
The code for generating the embeds etc is 500 lines long but heres a relevant snippet
const embeds = [userInfoEmbed, accountsEmbed, evidenceEmbed, revisionsEmbed];

const page = new PaginatedMessage({
template: templateEmbed,
actions: [
{
customId: 'case_overview',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ”Ž',
label: 'Overview',
run(context) {
context.handler.index = 0;
}
},
{
customId: 'case_accounts',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ‘ฅ',
label: 'Accounts',
run(context) {
context.handler.index = 1;
}
},
{
customId: 'case_evidence',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ“',
label: 'Evidence',
run(context) {
context.handler.index = 2;
}
},
{
customId: 'case_revisions',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ“',
label: 'Revisions',
run(context) {
context.handler.index = 3;
}
}
]
});

for (const embed of embeds) {
page.addPageEmbed(embed);
}

return page.run(interaction);
const embeds = [userInfoEmbed, accountsEmbed, evidenceEmbed, revisionsEmbed];

const page = new PaginatedMessage({
template: templateEmbed,
actions: [
{
customId: 'case_overview',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ”Ž',
label: 'Overview',
run(context) {
context.handler.index = 0;
}
},
{
customId: 'case_accounts',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ‘ฅ',
label: 'Accounts',
run(context) {
context.handler.index = 1;
}
},
{
customId: 'case_evidence',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ“',
label: 'Evidence',
run(context) {
context.handler.index = 2;
}
},
{
customId: 'case_revisions',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ“',
label: 'Revisions',
run(context) {
context.handler.index = 3;
}
}
]
});

for (const embed of embeds) {
page.addPageEmbed(embed);
}

return page.run(interaction);
page.run(interaction) refers to a button interaction (when they hit 'View case') Note that when I use a slash command to select the case, this works perfectly still need help
Sawako
Sawakoโ€ข13mo ago
@Favna
disclosuure
disclosuureOPโ€ข13mo ago
๐Ÿ™
Sawako
Sawakoโ€ข13mo ago
Tag fav a @Favna
Favna
Favnaโ€ข13mo ago
I see the pings btw. I I've just been very busy I'll go through the posts not yet marked as solved in due time so to recap @cosigyn - You send something that has a button - When user clicks a button you create a new PaginatedMessage. So this is in a class that extends InteractionHandler. - You pass the interaction from the button to the run function is that correct?
disclosuure
disclosuureOPโ€ข13mo ago
Yes
Favna
Favnaโ€ข13mo ago
I dumbed it down to this: command.ts
import { Command } from '@sapphire/framework';
import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js';

export class UserCommand extends Command {
public constructor(context: Command.Context) {
super(context, {
name: 'cip',
description: 'A basic chat input command that pings'
});
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder //
.setName(this.name)
.setDescription(this.description)
);
}

public override async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
const btn = new ButtonBuilder().setCustomId('my-button').setLabel('Click me').setStyle(ButtonStyle.Primary);
const ar = new ActionRowBuilder<ButtonBuilder>().setComponents(btn);

return interaction.reply({
components: [ar],
ephemeral: true
});
}
}
import { Command } from '@sapphire/framework';
import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js';

export class UserCommand extends Command {
public constructor(context: Command.Context) {
super(context, {
name: 'cip',
description: 'A basic chat input command that pings'
});
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder //
.setName(this.name)
.setDescription(this.description)
);
}

public override async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
const btn = new ButtonBuilder().setCustomId('my-button').setLabel('Click me').setStyle(ButtonStyle.Primary);
const ar = new ActionRowBuilder<ButtonBuilder>().setComponents(btn);

return interaction.reply({
components: [ar],
ephemeral: true
});
}
}
button-handler.ts
import { ApplyOptions } from '@sapphire/decorators';
import { PaginatedMessage } from '@sapphire/discord.js-utilities';
import { InteractionHandler, InteractionHandlerTypes } from '@sapphire/framework';
import { ButtonInteraction, ButtonStyle, ComponentType } from 'discord.js';

@ApplyOptions<InteractionHandler.Options>({
interactionHandlerType: InteractionHandlerTypes.Button
})
export class SapphireButtonHandler extends InteractionHandler {
override run(interaction: ButtonInteraction) {
const page = new PaginatedMessage()
.setActions([
{
customId: 'case_overview',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ”Ž',
label: 'Overview',
run(context) {
context.handler.index = 0;
}
},
{
customId: 'case_accounts',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ‘ฅ',
label: 'Accounts',
run(context) {
context.handler.index = 1;
}
},
{
customId: 'case_evidence',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ“',
label: 'Evidence',
run(context) {
context.handler.index = 2;
}
},
{
customId: 'case_revisions',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ“',
label: 'Revisions',
run(context) {
context.handler.index = 3;
}
}
])
.addPageContent('Page 1')
.addPageContent('Page 2');

return page.run(interaction);
}

public override async parse(interaction: ButtonInteraction) {
if (interaction.customId === 'my-button') return this.some();
return this.none();
}
}
import { ApplyOptions } from '@sapphire/decorators';
import { PaginatedMessage } from '@sapphire/discord.js-utilities';
import { InteractionHandler, InteractionHandlerTypes } from '@sapphire/framework';
import { ButtonInteraction, ButtonStyle, ComponentType } from 'discord.js';

@ApplyOptions<InteractionHandler.Options>({
interactionHandlerType: InteractionHandlerTypes.Button
})
export class SapphireButtonHandler extends InteractionHandler {
override run(interaction: ButtonInteraction) {
const page = new PaginatedMessage()
.setActions([
{
customId: 'case_overview',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ”Ž',
label: 'Overview',
run(context) {
context.handler.index = 0;
}
},
{
customId: 'case_accounts',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ‘ฅ',
label: 'Accounts',
run(context) {
context.handler.index = 1;
}
},
{
customId: 'case_evidence',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ“',
label: 'Evidence',
run(context) {
context.handler.index = 2;
}
},
{
customId: 'case_revisions',
style: ButtonStyle.Secondary,
type: ComponentType.Button,
emoji: '๐Ÿ“',
label: 'Revisions',
run(context) {
context.handler.index = 3;
}
}
])
.addPageContent('Page 1')
.addPageContent('Page 2');

return page.run(interaction);
}

public override async parse(interaction: ButtonInteraction) {
if (interaction.customId === 'my-button') return this.some();
return this.none();
}
}
and it works just fine for me @cosigyn. The only way I can actually break it is by doing this in the button handler:
return page.run({
...interaction,
ephemeral: true
});
return page.run({
...interaction,
ephemeral: true
});
but that is also not how PM works. To make a PM ephemeral the interaction it is being ran on has to be ephemeral. Ergo, starting a PM from a button cannot be ephemeral.
disclosuure
disclosuureOPโ€ข13mo ago
I used deferReply to make it ephemeral Incase it wasn't clear, the paginated message works fine normally, when it's created from a command rather than a button, but when its created from a button, I'm unable to click the PM buttons, as it always says 'its for someone else' after someone else clicks on the button and creates a new PM
WhacK
WhacKโ€ข13mo ago
I am having a similiar issue so I am going to ask here. My paginated message is not being generated from a button but the original slash command. I use them to call a "shop's" inventory. Certain channels/threads represent shops with varying inventories. I defer the interaction w/ await interaction.deferReply({ ephemeral: true }). Then I get the data from our API and reply with the paginated message. I use the default actions (less the selection menu) only. I'm using the latest dependencies.
public async chatInputViewInventory(interaction: ChatInputCommand.Interaction) {
try {
await interaction.deferReply({ ephemeral: true });
const { channel: intChannel } = interaction;
const shopInventoryResponse: ShopInventoryItem[] = await getShopInventory(intChannel.id).catch(() => null);
if (!shopInventoryResponse) {
throw new Error('Unable to retrieve shop inventory data.');
}
const shopName = shopInventoryResponse[0].shop.name;
let pagesNeeded = Math.ceil(shopInventoryResponse.length / 24);
let pageIndex = 0;
let fieldData = shopInventoryResponse;

const inventoryEmbed = new BeholderPaginatedMessage({
template: new EmbedBuilder()
.setColor('#2f3136')
.setDescription('**Shop Inventory:**')
.setTitle(shopName)
.setFooter(
{ text: ` You can use \`/shop [list | buy | sell ] <item name> <qty>\` to conduct a transaction.` }),
actions: []
});
inventoryEmbed.setActions(
PaginatedMessage.defaultActions.filter(
(action) =>
'customId' in action &&
[
'@sapphire/paginated-messages.previousPage',
'@sapphire/paginated-messages.stop',
'@sapphire/paginated-messages.nextPage'
].includes(action.customId)
)
);

while (pageIndex < pagesNeeded) {
inventoryEmbed.addPageBuilder((builder) => {
const page = new EmbedBuilder();
for (let x = 0; x < fieldData.length; x++) {
if (x === 24) break;

const i = fieldData[x];

if (i.qty > 0) {
page.addFields({
name: `${RarityGemEnum[i.item.rarity]} ${i.item.name} \`x${i.qty}\` `,
value: `*${i.price} gp*`,
inline: true
});
}
}
return builder.setEmbeds([page]);
});

fieldData = fieldData.slice(24);
pageIndex += 1;
}
// send response
return inventoryEmbed.run(interaction);
} catch (error) {
console.error(error);
return interaction.editReply({
content: error.message || 'An unexpected error occurred. If the problem persists, please contact a Code Weaver.',
ephemeral: true
});
}
}
public async chatInputViewInventory(interaction: ChatInputCommand.Interaction) {
try {
await interaction.deferReply({ ephemeral: true });
const { channel: intChannel } = interaction;
const shopInventoryResponse: ShopInventoryItem[] = await getShopInventory(intChannel.id).catch(() => null);
if (!shopInventoryResponse) {
throw new Error('Unable to retrieve shop inventory data.');
}
const shopName = shopInventoryResponse[0].shop.name;
let pagesNeeded = Math.ceil(shopInventoryResponse.length / 24);
let pageIndex = 0;
let fieldData = shopInventoryResponse;

const inventoryEmbed = new BeholderPaginatedMessage({
template: new EmbedBuilder()
.setColor('#2f3136')
.setDescription('**Shop Inventory:**')
.setTitle(shopName)
.setFooter(
{ text: ` You can use \`/shop [list | buy | sell ] <item name> <qty>\` to conduct a transaction.` }),
actions: []
});
inventoryEmbed.setActions(
PaginatedMessage.defaultActions.filter(
(action) =>
'customId' in action &&
[
'@sapphire/paginated-messages.previousPage',
'@sapphire/paginated-messages.stop',
'@sapphire/paginated-messages.nextPage'
].includes(action.customId)
)
);

while (pageIndex < pagesNeeded) {
inventoryEmbed.addPageBuilder((builder) => {
const page = new EmbedBuilder();
for (let x = 0; x < fieldData.length; x++) {
if (x === 24) break;

const i = fieldData[x];

if (i.qty > 0) {
page.addFields({
name: `${RarityGemEnum[i.item.rarity]} ${i.item.name} \`x${i.qty}\` `,
value: `*${i.price} gp*`,
inline: true
});
}
}
return builder.setEmbeds([page]);
});

fieldData = fieldData.slice(24);
pageIndex += 1;
}
// send response
return inventoryEmbed.run(interaction);
} catch (error) {
console.error(error);
return interaction.editReply({
content: error.message || 'An unexpected error occurred. If the problem persists, please contact a Code Weaver.',
ephemeral: true
});
}
}
The BeholderPaginatedMessage class I copied the example of Dragonite just to lower the default idle. If someone checks the inventory in the same shop they get a message to stop interacting with Y user's buttons
WhacK
WhacKโ€ข13mo ago
No description
Favna
Favnaโ€ข13mo ago
Changing the command to
public override async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
await interaction.deferReply({ ephemeral: true });
const btn = new ButtonBuilder().setCustomId('my-button').setLabel('Click me').setStyle(ButtonStyle.Primary);
const ar = new ActionRowBuilder<ButtonBuilder>().setComponents(btn);

return interaction.editReply({
components: [ar]
});
}
public override async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
await interaction.deferReply({ ephemeral: true });
const btn = new ButtonBuilder().setCustomId('my-button').setLabel('Click me').setStyle(ButtonStyle.Primary);
const ar = new ActionRowBuilder<ButtonBuilder>().setComponents(btn);

return interaction.editReply({
components: [ar]
});
}
but keeping the rest the same I still cannot replicate the issue. Please provide a small reproduction GitHub repository which I can run after providing only a Discord token so I can analyse the issue further. FYI you dont need to do actions: []. setActions by default already overrides the default actions. So you can just do:
const inventoryEmbed = new PaginatedMessage({
template: new EmbedBuilder()
.setColor('#2f3136')
.setDescription('**Shop Inventory:**')
.setTitle('shopName')
.setFooter({ text: ` You can use \`/shop [list | buy | sell ] <item name> <qty>\` to conduct a transaction.` })
})
.setActions(
PaginatedMessage.defaultActions.filter(
(action) =>
'customId' in action &&
['@sapphire/paginated-messages.previousPage', '@sapphire/paginated-messages.stop', '@sapphire/paginated-messages.nextPage'].includes(
action.customId
)
)
);
const inventoryEmbed = new PaginatedMessage({
template: new EmbedBuilder()
.setColor('#2f3136')
.setDescription('**Shop Inventory:**')
.setTitle('shopName')
.setFooter({ text: ` You can use \`/shop [list | buy | sell ] <item name> <qty>\` to conduct a transaction.` })
})
.setActions(
PaginatedMessage.defaultActions.filter(
(action) =>
'customId' in action &&
['@sapphire/paginated-messages.previousPage', '@sapphire/paginated-messages.stop', '@sapphire/paginated-messages.nextPage'].includes(
action.customId
)
)
);
As for your particular issue, that should definitely work. For example @Dragonite uses the exact same process (https://github.com/favware/dragonite). The same will go for you to provide a small reproduction repository.
WhacK
WhacKโ€ข13mo ago
Ok thanks Iโ€™ll get on it
disclosuure
disclosuureOPโ€ข13mo ago
I will provide a reproduction repo, but did you get someone else to click the button after you did, and then try to use the paginated message again?
Favna
Favnaโ€ข13mo ago
I did not. I'll try that later.
WhacK
WhacKโ€ข13mo ago
Thatโ€™s what I had to do. I canโ€™t reproduce on my own locally but my users had mentioned it. Iโ€™ll get to the reproduction repo asap
Favna
Favnaโ€ข13mo ago
This is what I tried now: 1. Use command with me. This gives an ephemeral reply because of the defer 2. Click the button that calls the interaction handler and sends the PM with me 3. Click the button on the PM with me (works) 4. Click the button on the PM with @AlsoFavna (gives wrong user) 5. Click the button on the PM with me (works) --- 1. Use command with me. This gives an ephemeral reply because of the defer 2. Click the button that calls the interaction handler and sends the PM with me 3. Click the button on the PM with @AlsoFavna (gives wrong user) 4. Click the button on the PM with me (works) so both work as expected still
disclosuure
disclosuureOPโ€ข13mo ago
I would give reproduction steps but I am getting a weird error:
import { ApplyOptions } from '@sapphire/decorators';
import { PaginatedMessage } from '@sapphire/discord.js-utilities';
import { Command } from '@sapphire/framework';

@ApplyOptions<Command.Options>({
description: 'ping pong'
})
export class UserCommand extends Command {
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand({
name: this.name,
description: this.description
});
}

public override async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
await interaction.deferReply({ ephemeral: true });

return new PaginatedMessage().addPageContent('Page 1')
.addPageContent('Page 2').run(interaction);
}
}
import { ApplyOptions } from '@sapphire/decorators';
import { PaginatedMessage } from '@sapphire/discord.js-utilities';
import { Command } from '@sapphire/framework';

@ApplyOptions<Command.Options>({
description: 'ping pong'
})
export class UserCommand extends Command {
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand({
name: this.name,
description: this.description
});
}

public override async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
await interaction.deferReply({ ephemeral: true });

return new PaginatedMessage().addPageContent('Page 1')
.addPageContent('Page 2').run(interaction);
}
}
https://ss.clanware.org/uZvpLC9f.png
Favna
Favnaโ€ข13mo ago
make sure all dependencies are up-to-date and such maze wasnt meant for you means an unexpected error occurred
"dependencies": {
"@sapphire/decorators": "^6.0.2",
"@sapphire/discord-utilities": "^3.1.1",
"@sapphire/discord.js-utilities": "7.0.2",
"@sapphire/fetch": "^2.4.1",
"@sapphire/framework": "^4.7.2",
"@sapphire/plugin-api": "^5.1.2",
"@sapphire/plugin-editable-commands": "^3.0.3",
"@sapphire/plugin-logger": "^3.0.6",
"@sapphire/plugin-subcommands": "^5.0.0",
"@sapphire/time-utilities": "^1.7.10",
"@sapphire/type": "^2.4.0",
"@sapphire/utilities": "^3.13.0",
"@skyra/env-utilities": "^1.2.1",
"colorette": "^2.0.20",
"discord-api-types": "^0.37.62",
"discord.js": "^14.13.0"
},
"devDependencies": {
"@sapphire/prettier-config": "^2.0.0",
"@sapphire/ts-config": "^5.0.0",
"@types/node": "^20.8.10",
"@types/ws": "^8.5.8",
"prettier": "^3.0.3",
"tsc-watch": "^6.0.4",
"typescript": "^5.2.2"
},
"dependencies": {
"@sapphire/decorators": "^6.0.2",
"@sapphire/discord-utilities": "^3.1.1",
"@sapphire/discord.js-utilities": "7.0.2",
"@sapphire/fetch": "^2.4.1",
"@sapphire/framework": "^4.7.2",
"@sapphire/plugin-api": "^5.1.2",
"@sapphire/plugin-editable-commands": "^3.0.3",
"@sapphire/plugin-logger": "^3.0.6",
"@sapphire/plugin-subcommands": "^5.0.0",
"@sapphire/time-utilities": "^1.7.10",
"@sapphire/type": "^2.4.0",
"@sapphire/utilities": "^3.13.0",
"@skyra/env-utilities": "^1.2.1",
"colorette": "^2.0.20",
"discord-api-types": "^0.37.62",
"discord.js": "^14.13.0"
},
"devDependencies": {
"@sapphire/prettier-config": "^2.0.0",
"@sapphire/ts-config": "^5.0.0",
"@types/node": "^20.8.10",
"@types/ws": "^8.5.8",
"prettier": "^3.0.3",
"tsc-watch": "^6.0.4",
"typescript": "^5.2.2"
},
disclosuure
disclosuureOPโ€ข13mo ago
"discord.js": "^14.14.1"
"@types/node": "^20.9.0",
"@types/ws": "^8.5.9",
"prettier": "^3.1.0",
"discord.js": "^14.14.1"
"@types/node": "^20.9.0",
"@types/ws": "^8.5.9",
"prettier": "^3.1.0",
thats the only differences The rest are the same version
Favna
Favnaโ€ข13mo ago
try using djs 14.13.0 for djs. There were a few changes that arent released yet. pending on some other work to be done
disclosuure
disclosuureOPโ€ข13mo ago
GitHub
GitHub - cosigyn/Sapphire-Bug-Repro
Contribute to cosigyn/Sapphire-Bug-Repro development by creating an account on GitHub.
WhacK
WhacKโ€ข13mo ago
Still doing it to me on the minimal sample but was able to get the error this time.
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[10062]: Unknown interaction
at handleErrors (/Users/sr/Projects/paginated-ephemeral/node_modules/@discordjs/rest/dist/index.js:719:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/Users/sr/Projects/paginated-ephemeral/node_modules/@discordjs/rest/dist/index.js:820:23)
at async _REST.request (/Users/sr/Projects/paginated-ephemeral/node_modules/@discordjs/rest/dist/index.js:1256:22)
at async ButtonInteraction.update (/Users/sr/Projects/paginated-ephemeral/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:233:5)
at async safelyReplyToInteraction (/Users/sr/Projects/paginated-ephemeral/node_modules/@sapphire/discord.js-utilities/dist/index.js:665:7)
at async _PaginatedMessage.handleCollect (/Users/sr/Projects/paginated-ephemeral/node_modules/@sapphire/discord.js-utilities/dist/index.js:1668:11) {
requestBody: {
files: [],
json: {
type: 7,
data: {
content: 'Page 2',
tts: false,
nonce: undefined,
embeds: undefined,
components: [ { type: 1, components: [Array] } ],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined
}
}
},
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1174439169959932015/aW50ZXJhY3Rpb246MTE3NDQzOTE2OTk1OTkzMjAxNTpBTmV3TVlPa1RQQ3k4bEtsdzdweXFUV0ZQc29IRTljU2xheXd4QUVHcXg0UkJwQkxNZEhOZXN2ZnFqZ0lUV1R3YUVZUEtuam1rYVF1TDA4dTR2NE0xQllKRjFiWXQ3SUpwcFpTdFJBbngwTXlrYmp6eWNtY2NHSUhmVkh5WjZibA/callback'
}

Node.js v18.18.2
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[10062]: Unknown interaction
at handleErrors (/Users/sr/Projects/paginated-ephemeral/node_modules/@discordjs/rest/dist/index.js:719:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (/Users/sr/Projects/paginated-ephemeral/node_modules/@discordjs/rest/dist/index.js:820:23)
at async _REST.request (/Users/sr/Projects/paginated-ephemeral/node_modules/@discordjs/rest/dist/index.js:1256:22)
at async ButtonInteraction.update (/Users/sr/Projects/paginated-ephemeral/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:233:5)
at async safelyReplyToInteraction (/Users/sr/Projects/paginated-ephemeral/node_modules/@sapphire/discord.js-utilities/dist/index.js:665:7)
at async _PaginatedMessage.handleCollect (/Users/sr/Projects/paginated-ephemeral/node_modules/@sapphire/discord.js-utilities/dist/index.js:1668:11) {
requestBody: {
files: [],
json: {
type: 7,
data: {
content: 'Page 2',
tts: false,
nonce: undefined,
embeds: undefined,
components: [ { type: 1, components: [Array] } ],
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined
}
}
},
rawError: { message: 'Unknown interaction', code: 10062 },
code: 10062,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1174439169959932015/aW50ZXJhY3Rpb246MTE3NDQzOTE2OTk1OTkzMjAxNTpBTmV3TVlPa1RQQ3k4bEtsdzdweXFUV0ZQc29IRTljU2xheXd4QUVHcXg0UkJwQkxNZEhOZXN2ZnFqZ0lUV1R3YUVZUEtuam1rYVF1TDA4dTR2NE0xQllKRjFiWXQ3SUpwcFpTdFJBbngwTXlrYmp6eWNtY2NHSUhmVkh5WjZibA/callback'
}

Node.js v18.18.2
going to publish the repo now
WhacK
WhacKโ€ข13mo ago
GitHub
GitHub - whackdev/paginated-ephemeral
Contribute to whackdev/paginated-ephemeral development by creating an account on GitHub.
WhacK
WhacKโ€ข13mo ago
Used cli to create project
disclosuure
disclosuureOPโ€ข13mo ago
It seems like discord has changed something with their API, I keep getting this error even though my code hasn't been updated at all, I wasn't previously getting it (maze error)
2023-11-15T23:07:47.455546+00:00 app[worker.1]: If you want PaginatedMessage to work in DM channels then make sure you start your client with "CHANNEL" added to "client.options.partials".
2023-11-15T23:07:47.455548+00:00 app[worker.1]: Furthermore if you are using message based commands (as opposed to application commands) then you will also need to add the "DIRECT_MESSAGE" intent to "client.options.intents"
2023-11-15T23:07:47.455552+00:00 app[worker.1]: If you do not want to be alerted about this in the future then you can disable this warning by setting "PaginatedMessage.emitPartialDMChannelWarning" to "false", or use "setEmitPartialDMChannelWarning(false)" before calling "run".
2023-11-15T23:07:47.455546+00:00 app[worker.1]: If you want PaginatedMessage to work in DM channels then make sure you start your client with "CHANNEL" added to "client.options.partials".
2023-11-15T23:07:47.455548+00:00 app[worker.1]: Furthermore if you are using message based commands (as opposed to application commands) then you will also need to add the "DIRECT_MESSAGE" intent to "client.options.intents"
2023-11-15T23:07:47.455552+00:00 app[worker.1]: If you do not want to be alerted about this in the future then you can disable this warning by setting "PaginatedMessage.emitPartialDMChannelWarning" to "false", or use "setEmitPartialDMChannelWarning(false)" before calling "run".
WhacK
WhacKโ€ข13mo ago
I donโ€™t get that error
disclosuure
disclosuureOPโ€ข13mo ago
I only get it sometimes in certain servers
Favna
Favnaโ€ข13mo ago
Do you have the Guilds intent? Itโ€™s the minimum required. That said this error is for using it in Dms with the bot. this was indeed the lack of GatewayIntentBits.Guilds in the intents.
Favna
Favnaโ€ข13mo ago
here is your repo adjusted and this works just fine @cosigyn - updated dependencies because otherwise there are TS build errors - fixed where .env is loaded from - added the intent mentioned above - enabled bulk overwrite mode for commands so idHints do not need to be bothered with
Favna
Favnaโ€ข13mo ago
I just tried this repo and here too I cannot reproduce any error. I did upgrade @sapphire/discord.js-utilities to 7.1.1 from 7.0.1 but that shouldn't matter as far as I know. I use /test and then click the buttons and they work just fine. Of course in this case no one but the user can interact with the buttons, because the message is ephemeral. But that should be the expected result I would assume. If that is wrong then let me know.
WhacK
WhacKโ€ข13mo ago
If you test with Favna in a channel. Then try to use test as AlsoFavna in the same channel you will get the error It only happens when two users are in the same channel. If someone shops at the smith and another at the jeweler no issues. But if they both go to the smith it happens
Favna
Favnaโ€ข13mo ago
huh you're right. What the hell.
WhacK
WhacKโ€ข13mo ago
Idk I thought I mustโ€™ve done something
Dragonite
Dragoniteโ€ข13mo ago
#149 - Dragonite
Height
2.2m
Weight
210kg
Levelling rate
Slow
Egg group(s)
Water 1, Dragon
Egg can be obtained
Yes
Minimum hatching time
10,280
Maximum hatching time
10,536
External Resources
2 / 4
Favna
Favnaโ€ข13mo ago
can you try to also use /pokemon
Dragonite
Dragoniteโ€ข13mo ago
#494 - Victini
Pokรฉdex entry
(Alpha Sapphire) When it shares the infinite energy it creates, that being's entire body will be overflowing with power.
Pokรฉdex entry
(Omega Ruby) This Pokรฉmon brings victory. It is said that Trainers with Victini always win, regardless of the type of encounter.
External Resources
4 / 4
WhacK
WhacKโ€ข13mo ago
(Iโ€™ve always wanted to see this bot!)
Favna
Favnaโ€ข13mo ago
I cant press next page on yours anyway
WhacK
WhacKโ€ข13mo ago
I canโ€™t press yours and mine works this way
Favna
Favnaโ€ข13mo ago
so is this just an issue with ephemeral then hmm
WhacK
WhacKโ€ข13mo ago
yeah, when I first encountered it I thought it was a me problem so I didn't ask and changed them to visible and no issues but that causes me issues because our prices change and people complain
Favna
Favnaโ€ข13mo ago
aha I seem to have found the issue. Now the question is why does it happen
WhacK
WhacKโ€ข13mo ago
yeah if it can find it when not ephemeral not sure why that would change anything
Favna
Favnaโ€ข13mo ago
when it's not ephemeral handleCollect is called just once and for the proper user, but when it is ephemeral then it's called N times, once for each user that used the command. That causes the check interaction.user.id === targetUser.id to be false and send the "wrong user" message. Problem is that handleCollect is called in order and once for every user so there will always be a false in the chain. I added a console.log above that if check if for not ephemeral it gets logged once but for ephemeral it gets logged twice
WhacK
WhacKโ€ข13mo ago
ooo
Favna
Favnaโ€ข13mo ago
hm I do have an idea for how to fix it
Solution
Favna
Favnaโ€ข13mo ago
Unfollowing this because it's fixed in @sapphire/[email protected]
Want results from more Discord servers?
Add your server