-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: Upgrading discordjs-utilities to 7.3.1 causing the process to crash #842
Comments
Let me guess, your installed the bot as a user application and used the command in a server where the bot is not a member and/or doesn't have the Read Message History permission? There is a known bug with user installed apps. |
The bot are not user installed apps as im aware. im sure i only enabled guild install. |
In that case we need much more information.
Just this error really doesn't say much to us |
permissions missing should not make the process crashed? |
Looking at the error stacktrace more carefully the error comes from There are a few things that can be said about this:
As stated.. under normal circumstances. This is a subjective take but IMHO your code is a mess and it took me a good 15 minutes and copying it to VSCode to get bracket pair colourizing to understand what was even happening. Setting aside my personal bias against premium features on a bot, I suspect it might be related to the setTimeout function where you're spamming users about your premium features and the asynchronous followUp causing the interaction to get wacky. Nothing else would ever be able to make the interaction not be an Hopefully you can get somewhere with this information. I sincerely think it isn't in the library's code itself and short of the DiscordJS update of 7.3.1 you could also get this issue in earlier versions. As for this:
No, they shouldn't, but only if you yourself handle your own errors correctly. You can find out more here: https://discordjs.guide/popular-topics/errors.html#how-to-diagnose-api-errors |
Thank you for the clarifications, i appreciate your hard work and for great utilities for the DJS communities. but the snippet code you sent if (this.response && !PaginatedMessage.deletionStopReasons.includes(reason)) {
void safelyReplyToInteraction({
messageOrInteraction: this.response,
interactionEditReplyContent: { components: [] },
interactionReplyContent: { ...this.#thisMazeWasNotMeantForYouContent, ephemeral: true },
componentUpdateContent: { components: [] },
messageMethod: 'edit',
messageMethodContent: { components: [] }
});
} Could be the problems. and can the error handled correctly? |
I would be willing to add an error handler but to do so I would need to reproduce the error locally first. If you can provide a small repository where the issue can be reproduced that would go a very long way. |
Sorry for late replies. i cannot create any minimal reproduce repo for you test right now. but i managed to suspend the crash issues by extending the PaginatedMessage. so it is the issue of handleEnd import type { PaginatedMessageInteractionUnion, PaginatedMessageStopReasons } from "@sapphire/discord.js-utilities";
import { isAnyInteraction, PaginatedMessage, safelyReplyToInteraction } from "@sapphire/discord.js-utilities";
import type { Collection, Snowflake } from "discord.js";
export class NezuPaginatedMessage extends PaginatedMessage {
readonly #thisMazeWasNotMeantForYouContent = { content: "This maze wasn't meant for you...what did you do." };
protected async handleEnd(_: Collection<Snowflake, PaginatedMessageInteractionUnion>, reason: PaginatedMessageStopReasons): Promise<void> {
if (
(reason === "time" || reason === "idle") &&
this.response !== null &&
isAnyInteraction(this.response) &&
this.response.isMessageComponent()
) {
try {
this.response.message = await this.response.fetchReply();
} catch { /* */ }
}
this.collector?.removeAllListeners();
if (this.response && !PaginatedMessage.deletionStopReasons.includes(reason)) {
try {
await safelyReplyToInteraction({
messageOrInteraction: this.response,
interactionEditReplyContent: { components: [] },
interactionReplyContent: { ...this.#thisMazeWasNotMeantForYouContent, ephemeral: true },
componentUpdateContent: { components: [] },
messageMethod: "edit",
messageMethodContent: { components: [] }
});
} catch { /* */ }
}
}
} |
I already knew the problem was with handleEnd, but by all logic of the code it should never happen, which is why I need a reproduction sample so I can probably debug the issue and solve it. |
Is there an existing issue for this?
Description of the bug
I recently upgraded to 7.3.1 and this causing to crash on missing perms
Steps To Reproduce
Use 7.3.1 and run PaginationMessage on missing perms channel.
Expected behavior
Promise should be handled correctly
Screenshots
No response
Additional context
No response
System Info
The text was updated successfully, but these errors were encountered: