d
This commit is contained in:
1 parent
55df89c02b
commit
ebc644e269
3 files changed
+1061
-890
No files matched your search
@@ -94,20 +94,25 @@ module.exports = {
|
||||
let latency = Date.now() - message.createdTimestamp;
|
||||
let apiLatency = Math.round(client.ws.ping);
|
||||
|
||||
if (subcommand === 'user') {
|
||||
if (subcommand === 'user' || subcommand === 'u') {
|
||||
try {
|
||||
const res = await fetch(`https://users.roproxy.com/v1/usernames/users`, {
|
||||
const res = await fetch(`https://users.roblox.com/v1/usernames/users`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${process.env.ROBLOSECURITY}` },
|
||||
body: JSON.stringify({ usernames: [argument], excludeBannedUsers: false })
|
||||
});
|
||||
const data = await res.json();
|
||||
logger.debug(`[rbx] fetched user data (roblox, standard) for "${argument}": ${JSON.stringify(data)}`);
|
||||
|
||||
const extra_res = await fetch(`https://users.roproxy.com/v1/users/${data.data[0].id}`, {
|
||||
if (!data.data || !data.data[0]) {
|
||||
throw new Error('User not found');
|
||||
}
|
||||
const extra_res = await fetch(`https://users.roblox.com/v1/users/${data.data[0].id}`, {
|
||||
method: 'GET',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${process.env.ROBLOSECURITY}` }
|
||||
});
|
||||
const extra_data = await extra_res.json();
|
||||
logger.debug(`[rbx] fetched user data (roblox, extra) for "${argument}": ${JSON.stringify(extra_data)}`);
|
||||
|
||||
const r_res = await fetch(`https://api.rolimons.com/players/v1/playerinfo/${data.data[0].id}`, {
|
||||
method: 'GET',
|
||||
@@ -120,16 +125,13 @@ module.exports = {
|
||||
logger.warn(`[rbx] Failed to fetch rolimons playerinfo for id ${data.data[0].id}: HTTP ${r_res.status}`);
|
||||
r_data = {};
|
||||
}
|
||||
logger.debug(`[rbx] fetched user data (rolimons) for "${argument}": ${JSON.stringify(r_data)}`);
|
||||
|
||||
const ra_res = await fetch(`https://api.rolimons.com/players/v1/playerassets/${data.data[0].id}`, {
|
||||
method: 'GET',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
const ra_data = await ra_res.json();
|
||||
|
||||
logger.debug(`[rbx] fetched user data (roblox, standard) for "${argument}": ${JSON.stringify(data)}`);
|
||||
logger.debug(`[rbx] fetched user data (roblox, extra) for "${argument}": ${JSON.stringify(extra_data)}`);
|
||||
logger.debug(`[rbx] fetched user data (rolimons) for "${argument}": ${JSON.stringify(r_data)}`);
|
||||
logger.debug(`[rbx] fetched user data (rolimons, assets) for "${argument}": ${JSON.stringify(ra_data)}`);
|
||||
|
||||
if (!data.data || !data.data[0]) {
|
||||
@@ -157,15 +159,20 @@ module.exports = {
|
||||
const viewInvRes = await fetch(`https://inventory.roblox.com/v1/users/${user.id}/can-view-inventory`);
|
||||
const isInvPublic = (await viewInvRes.json()).canView;
|
||||
|
||||
const formatted_desc = (extra_data.description || "no description")
|
||||
.split('\n')
|
||||
.map(line => line.trim() ? `-# *${line}*` : '')
|
||||
.join('\n');
|
||||
|
||||
embed = {
|
||||
color: 0x8aa2b3,
|
||||
author: {
|
||||
name: message.author.username,
|
||||
icon_url: message.author.displayAvatarURL(),
|
||||
},
|
||||
description: `**[${user.displayName}](https://www.roblox.com/users/${user.id}/profile)** [(${user.name})](https://www.rolimons.com/player/${user.id}) ${isOnline ? "<:online:1482657396362055826>" : "<:offline:1482657564650115073>"} ${hasPremium ? "<:premium:1482660040358760602>" : ""} ${hasCheckmark ? "<:Verified:1376786225486364823>" : ""}\n-# *${extra_data.description || "no description"}*`,
|
||||
description: `**[${user.displayName}](https://www.roblox.com/users/${user.id}/profile)** [(${user.name})](https://www.rolimons.com/player/${user.id}) ${isOnline ? "<:online:1482657396362055826>" : "<:offline:1482657564650115073>"} ${hasPremium ? "<:premium:1482660040358760602>" : ""} ${hasCheckmark ? "<:Verified:1376786225486364823>" : ""}\n${formatted_desc}`,
|
||||
fields: [
|
||||
{ name: 'id', value: String(user.id), inline: true },
|
||||
{ name: 'id', value: String(extra_data.id), inline: true },
|
||||
{ name: 'rap', value: String(r_data.rap), inline: true },
|
||||
{ name: 'value', value: String(r_data.value), inline: true },
|
||||
{ name: 'inventory', value: `${isInvPublic ? 'public' : 'private'}`, inline: true },
|
||||
@@ -203,9 +210,27 @@ module.exports = {
|
||||
}
|
||||
} else if (subcommand === 'item') {
|
||||
try {
|
||||
const res = await fetch(`https://economy.roproxy.com/v2/assets/${argument}/details`);
|
||||
const p_res = await fetch(`https://thumbnails.roproxy.com/v1/ assets?assetIds=${argument}&returnPolicy=PlaceHolder&size=420x420&format=Png&isCircular=false`)
|
||||
const resale_res = await fetch(`https://economy.roproxy.com/v1/assets/${argument}/resale-data`);
|
||||
const res = await fetch(`https://economy.roblox.com/v2/assets/${argument}/details`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Cookie': `.ROBLOSECURITY=${process.env.ROBLOSECURITY}`
|
||||
}
|
||||
});
|
||||
const p_res = await fetch(`https://thumbnails.roblox.com/v1/assets?assetIds=${argument}&returnPolicy=PlaceHolder&size=420x420&format=Png&isCircular=false`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Cookie': `.ROBLOSECURITY=${process.env.ROBLOSECURITY}`
|
||||
}
|
||||
});
|
||||
const resale_res = await fetch(`https://economy.roblox.com/v1/assets/${argument}/resale-data`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Cookie': `.ROBLOSECURITY=${process.env.ROBLOSECURITY}`
|
||||
}
|
||||
});
|
||||
|
||||
const item = await res.json();
|
||||
logger.debug(`[rbx] fetched item data (roblox) for "${argument}": ${JSON.stringify(item)}`);
|
||||
@@ -237,6 +262,13 @@ module.exports = {
|
||||
const item_thumb = await fetch_item_thumb(item.AssetId);
|
||||
const is_offsale = item.IsForSale;
|
||||
|
||||
const is_limited = item.IsLimited;
|
||||
const is_limited_unique = item.IsLimitedUnique;
|
||||
|
||||
const is_limited_at_all = is_limited || is_limited_unique;
|
||||
|
||||
const limited_string = is_limited ? (is_limited_unique ? "true (unique)" : "true") : "false";
|
||||
|
||||
embed = {
|
||||
color: 0x8aa2b3,
|
||||
author: {
|
||||
@@ -247,8 +279,8 @@ module.exports = {
|
||||
fields: [
|
||||
{ name: "id", value: `${item.AssetId}`, inline: true },
|
||||
{ name: "price", value: `${is_offsale ? "offsale" : item.PriceInRobux}`, inline: true },
|
||||
{ name: "limited", value: `${item.IsLimited}`, inline: true },
|
||||
{ name: "rap", value: `${item.IsLimited ? resale_data.recentAveragePrice : "0"}`, inline: true },
|
||||
{ name: "limited", value: `${limited_string}`, inline: true },
|
||||
{ name: "rap", value: `${is_limited_at_all ? resale_data.recentAveragePrice : "0"}`, inline: true },
|
||||
{ name: "creator", value: `${item.Creator.Name}`, inline: true },
|
||||
],
|
||||
thumbnail: {
|
||||
|
||||
Reference in new issue
Block a user