- NPM package that gets information about an invite from the discord api
- Useful for websites where users can input their invite-links
- Useful for bots to detect invites which are not for this guild
- Supports the Promise-API, so you can use .then, .catch and all the other stuff 😉
Check out or website discordinvite.info.
Install from NPM
$ npm i discord-inv --save
getInv(inviteCode, imgSize = 64 , withCounts = true)
- Get information about an inviteinviteCode
: Code of the inviteimgSize
: Size of all images (default: 64)withCounts
: If disabledapproximate_member_count
andapproximate_presence_count
are not going to be returned (default = false)
getCodeFromUrl(url)
- Format a discord-invite-url to the invite-codeurl
: Full Discord-URL of an invite
const discordInv = require('discord-inv');
const inviteurl = 'https://discord.gg/v9XHeeGbm3';
discordInv.getInv(discordInv.getCodeFromUrl(inviteurl)).then(invite => {
console.log(invite)
}).catch(console.log('This is not a valid invite'))
/*
OUTPUT:
{
code: 'v9XHeeGbm3',
guild: {
id: '781921152745996318',
name: 'Join this server!',
splash: null,
banner: null,
description: null,
icon: '02404df212218b0a7830a88157108cc6',
features: [ 'COMMUNITY', 'NEWS', 'WELCOME_SCREEN_ENABLED' ],
verification_level: 1,
vanity_url_code: null,
welcome_screen: {
description: 'Welcome! Have fun in this very very good community!',
welcome_channels: [Array]
},
iconURL: 'https://cdn.discordapp.com/icons/781921152745996318/02404df212218b0a7830a88157108cc6?size=64',
bannerURL: null,
splashURL: null
},
channel: { id: '781921854574821387', name: 'welcome', type: 0 },
inviter: {
id: '413429490342035466',
username: 'SCDerox',
avatar: '26fc0047afde07259c756d60232fdffc',
discriminator: '4645',
public_flags: 64,
tag: 'SCDerox#4645',
avatarURL: 'https://cdn.discordapp.com/avatars/413429490342035466/26fc0047afde07259c756d60232fdffc?size=64'
},
approximate_member_count: 12,
approximate_presence_count: 4,
url: 'https://discord.com/invite/v9XHeeGbm3'
}
*/
Feel free to create any issues and PRs in our github repository if you want to contribute.
© Simon Csaba, 2020-2021 | mail[at]scderox.de