question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add function to get vanity URL uses

See original GitHub issue

Is your feature request related to a problem? Please describe. I want to get the uses of a vanity URL, but there is no function for that.

Describe the ideal solution Add a function Guild.fetchVanityUses() that gets the uses of a vanity URL, if any.

Describe alternatives you’ve considered It is already possible to get vanity invites via client.fetchInvite(server.vanityURLCode), but the .uses is always null. Instead of the extra function the implementation could fill that field. Alternatively the fetchInvites function could be changed to include the vanity URL invite and its uses.

Additional context The Discord API supports this: https://discordapp.com/developers/docs/resources/guild#get-guild-vanity-url There is this code in https://github.com/discordjs/discord.js/blob/master/src/structures/Guild.js#L726-L746:

  fetchVanityCode() {
    if (!this.features.includes('VANITY_URL')) {
      return Promise.reject(new Error('VANITY_URL'));
    }
    return this.client.api
      .guilds(this.id, 'vanity-url')
      .get()
      .then(res => res.code);
  }

so it should be relatively easy to add

  fetchVanityUses() {
    if (!this.features.includes('VANITY_URL')) {
      return Promise.reject(new Error('VANITY_URL'));
    }
    return this.client.api
      .guilds(this.id, 'vanity-url')
      .get()
      .then(res => res.uses);
  }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
monbreycommented, Apr 20, 2020

The linked PR #4103 will provide the ability to fetch the vanity data from the /guilds/{guild.id}/vanity-url endpoint - there’s really no need to discuss it further here or implement a workaround by Invite.

2reactions
SunGame7commented, Apr 20, 2020
You could just make a parameter based function yourself:
fetchVanityUses(guild) {
  if (guild.vanityURLCode) {
    guild.fetchInvites()
      .then(result = invites => console.log(invites.find(invite => invite.code === guild.vanityURLCode)))
      .catch(console.error)
    return(result)
  } else {
    return('0')
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase: How do you add a vanity URL to a cloud function?
1 Answer 1 · When I visit the url where my cloud function should be, I get a web page that says "404...
Read more >
Vanity URL: What It Is & How To Get One - WordStream
A vanity URL is an unique web address that is branded for marketing purposes. Learn all the ins and outs of vanity URLs...
Read more >
TOP 3 Ways Get CUSTOM Discord Server VANITY ... - YouTube
TOP 3 Ways Get CUSTOM Discord Server VANITY URL or Links [Without ... URL Using Script ( Method 1 ) ○00:51 Custom URL...
Read more >
Set up a vanity URL - Hootsuite Help Center
All organization members can use the vanity URL to shorten their post links in Composer. You can also add your vanity URL to...
Read more >
29 Configuring Vanity URLs
The other method generates a vanity URL from a pattern, and is described in this ... It can be used in render tags...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found