Just not use noblox, sad
This commit is contained in:
parent
21ca648c3d
commit
f76cfb0602
105
index.js
105
index.js
|
@ -2,20 +2,10 @@ require("dotenv").config()
|
|||
const Discord = require("discord.js")
|
||||
const colors = require("colors")
|
||||
const express = require("express")
|
||||
const noblox = require("noblox.js")
|
||||
const fs = require("fs")
|
||||
const { url } = require("inspector")
|
||||
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({
|
||||
intents: [
|
||||
"Guilds"
|
||||
|
@ -76,23 +66,11 @@ app.get("/api/v1/check/:placeId/:userId", async (req, res) => {
|
|||
reason: row.reason
|
||||
}).status(200);
|
||||
if (req.query.nolog) return;
|
||||
userInfo = await noblox.getPlayerInfo(userId)
|
||||
userThumbnail = await noblox.getPlayerThumbnail([userId], 720, "png", false, "body")
|
||||
const embed = {
|
||||
title: "Banned user attempted to join",
|
||||
thumbnail: {
|
||||
url: userThumbnail[0].imageUrl
|
||||
},
|
||||
color: 0xff0000,
|
||||
description: `User: ${userId}`,
|
||||
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",
|
||||
value: `Reason: ${row.reason}
|
||||
|
@ -199,8 +177,6 @@ Client.on("interactionCreate", async (interaction) => {
|
|||
// If the user isnt already banned, ban them
|
||||
userId = await interaction.options.get("user").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) => {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
|
@ -220,19 +196,9 @@ Client.on("interactionCreate", async (interaction) => {
|
|||
} else {
|
||||
embed = {
|
||||
title: "User banned",
|
||||
thumbnail: {
|
||||
url: userThumbnail[0].imageUrl
|
||||
},
|
||||
color: 0xff0000,
|
||||
description: `User: ${userId}`,
|
||||
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",
|
||||
value: `Reason: ${reason}
|
||||
|
@ -254,19 +220,9 @@ Client.on("interactionCreate", async (interaction) => {
|
|||
} else {
|
||||
embed = {
|
||||
title: "User banned",
|
||||
thumbnail: {
|
||||
url: userThumbnail[0].imageUrl
|
||||
},
|
||||
color: 0xff0000,
|
||||
description: `User: ${userId}`,
|
||||
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",
|
||||
value: `Reason: ${reason}
|
||||
|
@ -289,8 +245,6 @@ Client.on("interactionCreate", async (interaction) => {
|
|||
case "unban":
|
||||
// If the user is banned, unban them
|
||||
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) => {
|
||||
if (err) {
|
||||
|
@ -318,19 +272,9 @@ Client.on("interactionCreate", async (interaction) => {
|
|||
} else {
|
||||
embed = {
|
||||
title: "User unbanned",
|
||||
thumbnail: {
|
||||
url: userThumbnail[0].imageUrl
|
||||
},
|
||||
color: 0x00ff00,
|
||||
description: `User: ${userId}`,
|
||||
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",
|
||||
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
|
||||
userId = await interaction.options.get("user").value
|
||||
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) => {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
|
@ -369,19 +310,9 @@ Client.on("interactionCreate", async (interaction) => {
|
|||
if (row.banned === 1) {
|
||||
embed = {
|
||||
title: "User is banned",
|
||||
thumbnail: {
|
||||
url: userThumbnail[0].imageUrl
|
||||
},
|
||||
color: 0xff0000,
|
||||
description: `User: ${userId}`,
|
||||
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",
|
||||
value: `Reason: ${row.reason}
|
||||
|
@ -393,19 +324,9 @@ Client.on("interactionCreate", async (interaction) => {
|
|||
} else {
|
||||
embed = {
|
||||
title: "User is not banned",
|
||||
thumbnail: {
|
||||
url: userThumbnail[0].imageUrl
|
||||
},
|
||||
color: 0x00ff00,
|
||||
description: `User: ${userId}`,
|
||||
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",
|
||||
value: `Reason: ${row.reason}
|
||||
|
@ -418,20 +339,8 @@ Client.on("interactionCreate", async (interaction) => {
|
|||
} else {
|
||||
embed = {
|
||||
title: "User is not banned",
|
||||
thumbnail: {
|
||||
url: userThumbnail[0].imageUrl
|
||||
},
|
||||
color: 0x00ff00,
|
||||
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}`
|
||||
}
|
||||
]
|
||||
description: `User: ${userId}`,
|
||||
}
|
||||
interaction.editReply({ embeds: [embed], ephemeral: true })
|
||||
}
|
||||
|
|
864
package-lock.json
generated
864
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -14,7 +14,6 @@
|
|||
"discord.js": "^14.15.3",
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^4.19.2",
|
||||
"noblox.js": "^6.0.2",
|
||||
"sqlite3": "^5.1.7"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue