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

Get User Banner Easily #5

Closed
wants to merge 3 commits into from
Closed

Get User Banner Easily #5

wants to merge 3 commits into from

Conversation

anasrz
Copy link

@anasrz anasrz commented May 21, 2022

'use strict';

const fetch = require('node-fetch');
/**
 * Get member Banner from guild;
 * @param {Client} client - The discord client.
 * @param {User} id - The User to get.
 * @returns {User} The user.
 * @see 
 https://github.com/Amir-78/djs-helper/tree/master#documentation
 */

async function getUserBannerURL(data) {
  let result = ''
  
   let user = await (await fetch(`https://discord.com/api/v9/users/${data.id}`, { headers: { "Authorization": `Bot ${data.client.token}`, "Content-Type": "application/json" } })).json();

    if(user.code){
            result = null;
        }
  if(user.banner === null){
    result = null
  }else{
 let bannerformat = 'pn'
  if(user.banner.startsWith('a_')) {
    bannerformat = 'gif'
  }    
    let userbannerlink = `https://cdn.discordapp.com/banners/${user.id}/${user.banner}.${bannerformat}`

    result = userbannerlink

    
  }


  
  return result;
};

module.exports = { getUserBannerURL }

@Amir-78
Copy link
Owner

Amir-78 commented May 21, 2022

@anasrz
Thank you for your participation, but unfortunately, this feature is in Discord.JS, So I don't think it's really useful

@Amir-78 Amir-78 closed this May 21, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants