aiko-chan-ai / discord.js-selfbot-v13

An unofficial discord.js fork for creating selfbots
https://discordjs-self-v13.netlify.app
GNU General Public License v3.0
797 stars 169 forks source link

Error: Button must have name and url #525

Closed xvqm closed 1 year ago

xvqm commented 1 year ago

Which package has the bugs?

The core library

Issue description

Hi, I wanted to make a RichPresence system that you can activate or not, all linked in a database. Only when I do .setButtons("name", "link") it doesn't work... However when I console.log the functions in my database, it was a text and a link.

Error:

Error: Button must have name and url
    at C:\Users\Sans\Desktop\Nekzy\node_modules\discord.js-selfbot-v13\src\structures\RichPresence.js:407:15
    at Array.forEach (<anonymous>)
    at RichPresence.setButtons (C:\Users\Sans\Desktop\Nekzy\node_modules\discord.js-selfbot-v13\src\structures\RichPresence.js:401:20)
    at Object.run (C:\Users\Sans\Desktop\Nekzy\commands\RPC\configrpc.js:189:49)
    at Object.run (C:\Users\Sans\Desktop\Nekzy\events\Client\messageCreate.js:60:19)
    at Client.<anonymous> (C:\Users\Sans\Desktop\Nekzy\index.js:43:46)
    at Client.emit (node:events:525:35)
    at MessageCreateAction.handle (C:\Users\Sans\Desktop\Nekzy\node_modules\discord.js-selfbot-v13\src\client\actions\MessageCreate.js:30:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Sans\Desktop\Nekzy\node_modules\discord.js-selfbot-v13\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\Sans\Desktop\Nekzy\node_modules\discord.js-selfbot-v13\src\client\websocket\WebSocketManager.js:359:31)

Code sample

const r = new RichPresence()
        if (db.rpctitle) r.setName(db.rpctitle)
        if (db.appid) r.setApplicationId(db.appid)
        if (db.rpcdetails) r.setDetails(db.rpcdetails)
        if (db.rpcstate) r.setState(db.rpcstate)
        if (db.type) r.setType(db.type)
        if (db.rpclargeimage) r.setAssetsLargeImage(db.rpclargeimage)
        if (db.rpclargeimagetext) r.setAssetsLargeText(db.rpclargeimagetext)
        if (db.rpcsmallimage) r.setAssetsSmallImage(db.rpcsmallimage)
        if (db.rpcsmallimagetext) r.setAssetsSmallText(db.rpcsmallimagetext)
        if (db.buttontext1 && db.buttonlink1) r.setButtons(db.buttontext1, db.buttonlink1)
        if (db.buttontext2 && db.buttonlink2) r.setButtons(db.buttontext2, db.buttonlink2)

        client.user.setActivity(r)

        db.rpconoff = "on"
        savedb(client, db)
        message.edit(await language(client, "Le rpc a été activé", "The rpx has been activated"))

Package version

2.10.1

Node.js version

16.19.0

Operating system

Win32

Priority this issue should have

Low (slightly annoying)

Checklist

Additional Information

When I do console.log(db.buttontext1 + "-" + db.buttonlink1) it return </> Eshop V2 </>-https://discord.gg/nANSkCyehT and the error was this line: if (db.buttontext1 && db.buttonlink1) r.setButtons(db.buttontext1, db.buttonlink1)

aiko-chan-ai commented 1 year ago

https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/RichPresence?scrollTo=setButtons

xvqm commented 1 year ago

Oh thanks, it's because I see this doc but setButton don't work so I replace it by setButtons

aiko-chan-ai commented 1 year ago

Oh thanks, it's because I see this doc but setButton don't work so I replace it by setButtons

addButton :v