discord-info-lookup
v1.0.6
Published
A discord info lookup tool for discord users and guilds.
Maintainers
Readme
discord-info-lookup
This package utilises the Discord API to retrieve information about users and guilds using the user's or guild's ID. This reduces the hassle of directly interacting with Discord API and allows for easier retrieval of information. The package were originally made because I can't be assed to do it myself and I wanted to make it easier for others (and myself) to use this package.
Installation
Using NPM:
npm install discord-info-lookupOr using Bun:
bun install discord-info-lookupUsage
const { getUser, getGuild } = require('discord-info-lookup');
// or
import { getUser, getGuild } from 'discord-info-lookup';
const userInfo = await getUser('123456789012345678', yourToken);
const guildInfo = await getGuild('123456789012345678');
console.log(userInfo); // { id: 123456789012, username: "username", ...}
console.log(guildInfo); // { id: 123456789012, name: "guild name", ...}Notes & Extras
The output of both functions are in JSON format for easier parsing and the output is cached for 1 hour to reduce API calls made to the Discord API. The cache is reset everytime your app starts because the
node-cachepackage stores the cache in memory. There shouldn't be any performance implications unless you fetch bazillions (not tested) of user/guilds in a short period of time.This package (only
getUser()) checks token by either going through theprocess.env.TOKENvariable or the optionalaccessTokenparameter. You can pass your token as a string into theaccessTokenparameter, for example:getUser('123456789012345678', 'token'). Not very safe, but it works.If you by any chance inputted anything that is not a number into either
getUser()orgetGuild(), it will throw an error telling you that numbers were expected. It may be a bit of a problem, but I don't want to make it too complicated. Do make sure the input contains only number in a string format though.I haven't tested the
getGuild()function yet, but I'm sure it works. It also requires the server to be discoverable somewhat in order for it to actually work. Questions and suggestions are welcome.This package is not meant to be used for malicious purposes. The purpose of this package is to make it easier to retrieve information about users and guilds. Whatever you do with the information is up to you and I am not liable for any issues that may or may not occur if you use this package for malicious purposes.
Please report any issues you encounter to GitHub. I will try my best to fix them as soon as possible.
