UNPKG

discord-rb

Version:

Discord.rb is a library for interacting with the Discord API.

46 lines (32 loc) 1.11 kB
const fetch = require("node-fetch") //represents a discord user. const User = async (userID, token) => { var options = { "method": "GET", "headers": { 'Authorization': `Bot ${token}`, 'Cookie': '__cfduid=d62bef48329670a370c27df97f1a81eba1587580440; __cfruid=bf4b45e1a6e5ef27d99bc35b0eab7581881c3b8c-1587580440' } } let request = await fetch(`https://discordapp.com/api/users/${userID}`, options) let user = await request.json() if (!user.id) return undefined let data = { //the ID of this user. ID: user.id, //the username of this user. Username: user.username, //the discriminator of this user. Discriminator: user.discriminator, //the tag of this user. Tag: `${user.username}#${user.discriminator}`, //wether if the user is a bot or not. Bot: user.bot, //mention of this user. Mention: () => `<@${user.id}>`, //avatar of this user. Avatar: user.avatar } return data } module.exports = User