Just not use noblox, sad

This commit is contained in:
Christopher Cookman 2024-08-20 15:03:49 -06:00
parent 21ca648c3d
commit f76cfb0602
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42
3 changed files with 7 additions and 963 deletions

105
index.js
View file

@ -2,20 +2,10 @@ require("dotenv").config()
const Discord = require("discord.js") const Discord = require("discord.js")
const colors = require("colors") const colors = require("colors")
const express = require("express") const express = require("express")
const noblox = require("noblox.js")
const fs = require("fs") const fs = require("fs")
const { url } = require("inspector") const { url } = require("inspector")
const sqlite3 = require("sqlite3").verbose() const sqlite3 = require("sqlite3").verbose()
if (process.env.COOKIE) {
noblox.setCookie(process.env.COOKIE);
console.log(`${colors.cyan("[noblox]")} Cookie set`);
}
if (process.env.OPENCLOUDKEY) {
noblox.setAPIKey(process.env.OPENCLOUDKEY);
console.log(`${colors.cyan("[noblox]")} OpenCloud API Key set`);
}
const Client = new Discord.Client({ const Client = new Discord.Client({
intents: [ intents: [
"Guilds" "Guilds"
@ -76,23 +66,11 @@ app.get("/api/v1/check/:placeId/:userId", async (req, res) => {
reason: row.reason reason: row.reason
}).status(200); }).status(200);
if (req.query.nolog) return; if (req.query.nolog) return;
userInfo = await noblox.getPlayerInfo(userId)
userThumbnail = await noblox.getPlayerThumbnail([userId], 720, "png", false, "body")
const embed = { const embed = {
title: "Banned user attempted to join", title: "Banned user attempted to join",
thumbnail: {
url: userThumbnail[0].imageUrl
},
color: 0xff0000, color: 0xff0000,
description: `User: ${userId}`,
fields: [ fields: [
{
name: "User Details",
value: `@${userInfo.username} ${userInfo.displayName} (${userId})
Joined <t:${Math.floor(new Date(userInfo.joinDate) / 1000)}:R> <t:${Math.floor(new Date(userInfo.joinDate) / 1000)}:D>
Friends: ${userInfo.friendCount}
Followers: ${userInfo.followerCount}
Following: ${userInfo.followingCount}`
},
{ {
name: "Ban Details", name: "Ban Details",
value: `Reason: ${row.reason} value: `Reason: ${row.reason}
@ -199,8 +177,6 @@ Client.on("interactionCreate", async (interaction) => {
// If the user isnt already banned, ban them // If the user isnt already banned, ban them
userId = await interaction.options.get("user").value userId = await interaction.options.get("user").value
reason = await interaction.options.get("reason").value reason = await interaction.options.get("reason").value
userInfo = await noblox.getPlayerInfo(userId)
userThumbnail = await noblox.getPlayerThumbnail([userId], 720, "png", false, "body")
db.get("SELECT * FROM bans WHERE userId = ?", [userId], (err, row) => { db.get("SELECT * FROM bans WHERE userId = ?", [userId], (err, row) => {
if (err) { if (err) {
console.error(err) console.error(err)
@ -220,19 +196,9 @@ Client.on("interactionCreate", async (interaction) => {
} else { } else {
embed = { embed = {
title: "User banned", title: "User banned",
thumbnail: {
url: userThumbnail[0].imageUrl
},
color: 0xff0000, color: 0xff0000,
description: `User: ${userId}`,
fields: [ fields: [
{
name: "User Details",
value: `@${userInfo.username} ${userInfo.displayName} (${userId})
Joined <t:${Math.floor(new Date(userInfo.joinDate) / 1000)}:R> <t:${Math.floor(new Date(userInfo.joinDate) / 1000)}:D>
Friends: ${userInfo.friendCount}
Followers: ${userInfo.followerCount}
Following: ${userInfo.followingCount}`
},
{ {
name: "Ban Details", name: "Ban Details",
value: `Reason: ${reason} value: `Reason: ${reason}
@ -254,19 +220,9 @@ Client.on("interactionCreate", async (interaction) => {
} else { } else {
embed = { embed = {
title: "User banned", title: "User banned",
thumbnail: {
url: userThumbnail[0].imageUrl
},
color: 0xff0000, color: 0xff0000,
description: `User: ${userId}`,
fields: [ fields: [
{
name: "User Details",
value: `@${userInfo.username} ${userInfo.displayName} (${userId})
Joined <t:${Math.floor(new Date(userInfo.joinDate) / 1000)}:R> <t:${Math.floor(new Date(userInfo.joinDate) / 1000)}:D>
Friends: ${userInfo.friendCount}
Followers: ${userInfo.followerCount}
Following: ${userInfo.followingCount}`
},
{ {
name: "Ban Details", name: "Ban Details",
value: `Reason: ${reason} value: `Reason: ${reason}
@ -289,8 +245,6 @@ Client.on("interactionCreate", async (interaction) => {
case "unban": case "unban":
// If the user is banned, unban them // If the user is banned, unban them
userId = await interaction.options.get("user").value userId = await interaction.options.get("user").value
userInfo = await noblox.getPlayerInfo(userId)
userThumbnail = await noblox.getPlayerThumbnail([userId], 720, "png", false, "body")
db.get("SELECT * FROM bans WHERE userId = ?", [userId], (err, row) => { db.get("SELECT * FROM bans WHERE userId = ?", [userId], (err, row) => {
if (err) { if (err) {
@ -318,19 +272,9 @@ Client.on("interactionCreate", async (interaction) => {
} else { } else {
embed = { embed = {
title: "User unbanned", title: "User unbanned",
thumbnail: {
url: userThumbnail[0].imageUrl
},
color: 0x00ff00, color: 0x00ff00,
description: `User: ${userId}`,
fields: [ fields: [
{
name: "User Details",
value: `@${userInfo.username} ${userInfo.displayName} (${userId})
Joined <t:${Math.floor(new Date(userInfo.joinDate) / 1000)}:R> <t:${Math.floor(new Date(userInfo.joinDate) / 1000)}:D>
Friends: ${userInfo.friendCount}
Followers: ${userInfo.followerCount}
Following: ${userInfo.followingCount}`
},
{ {
name: "Ban Details", name: "Ban Details",
value: `Reason: ${row.reason} value: `Reason: ${row.reason}
@ -354,9 +298,6 @@ Client.on("interactionCreate", async (interaction) => {
// Check if the user is banned, if they are get their user details with noblox // Check if the user is banned, if they are get their user details with noblox
userId = await interaction.options.get("user").value userId = await interaction.options.get("user").value
await interaction.deferReply({ephemeral: true}) await interaction.deferReply({ephemeral: true})
userInfo = await noblox.getPlayerInfo(userId)
userThumbnail = await noblox.getPlayerThumbnail([userId], 720, "png", false, "body")
db.get("SELECT * FROM bans WHERE userId = ?", [userId], async (err, row) => { db.get("SELECT * FROM bans WHERE userId = ?", [userId], async (err, row) => {
if (err) { if (err) {
console.error(err) console.error(err)
@ -369,19 +310,9 @@ Client.on("interactionCreate", async (interaction) => {
if (row.banned === 1) { if (row.banned === 1) {
embed = { embed = {
title: "User is banned", title: "User is banned",
thumbnail: {
url: userThumbnail[0].imageUrl
},
color: 0xff0000, color: 0xff0000,
description: `User: ${userId}`,
fields: [ fields: [
{
name: "User Details",
value: `@${userInfo.username} ${userInfo.displayName} (${userId})
Joined <t:${Math.floor(new Date(userInfo.joinDate) / 1000)}:R> <t:${Math.floor(new Date(userInfo.joinDate) / 1000)}:D>
Friends: ${userInfo.friendCount}
Followers: ${userInfo.followerCount}
Following: ${userInfo.followingCount}`
},
{ {
name: "Ban Details", name: "Ban Details",
value: `Reason: ${row.reason} value: `Reason: ${row.reason}
@ -393,19 +324,9 @@ Client.on("interactionCreate", async (interaction) => {
} else { } else {
embed = { embed = {
title: "User is not banned", title: "User is not banned",
thumbnail: {
url: userThumbnail[0].imageUrl
},
color: 0x00ff00, color: 0x00ff00,
description: `User: ${userId}`,
fields: [ fields: [
{
name: "User Details",
value: `@${userInfo.username} ${userInfo.displayName} (${userId})
Joined <t:${Math.floor(new Date(userInfo.joinDate) / 1000)}:R> <t:${Math.floor(new Date(userInfo.joinDate) / 1000)}:D>
Friends: ${userInfo.friendCount}
Followers: ${userInfo.followerCount}
Following: ${userInfo.followingCount}`
},
{ {
name: "Last Ban Details", name: "Last Ban Details",
value: `Reason: ${row.reason} value: `Reason: ${row.reason}
@ -418,20 +339,8 @@ Client.on("interactionCreate", async (interaction) => {
} else { } else {
embed = { embed = {
title: "User is not banned", title: "User is not banned",
thumbnail: {
url: userThumbnail[0].imageUrl
},
color: 0x00ff00, color: 0x00ff00,
fields: [ description: `User: ${userId}`,
{
name: "User Details",
value: `@${userInfo.username} ${userInfo.displayName} (${userId})
Joined <t:${Math.floor(new Date(userInfo.joinDate) / 1000)}:R> <t:${Math.floor(new Date(userInfo.joinDate) / 1000)}:D>
Friends: ${userInfo.friendCount}
Followers: ${userInfo.followerCount}
Following: ${userInfo.followingCount}`
}
]
} }
interaction.editReply({ embeds: [embed], ephemeral: true }) interaction.editReply({ embeds: [embed], ephemeral: true })
} }

864
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -14,7 +14,6 @@
"discord.js": "^14.15.3", "discord.js": "^14.15.3",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"express": "^4.19.2", "express": "^4.19.2",
"noblox.js": "^6.0.2",
"sqlite3": "^5.1.7" "sqlite3": "^5.1.7"
} }
} }