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
825 stars 170 forks source link

Updated decoration links [src/structures/User.js] #1307

Closed Senju-sh closed 1 month ago

Senju-sh commented 1 month ago

Which package is the feature request for?

The core library

Feature

Screen

Ideal solution or implementation

Before :

avatarDecorationURL({ format, size } = {}) {
    if (this.avatarDecorationData) {
      return this.client.rest.cdn.AvatarDecoration(this.id, this.avatarDecorationData.asset, format, size);
    }
    return this.avatarDecoration && this.client.rest.cdn.AvatarDecoration(this.id, this.avatarDecoration, format, size);
  }

After :

avatarDecorationURL({ format = 'png', size } = {}) {
    let url;

    if (this.avatarDecorationData) {
        url = this.client.rest.cdn.AvatarDecoration(this.id, this.avatarDecorationData.asset, format, size);
    } else if (this.avatarDecoration) {
        url = this.client.rest.cdn.AvatarDecoration(this.id, this.avatarDecoration, format, size);
    } else {
        return null;
    }

    url = url.replace(/avatar-decorations\/\d+\//, 'avatar-decoration-presets/');
    url = url.replace(/\.(webp|jpg|jpeg)/, '.png');
    url = url.split('?')[0] + "?passthrough=true";

    return url;
}

Alternative solutions or implementations

No response

Other context

No response

aiko-chan-ai commented 1 month ago

https://github.com/aiko-chan-ai/discord.js-selfbot-v13/commit/ebc18df352d419109a671bc2464db539a1478fc4