zfbx / zdiscord

A Discord bot that runs in FiveM for the purpose of whitelisting, moderation and utilties using discord.js
Other
211 stars 79 forks source link

[BUG] #55

Closed milotiro95 closed 2 years ago

milotiro95 commented 2 years ago

Describe the bug (node:15524) DeprecationWarning: Message#deleted is deprecated, see https://github.com/discordjs/discord.js/issues/7091. (Use FXServer --trace-deprecation ... to show where the warning was created)

FXServer --trace-deprecation

That's what i have on my server running zdiscord. I don't know discord.js i see it is on my zdiscord folder.

To Reproduce Steps to reproduce the behavior: Just drag en drop into a server running directly and the fxserver will show a warning

Do you have an idea how to fix ? I'm using Artifact 5151

New Error on 5300 : (node:9264) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. (Use FXServer --trace-deprecation ... to show where the warning was created)

zfbx commented 2 years ago

yeah, it's been deprecated in the current version of discord.js (the framework zdiscord is build off of) it still works fine currently. I believe it's probably being triggered from the pagninator (used for commands like /players) for when there could be more than 4000 character replies which would break a message being sent. If you want to get rid of it.. replace these 4 lines https://github.com/zfbx/zdiscord/blob/b2a32ad5871d5bb15d35f64e5f00a9de9451c7a3/server/bot.js#L123-L126 with these 2

const disabledRow = new MessageActionRow().addComponents(buttonList[0].setDisabled(true), buttonList[1].setDisabled(true));
curPage.edit({ embeds: [pages[page].setFooter({ text: `Page ${page + 1} / ${pages.length}` })], components: [disabledRow] }).catch(console.error);
milotiro95 commented 2 years ago

Thank you for the feedback that was fast ! Yes I hate error so It will be perfect if that work. I just push the edit and will let you know if all is good by the end of the night :).

milotiro95 commented 2 years ago

Work like a charm thank you a lot for the support :)

zfbx commented 2 years ago

Glad to hear :) I'll go ahead and throw this on the main repo for others