1 |
const { Collection } = require('discord.js'); |
2 |
|
3 |
async function getUser(input, { guild, mentions = { members: new Collection() } }, member = true) { |
4 |
if (await mentions[member ? "members" : 'users'].first()) { |
5 |
return await mentions[member ? "members" : 'users'].first(); |
6 |
} |
7 |
|
8 |
if (input.indexOf('#') !== -1) { |
9 |
return await guild[member ? "members" : 'users'].cache.find(m => m.user.tag === input); |
10 |
} |
11 |
|
12 |
return await guild[member ? "members" : 'users'].fetch(input); |
13 |
} |
14 |
|
15 |
module.exports = { getUser }; |