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

Is the External Image Broken? #1371

Open
3 tasks done
koimoee opened this issue Nov 30, 2024 · 0 comments
Open
3 tasks done

Is the External Image Broken? #1371

koimoee opened this issue Nov 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@koimoee
Copy link

koimoee commented Nov 30, 2024

Which package has the bugs?

The core library

Issue description

  1. i want to run my code as usual
  2. i wonder why the large image won't showing up on my rpc
  3. I tried to debug the code many times and the result is below, it seems that the set external image succeeded but the end is “undefined”
PS C:\Users\koinatsuko\OneDrive\Documents\VisualStudioCode\selfbot> node sample.js
xelxx23 is ready!
Setting external image for game: Shin Megami Tensei V: Vengeance
getExtendURL response:  [
  {
    url: 'https://image.api.playstation.com/vulcan/ap/rnd/202402/0600/50ff1bbdf7f888123646c47e1d3cf658c00074d23d05c44c.png',
    external_asset_path: 'external/57W3DWvplLR5gE3IEFji6lWG1fXXLDdu0wE3cvaYs-w/https/image.api.playstation.com/vulcan/ap/rnd/202402/0600/50ff1bbdf7f888123646c47e1d3cf658c00074d23d05c44c.png'
  }
]
Setting large image with URL: external/57W3DWvplLR5gE3IEFji6lWG1fXXLDdu0wE3cvaYs-w/https/image.api.playstation.com/vulcan/ap/rnd/202402/0600/50ff1bbdf7f888123646c47e1d3cf658c00074d23d05c44c.png
undefined

Code sample

const { Client, RichPresence } = require('discord.js-selfbot-v13');
const fs = require('fs');
const client = new Client();

const gameId = '1251083724150407209';
const sanitizedGameName = 'Shin Megami Tensei V: Vengeance';

let imageSource = null;
const imageUrl = 'https://image.api.playstation.com/vulcan/ap/rnd/202402/0600/50ff1bbdf7f888123646c47e1d3cf658c00074d23d05c44c.png';

client.on('ready', async () => {
  console.log(`${client.user.username} is ready!`);

  const externalImageUrl = imageUrl;

  if (!externalImageUrl) {
    console.log("Image URL not found, skipping image setup.".yellow);
  } else {
    console.log(`Setting external image for game: ${sanitizedGameName}`);
  }

  const status = new RichPresence(client)
    .setApplicationId(gameId)
    .setPlatform('ps4')
    .setName(sanitizedGameName)

  if (externalImageUrl) {
    const getExtendURL = await RichPresence.getExternal(client, gameId, externalImageUrl);
    console.log("getExtendURL response: ", getExtendURL);
    if (getExtendURL && getExtendURL[0] && getExtendURL[0].external_asset_path) {
      const externalImagePath = getExtendURL[0].external_asset_path;
      console.log(`Setting large image with URL: ${externalImagePath}`);
      
      status.setAssetsLargeImage(externalImagePath);
      console.log(`Large Image from file set for Rich Presence!`.green);
    } else {
      console.log("Failed to retrieve external image path.".yellow);
    }
  }

  client.user.setPresence({ activities: [status] });
});

client.login('my-token');

Package version

[email protected]

Node.js version

18.18.0

Operating system

Windows 11

Priority this issue should have

Low (slightly annoying)

Checklist

  • I have searched the open issues for duplicates.
  • I have shared the entire traceback.
  • I am using a user token (and it isn't visible in the code).

Additional Information

I want to know if there is something wrong from there or from myself (but before that it was fine and it worked)

@koimoee koimoee added the bug Something isn't working label Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant