lock, mute, prefix, tempban
This commit is contained in:
1 parent
27894dac21
commit
f637673a4e
18 files changed
+3482
-2658
No files matched your search
@@ -4,6 +4,7 @@ const { time } = require("discord.js");
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const logger = require('../../utils/logger');
|
||||
const env = process.env;
|
||||
|
||||
async function fetch_avatar(id) {
|
||||
const res = await fetch(`https://thumbnails.roproxy.com/v1/users/avatar?userIds=${id}&size=420x420&format=Png&isCircular=false`, {
|
||||
@@ -47,7 +48,7 @@ module.exports = {
|
||||
name: 'rbx',
|
||||
description: `various commands related to roblox`,
|
||||
aliases: ['roblox'],
|
||||
usage: 'rbx user <username>\n.rbx item <item id>\n.rbx group <group id>\n.rbx game <game id>',
|
||||
usage: `rbx user <username>\n${env.PREFIX}rbx item <item id>\n${env.PREFIX}rbx group <group id>\n${env.PREFIX}rbx game <game id>\n${env.PREFIX}rbx avatar <username>`,
|
||||
|
||||
async execute(client, message) {
|
||||
var embed = {};
|
||||
@@ -91,49 +92,46 @@ module.exports = {
|
||||
}]
|
||||
});
|
||||
|
||||
let latency = Date.now() - message.createdTimestamp;
|
||||
let apiLatency = Math.round(client.ws.ping);
|
||||
const res = await fetch(`https://users.roblox.com/v1/usernames/users`, {
|
||||
method: 'POST',
|
||||
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)}`);
|
||||
|
||||
if (!data.data || !data.data[0]) {
|
||||
throw new Error(`user ${argument} not found...`);
|
||||
}
|
||||
const extra_res = await fetch(`https://users.roblox.com/v1/users/${data.data[0].id}`, {
|
||||
method: 'GET',
|
||||
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',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
let r_data = {};
|
||||
if (r_res.ok) {
|
||||
r_data = await r_res.json();
|
||||
} else {
|
||||
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 (rolimons, assets) for "${argument}": ${JSON.stringify(ra_data)}`);
|
||||
|
||||
if (subcommand === 'user' || subcommand === 'u') {
|
||||
try {
|
||||
const res = await fetch(`https://users.roproxy.com/v1/usernames/users`, {
|
||||
method: 'POST',
|
||||
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)}`);
|
||||
|
||||
if (!data.data || !data.data[0]) {
|
||||
throw new Error('User not found');
|
||||
}
|
||||
const extra_res = await fetch(`https://users.roproxy.com/v1/users/${data.data[0].id}`, {
|
||||
method: 'GET',
|
||||
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',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
let r_data = {};
|
||||
if (r_res.ok) {
|
||||
r_data = await r_res.json();
|
||||
} else {
|
||||
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 (rolimons, assets) for "${argument}": ${JSON.stringify(ra_data)}`);
|
||||
|
||||
if (!data.data || !data.data[0]) {
|
||||
embed = {
|
||||
color: 0x8aa2b3,
|
||||
@@ -208,6 +206,48 @@ module.exports = {
|
||||
timestamp: new Date(),
|
||||
}
|
||||
}
|
||||
} else if (subcommand === 'avatar') {
|
||||
try {
|
||||
const user = data.data[0];
|
||||
const a_res = await fetch(`https://thumbnails.roproxy.com/v1/users/avatar?userIds=${user.id}&size=720x720&format=Png&isCircular=false`, {
|
||||
method: 'GET',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
const a_data = await a_res.json();
|
||||
logger.debug(`[rbx] fetched avatar for "${argument}": ${JSON.stringify(a_data)}`);
|
||||
|
||||
embed = {
|
||||
color: 0x8aa2b3,
|
||||
author: {
|
||||
name: message.author.username,
|
||||
icon_url: message.author.displayAvatarURL(),
|
||||
},
|
||||
description: `**${user.displayName}**'s avatar`,
|
||||
footer: {
|
||||
text: `twitter @ ${message.guild.name}`,
|
||||
icon_url: client.user.displayAvatarURL(),
|
||||
},
|
||||
image: {
|
||||
url: `${a_data.data[0].imageUrl}`
|
||||
},
|
||||
timestamp: new Date(),
|
||||
};
|
||||
} catch (err) {
|
||||
logger.error(`[rbx] failed to fetch avatar for user id "${argument}":`, err);
|
||||
embed = {
|
||||
color: 0x8aa2b3,
|
||||
author: {
|
||||
name: message.author.username,
|
||||
icon_url: message.author.displayAvatarURL(),
|
||||
},
|
||||
description: `<:no:1481811955592466492> could not fetch avatar data for user "${argument}"!`,
|
||||
footer: {
|
||||
text: `twitter @ ${message.guild.name}`,
|
||||
icon_url: client.user.displayAvatarURL(),
|
||||
},
|
||||
timestamp: new Date(),
|
||||
};
|
||||
}
|
||||
} else if (subcommand === 'item') {
|
||||
try {
|
||||
const res = await fetch(`https://economy.roproxy.com/v2/assets/${argument}/details`, {
|
||||
|
||||
Reference in new issue
Block a user