Skip to content
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

Deprecation when updating commands that require bot to update a message #252

Open
antiftw opened this issue Jun 4, 2022 · 0 comments
Open

Comments

@antiftw
Copy link

antiftw commented Jun 4, 2022

When updating a command so that the bot also needs to rewrite the command output, I get a deprecation message:

DeprecationWarning: Message#deleted is deprecated, see discordjs/discord.js#7091.

When looking a bit deeper I was able to get the stack trace, where I found what triggered it:

discord.js/src/structures/Message.js:362

and also the offending code, located at:

discord-akairo/src/struct/commands/CommandUtil.js:103, inside CommandUtil#send:

if (this.shouldEdit && (this.command ? this.command.editable : true) && !hasFiles && !this.lastResponse.deleted && !this.lastResponse.attachments.size) {

The actual problem being this.lastResponse.deleted.

I have read the discord.js issue, and since it is already merged this will need to get fixed before upgrading to discord.js v14. The issue also mentions a counterpart to the deprecated function: Message#detelable, and if I look into the code they actually do the same check (of course deletable returns the opposite from deleted):

get deleted():

return deletedMessages.has(this);

get deletable():

if (deletedMessages.has(this)) {
    return false;
}

PR with required changes: #253

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant