Moved from mongodb to sql and sqlite
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
FROM node:20.9.0-alpine3.18
|
FROM node:20.9.0-alpine3.18
|
||||||
|
|
||||||
RUN apk add git fish openssh gnupg fish
|
RUN apk add git fish openssh gnupg fish
|
||||||
RUN yarn global add typescript ts-node nodemon
|
RUN yarn global add typescript ts-node nodemon
|
||||||
|
|
||||||
RUN sed -i 's/bin\/ash/usr\/bin\/fish/g' /etc/passwd
|
RUN sed -i 's/bin\/ash/usr\/bin\/fish/g' /etc/passwd
|
||||||
|
|
||||||
RUN mkdir -p /root/.ssh
|
RUN mkdir -p /root/.ssh
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -2,4 +2,5 @@
|
|||||||
.yarn/
|
.yarn/
|
||||||
node_modules/*
|
node_modules/*
|
||||||
.env
|
.env
|
||||||
dist/
|
dist/
|
||||||
|
data/
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
logging:
|
logging:
|
||||||
driver: journald
|
driver: journald
|
||||||
|
volumes:
|
||||||
|
- ${DB_PATH}:/app/data
|
||||||
environment:
|
environment:
|
||||||
- TOKEN=${TOKEN}
|
- TOKEN=${TOKEN}
|
||||||
- MONGOURI=${MONGOURI}
|
- MONGOURI=${MONGOURI}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
"ignore": [
|
"ignore": [
|
||||||
".git",
|
".git",
|
||||||
"node_modules/**/node_modules",
|
"node_modules/**/node_modules",
|
||||||
"src"
|
"src",
|
||||||
|
"data"
|
||||||
],
|
],
|
||||||
"verbose": true,
|
"verbose": true,
|
||||||
"env": {
|
"env": {
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
"restartable": "rs",
|
"restartable": "rs",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
".git",
|
".git",
|
||||||
"node_modules/**/node_modules"
|
"node_modules/**/node_modules",
|
||||||
|
"data"
|
||||||
],
|
],
|
||||||
"verbose": true,
|
"verbose": true,
|
||||||
"env": {
|
"env": {
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
"mongoose": "^8.2.1",
|
"mongoose": "^8.2.1",
|
||||||
"ms": "^2.1.3",
|
"ms": "^2.1.3",
|
||||||
"pretty-ms": "^9.0.0",
|
"pretty-ms": "^9.0.0",
|
||||||
|
"sequelize": "^6.37.2",
|
||||||
|
"sqlite3": "^5.1.7",
|
||||||
"youtube-ext": "^1.1.16"
|
"youtube-ext": "^1.1.16"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -16,10 +16,11 @@ export = {
|
|||||||
const message = await interaction.channel!.messages.fetch(targetId)
|
const message = await interaction.channel!.messages.fetch(targetId)
|
||||||
|
|
||||||
if (!message) {
|
if (!message) {
|
||||||
return interaction.reply({
|
interaction.reply({
|
||||||
content: "That user does not exist.",
|
content: "That user does not exist.",
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
})
|
})
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const target = message.author
|
const target = message.author
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ApplicationCommandType, ContextMenuCommandBuilder, PermissionFlagsBits, userMention } from "discord.js"
|
import { ApplicationCommandType, ContextMenuCommandBuilder, PermissionFlagsBits, userMention } from "discord.js"
|
||||||
import { embedColor, devMessage, hypixelGuildID } from "config/options"
|
import { embedColor, devMessage, hypixelGuildID } from "config/options"
|
||||||
import { IContextMenu } from "interfaces"
|
import { IContextMenu } from "interfaces"
|
||||||
import verifySchema from "schemas/verifySchema"
|
import verify from "schemas/verifyTag"
|
||||||
import { getGuild, getHeadURL, getIGN } from "utils/Hypixel"
|
import { getGuild, getHeadURL, getIGN } from "utils/Hypixel"
|
||||||
import roleManage from "utils/functions/rolesmanage"
|
import roleManage from "utils/functions/rolesmanage"
|
||||||
import { waitingListRole } from "config/roles"
|
import { waitingListRole } from "config/roles"
|
||||||
@@ -23,7 +23,7 @@ export = {
|
|||||||
const targetId = interaction.targetId
|
const targetId = interaction.targetId
|
||||||
const user = await interaction.guild!.members.fetch(targetId)
|
const user = await interaction.guild!.members.fetch(targetId)
|
||||||
const usermentioned = userMention(user.user.id)
|
const usermentioned = userMention(user.user.id)
|
||||||
const verifyData = await verifySchema.findOne({ userID: user.user.id })
|
const verifyData = await verify.findOne({ where: { userID: user.user.id } })
|
||||||
|
|
||||||
if (!verifyData) {
|
if (!verifyData) {
|
||||||
await user.setNickname(`${user.user.username} (X)`, "User used the update command").catch(() => {
|
await user.setNickname(`${user.user.username} (X)`, "User used the update command").catch(() => {
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import { SlashCommandBuilder, PermissionFlagsBits } from "discord.js"
|
import { SlashCommandBuilder, PermissionFlagsBits } from "discord.js"
|
||||||
import { embedColor } from "config/options"
|
import { embedColor } from "config/options"
|
||||||
import mongoose from "mongoose"
|
|
||||||
import { ICommand } from "interfaces"
|
import { ICommand } from "interfaces"
|
||||||
import settings from "schemas/settingsSchema"
|
import settings from "schemas/settingsTag"
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
name: "config",
|
name: "config",
|
||||||
description: "Configure the bot",
|
description: "Configure the bot",
|
||||||
dev: false,
|
dev: true,
|
||||||
public: false,
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -37,17 +36,14 @@ export = {
|
|||||||
|
|
||||||
const setting = interaction.options.getString("setting")!
|
const setting = interaction.options.getString("setting")!
|
||||||
const value = interaction.options.getString("value")!
|
const value = interaction.options.getString("value")!
|
||||||
const settingsData = await settings.findOne({ name: setting })
|
const settingsData = await settings.findOne({ where: { name: setting } })
|
||||||
|
|
||||||
if (!settingsData) {
|
if (!settingsData) {
|
||||||
const newSetting = new settings({
|
await settings.create({
|
||||||
_id: new mongoose.Types.ObjectId(),
|
|
||||||
name: setting,
|
name: setting,
|
||||||
value: value
|
value: value
|
||||||
})
|
})
|
||||||
|
|
||||||
await newSetting.save()
|
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
description: "Successfully created `" + setting + "` with value `" + value + "`.",
|
description: "Successfully created `" + setting + "` with value `" + value + "`.",
|
||||||
@@ -55,7 +51,7 @@ export = {
|
|||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
await settings.findOneAndUpdate({ name: setting }, { value: value })
|
await settingsData.destroy()
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { devMessage, embedColor } from "config/options"
|
import { devMessage, embedColor } from "config/options"
|
||||||
import { PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js"
|
import { PermissionFlagsBits, SlashCommandBuilder, userMention } from "discord.js"
|
||||||
import { ICommand } from "interfaces"
|
import { ICommand } from "interfaces"
|
||||||
import verifySchema from "schemas/verifySchema"
|
import verify from "schemas/verifyTag"
|
||||||
import { getHeadURL, getIGN, getUUID } from "utils/Hypixel"
|
import { getHeadURL, getIGN, getUUID } from "utils/Hypixel"
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
name: "find",
|
name: "find",
|
||||||
description: "Find a person by the ign",
|
description: "Find a person by the ign",
|
||||||
dev: false,
|
dev: true,
|
||||||
public: false,
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -37,7 +37,7 @@ export = {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const verifyData = await verifySchema.findOne({ uuid: uuid })
|
const verifyData = await verify.findOne({ where: { uuid: uuid } })
|
||||||
if (!verifyData) {
|
if (!verifyData) {
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js"
|
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js"
|
||||||
import { embedColor, devMessage } from "config/options"
|
import { embedColor, devMessage } from "config/options"
|
||||||
import verify from "schemas/verifySchema"
|
import verify from "schemas/verifyTag"
|
||||||
import { ICommand } from "interfaces"
|
import { ICommand } from "interfaces"
|
||||||
import roleManage from "utils/functions/rolesmanage"
|
import roleManage from "utils/functions/rolesmanage"
|
||||||
import logToChannel from "utils/functions/logtochannel"
|
import logToChannel from "utils/functions/logtochannel"
|
||||||
@@ -10,7 +10,7 @@ import { removeIndents } from "utils/functions/funcs"
|
|||||||
export = {
|
export = {
|
||||||
name: "forceunverify",
|
name: "forceunverify",
|
||||||
description: "Force unverify a user",
|
description: "Force unverify a user",
|
||||||
dev: false,
|
dev: true,
|
||||||
public: false,
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -27,21 +27,22 @@ export = {
|
|||||||
|
|
||||||
async execute({ interaction }) {
|
async execute({ interaction }) {
|
||||||
const member = interaction.options.getMember("user") as GuildMember
|
const member = interaction.options.getMember("user") as GuildMember
|
||||||
const verifiedUser = await verify.findOne({ userID: member.user.id })
|
const verifiedUser = await verify.findOne({ where: { userID: member.user.id } })
|
||||||
const mod = interaction.user
|
const mod = interaction.user
|
||||||
|
|
||||||
if (!verifiedUser) {
|
if (!verifiedUser) {
|
||||||
return interaction.reply({
|
interaction.reply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
description: "This user is not verified",
|
description: "This user is not verified",
|
||||||
color: embedColor
|
color: embedColor
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const uuid = verifiedUser.uuid
|
const uuid = verifiedUser.uuid
|
||||||
const ign = await getIGN(uuid)
|
const ign = await getIGN(uuid)
|
||||||
await verify.findOneAndDelete({ userID: member.user.id })
|
await verifiedUser.destroy()
|
||||||
await member.roles.remove(
|
await member.roles.remove(
|
||||||
roleManage("all").rolesToRemove,
|
roleManage("all").rolesToRemove,
|
||||||
"User force unverified by " + interaction.user.username
|
"User force unverified by " + interaction.user.username
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js"
|
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js"
|
||||||
import { getGuild, getHeadURL, getIGN } from "utils/Hypixel"
|
import { getGuild, getHeadURL, getIGN } from "utils/Hypixel"
|
||||||
import { hypixelGuildID, embedColor, devMessage } from "config/options"
|
import { hypixelGuildID, embedColor, devMessage } from "config/options"
|
||||||
import verify from "schemas/verifySchema"
|
import verify from "schemas/verifyTag"
|
||||||
import { ICommand } from "interfaces"
|
import { ICommand } from "interfaces"
|
||||||
import roleManage from "utils/functions/rolesmanage"
|
import roleManage from "utils/functions/rolesmanage"
|
||||||
import { waitingListRole } from "config/roles"
|
import { waitingListRole } from "config/roles"
|
||||||
@@ -10,7 +10,7 @@ import { removeIndents } from "utils/functions/funcs"
|
|||||||
export = {
|
export = {
|
||||||
name: "forceupdate",
|
name: "forceupdate",
|
||||||
description: "Force update the user",
|
description: "Force update the user",
|
||||||
dev: false,
|
dev: true,
|
||||||
public: false,
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -30,7 +30,7 @@ export = {
|
|||||||
|
|
||||||
const user = interaction.options.getMember("user") as GuildMember
|
const user = interaction.options.getMember("user") as GuildMember
|
||||||
const usermentioned = userMention(user.user.id)
|
const usermentioned = userMention(user.user.id)
|
||||||
const verifyData = await verify.findOne({ userID: user.user.id })
|
const verifyData = await verify.findOne({ where: { userID: user.user.id } })
|
||||||
|
|
||||||
if (!verifyData) {
|
if (!verifyData) {
|
||||||
await user.setNickname(`${user.user.username} (X)`, "User used the update command").catch(() => {
|
await user.setNickname(`${user.user.username} (X)`, "User used the update command").catch(() => {
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { SlashCommandBuilder, PermissionFlagsBits, GuildMember, userMention } from "discord.js"
|
import { SlashCommandBuilder, PermissionFlagsBits, GuildMember, userMention } from "discord.js"
|
||||||
import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
||||||
import { embedColor, hypixelGuildID, devMessage } from "config/options"
|
import { embedColor, hypixelGuildID, devMessage } from "config/options"
|
||||||
import verify from "schemas/verifySchema"
|
import verify from "schemas/verifyTag"
|
||||||
import mongoose from "mongoose"
|
|
||||||
import roleManage from "utils/functions/rolesmanage"
|
import roleManage from "utils/functions/rolesmanage"
|
||||||
import { ICommand } from "interfaces"
|
import { ICommand } from "interfaces"
|
||||||
import logToChannel from "utils/functions/logtochannel"
|
import logToChannel from "utils/functions/logtochannel"
|
||||||
@@ -11,7 +10,7 @@ import { removeIndents } from "utils/functions/funcs"
|
|||||||
export = {
|
export = {
|
||||||
name: "forceverify",
|
name: "forceverify",
|
||||||
description: "Force verify a user.",
|
description: "Force verify a user.",
|
||||||
dev: false,
|
dev: true,
|
||||||
public: false,
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -37,7 +36,7 @@ export = {
|
|||||||
const ign = interaction.options.getString("ign")
|
const ign = interaction.options.getString("ign")
|
||||||
const mod = interaction.user
|
const mod = interaction.user
|
||||||
|
|
||||||
const verifyData = await verify.findOne({ userID: user.user.id })
|
const verifyData = await verify.findOne({ where: { userID: user.user.id } })
|
||||||
if (verifyData) {
|
if (verifyData) {
|
||||||
interaction.editReply("That user is already verified.")
|
interaction.editReply("That user is already verified.")
|
||||||
return
|
return
|
||||||
@@ -160,14 +159,11 @@ export = {
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
})
|
})
|
||||||
|
|
||||||
const newVerify = new verify({
|
await verify.create({
|
||||||
_id: new mongoose.Types.ObjectId(),
|
userID: user.user.id,
|
||||||
userID: user.id,
|
uuid: uuid,
|
||||||
uuid: uuid
|
|
||||||
})
|
})
|
||||||
|
|
||||||
await newVerify.save()
|
|
||||||
|
|
||||||
await logToChannel("mod", {
|
await logToChannel("mod", {
|
||||||
embeds: [{
|
embeds: [{
|
||||||
author: {
|
author: {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js"
|
import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js"
|
||||||
import { embedColor, devMessage } from "config/options"
|
import { embedColor, devMessage } from "config/options"
|
||||||
import waitinglistSchema from "schemas/waitinglistSchema"
|
import waitinglist from "schemas/waitinglistTag"
|
||||||
import { ICommand } from "interfaces"
|
import { ICommand } from "interfaces"
|
||||||
import logToChannel from "utils/functions/logtochannel"
|
import logToChannel from "utils/functions/logtochannel"
|
||||||
import { waitingListRole } from "config/roles"
|
import { waitingListRole } from "config/roles"
|
||||||
@@ -9,7 +9,7 @@ import { removeIndents } from "utils/functions/funcs"
|
|||||||
export = {
|
export = {
|
||||||
name: "remove",
|
name: "remove",
|
||||||
description: "Remove a person on the waiting list.",
|
description: "Remove a person on the waiting list.",
|
||||||
dev: false,
|
dev: true,
|
||||||
public: false,
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -36,7 +36,7 @@ export = {
|
|||||||
const member = interaction.options.getMember("user") as GuildMember
|
const member = interaction.options.getMember("user") as GuildMember
|
||||||
const reason = interaction.options.getString("reason") ?? "No reason provided."
|
const reason = interaction.options.getString("reason") ?? "No reason provided."
|
||||||
const mod = interaction.user!
|
const mod = interaction.user!
|
||||||
const waitinglist = await waitinglistSchema.findOne({ userID: member.user.id })
|
const waiting = await waitinglist.findOne({ where: { userID: member.user.id } })
|
||||||
|
|
||||||
if (!waitinglist) {
|
if (!waitinglist) {
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
@@ -48,7 +48,7 @@ export = {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await waitinglistSchema.findOneAndDelete({ userID: member.user.id })
|
await waiting?.destroy()
|
||||||
await member.roles.remove(waitingListRole, "Removed from waiting list.")
|
await member.roles.remove(waitingListRole, "Removed from waiting list.")
|
||||||
|
|
||||||
await logToChannel("mod", {
|
await logToChannel("mod", {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { embedColor, hypixelGuildID } from "config/options"
|
import { embedColor, hypixelGuildID } from "config/options"
|
||||||
import { ChatInputCommandInteraction, GuildMember } from "discord.js"
|
import { ChatInputCommandInteraction, GuildMember } from "discord.js"
|
||||||
import verify from "schemas/verifySchema"
|
import verify from "schemas/verifyTag"
|
||||||
import { IGuildData } from "interfaces"
|
import { IGuildData } from "interfaces"
|
||||||
import env from "utils/Env"
|
import env from "utils/Env"
|
||||||
import { getGuild } from "utils/Hypixel"
|
import { getGuild } from "utils/Hypixel"
|
||||||
@@ -34,17 +34,7 @@ export default async function removeGuildRoles(interaction: ChatInputCommandInte
|
|||||||
|
|
||||||
const hypixelGuildMembers = guildData.members.map(gmember => gmember.uuid)
|
const hypixelGuildMembers = guildData.members.map(gmember => gmember.uuid)
|
||||||
|
|
||||||
const allVerifiedUsers = (await verify.find({})) as {
|
const verifiedUsers = await verify.findAll({})
|
||||||
userID: string
|
|
||||||
uuid: string
|
|
||||||
}[]
|
|
||||||
|
|
||||||
const verifiedUsers = allVerifiedUsers.map(user => {
|
|
||||||
return {
|
|
||||||
userID: user.userID,
|
|
||||||
uuid: user.uuid
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
for (const gmember of guildMembers) {
|
for (const gmember of guildMembers) {
|
||||||
const gmemberuuid = verifiedUsers.find(user => user.userID === gmember.id)?.uuid
|
const gmemberuuid = verifiedUsers.find(user => user.userID === gmember.id)?.uuid
|
||||||
@@ -60,4 +50,4 @@ export default async function removeGuildRoles(interaction: ChatInputCommandInte
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import verify from "schemas/verifySchema"
|
import verify from "schemas/verifyTag"
|
||||||
import { embedColor, hypixelGuildID } from "config/options"
|
import { embedColor, hypixelGuildID } from "config/options"
|
||||||
import color from "utils/functions/colors"
|
import color from "utils/functions/colors"
|
||||||
import { verifyTick } from "config/roles"
|
import { verifyTick } from "config/roles"
|
||||||
@@ -42,16 +42,7 @@ export default async function updateAll(interaction: ChatInputCommandInteraction
|
|||||||
})
|
})
|
||||||
const guildMemberIDs = hypixelGuildMembers.map(gmember => gmember.uuid)
|
const guildMemberIDs = hypixelGuildMembers.map(gmember => gmember.uuid)
|
||||||
|
|
||||||
const allVerifiedUsers = (await verify.find({})) as {
|
const verifiedUsers = await verify.findAll({})
|
||||||
userID: string
|
|
||||||
uuid: string
|
|
||||||
}[]
|
|
||||||
const verifiedUsers = allVerifiedUsers.map(user => {
|
|
||||||
return {
|
|
||||||
userID: user.userID,
|
|
||||||
uuid: user.uuid
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { GuildMember, SlashCommandBuilder } from "discord.js"
|
import { GuildMember, SlashCommandBuilder } from "discord.js"
|
||||||
import { getGuild, getIGN, getHeadURL } from "utils/Hypixel"
|
import { getGuild, getIGN, getHeadURL } from "utils/Hypixel"
|
||||||
import verify from "schemas/verifySchema"
|
import verify from "schemas/verifyTag"
|
||||||
import { embedColor, hypixelGuildID, devMessage } from "config/options"
|
import { embedColor, hypixelGuildID, devMessage } from "config/options"
|
||||||
import roleManage from "utils/functions/rolesmanage"
|
import roleManage from "utils/functions/rolesmanage"
|
||||||
import { ICommand } from "interfaces"
|
import { ICommand } from "interfaces"
|
||||||
@@ -10,7 +10,7 @@ import { removeIndents } from "utils/functions/funcs"
|
|||||||
export = {
|
export = {
|
||||||
name: "update",
|
name: "update",
|
||||||
description: "Update your guild rank.",
|
description: "Update your guild rank.",
|
||||||
dev: false,
|
dev: true,
|
||||||
public: true,
|
public: true,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -22,7 +22,7 @@ export = {
|
|||||||
await interaction.deferReply()
|
await interaction.deferReply()
|
||||||
|
|
||||||
const user = interaction.member as GuildMember
|
const user = interaction.member as GuildMember
|
||||||
const verifyData = await verify.findOne({ userID: user.user.id })
|
const verifyData = await verify.findOne({ where: { userID: user.user.id } })
|
||||||
|
|
||||||
if (!verifyData) {
|
if (!verifyData) {
|
||||||
await user.setNickname(`${user.user.username} (X)`, "User used the update command").catch(() => {
|
await user.setNickname(`${user.user.username} (X)`, "User used the update command").catch(() => {
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
import { GuildMember, SlashCommandBuilder } from "discord.js"
|
import { GuildMember, SlashCommandBuilder } from "discord.js"
|
||||||
import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
||||||
import { embedColor, hypixelGuildID, devMessage } from "config/options"
|
import { embedColor, hypixelGuildID, devMessage } from "config/options"
|
||||||
import mongoose from "mongoose"
|
|
||||||
import roleManage from "utils/functions/rolesmanage"
|
import roleManage from "utils/functions/rolesmanage"
|
||||||
import { ICommand } from "interfaces"
|
import { ICommand } from "interfaces"
|
||||||
import verify from "schemas/verifySchema"
|
import verify from "schemas/verifyTag"
|
||||||
import { IPlayerData } from "interfaces"
|
import { IPlayerData } from "interfaces"
|
||||||
import { IGuildData } from "interfaces"
|
import { IGuildData } from "interfaces"
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
name: "verify",
|
name: "verify",
|
||||||
description: "Verify yourself as a member of the server.",
|
description: "Verify yourself as a member of the server.",
|
||||||
dev: false,
|
dev: true,
|
||||||
public: true,
|
public: true,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -33,7 +32,7 @@ export = {
|
|||||||
const user = interaction.member! as GuildMember
|
const user = interaction.member! as GuildMember
|
||||||
const ign = interaction.options.getString("ign")!
|
const ign = interaction.options.getString("ign")!
|
||||||
|
|
||||||
const verifyData = await verify.findOne({ userID: user.id })
|
const verifyData = await verify.findOne({ where: { userID: user.id } })
|
||||||
if (verifyData) {
|
if (verifyData) {
|
||||||
interaction.editReply("You are already verified.\n" + "Try running /update to update your roles.")
|
interaction.editReply("You are already verified.\n" + "Try running /update to update your roles.")
|
||||||
return
|
return
|
||||||
@@ -178,14 +177,11 @@ export = {
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
})
|
})
|
||||||
|
|
||||||
const newVerify = new verify({
|
await verify.create({
|
||||||
_id: new mongoose.Types.ObjectId(),
|
|
||||||
userID: user.id,
|
userID: user.id,
|
||||||
uuid: uuid
|
uuid: uuid
|
||||||
})
|
})
|
||||||
|
|
||||||
await newVerify.save()
|
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
title: interaction.guild!.name,
|
title: interaction.guild!.name,
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { SlashCommandBuilder, userMention } from "discord.js"
|
import { SlashCommandBuilder, userMention } from "discord.js"
|
||||||
import { ICommand } from "interfaces"
|
import { ICommand } from "interfaces"
|
||||||
import { embedColor, devMessage } from "config/options"
|
import { embedColor, devMessage } from "config/options"
|
||||||
import verify from "schemas/verifySchema"
|
import verify from "schemas/verifyTag"
|
||||||
import { getIGN, getHeadURL } from "utils/Hypixel"
|
import { getIGN, getHeadURL } from "utils/Hypixel"
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
name: "whoami",
|
name: "whoami",
|
||||||
description: "Get your user info",
|
description: "Get your user info",
|
||||||
public: true,
|
public: true,
|
||||||
dev: false,
|
dev: true,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("whoami")
|
.setName("whoami")
|
||||||
@@ -19,7 +19,7 @@ export = {
|
|||||||
await interaction.deferReply()
|
await interaction.deferReply()
|
||||||
|
|
||||||
const user = interaction.user
|
const user = interaction.user
|
||||||
const verifyData = await verify.findOne({ userID: user.id })
|
const verifyData = await verify.findOne({ where: { userID: user.id } })
|
||||||
|
|
||||||
if (!verifyData) {
|
if (!verifyData) {
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { SlashCommandBuilder, PermissionFlagsBits, userMention } from "discord.js"
|
import { SlashCommandBuilder, PermissionFlagsBits, userMention } from "discord.js"
|
||||||
import { getIGN, getHeadURL } from "utils/Hypixel"
|
import { getIGN, getHeadURL } from "utils/Hypixel"
|
||||||
import { embedColor, devMessage } from "config/options"
|
import { embedColor, devMessage } from "config/options"
|
||||||
import verify from "schemas/verifySchema"
|
import verify from "schemas/verifyTag"
|
||||||
import { ICommand } from "interfaces"
|
import { ICommand } from "interfaces"
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
name: "whois",
|
name: "whois",
|
||||||
description: "Get's the ign of a user.",
|
description: "Get's the ign of a user.",
|
||||||
dev: false,
|
dev: true,
|
||||||
public: false,
|
public: false,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -26,7 +26,7 @@ export = {
|
|||||||
await interaction.deferReply()
|
await interaction.deferReply()
|
||||||
|
|
||||||
const user = interaction.options.getUser("user")!
|
const user = interaction.options.getUser("user")!
|
||||||
const verifiedUser = await verify.findOne({ userID: user.id })
|
const verifiedUser = await verify.findOne({ where: { userID: user.id } })
|
||||||
if (!verifiedUser) {
|
if (!verifiedUser) {
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { embedColor, devMessage } from "config/options"
|
import { embedColor, devMessage } from "config/options"
|
||||||
import guildapp from "schemas/guildAppSchema"
|
import guildapp from "schemas/guildAppTag"
|
||||||
import { bwfkdr, bwstars, bwwins, swstars, swkdr, duelswins, duelswlr } from "config/reqs"
|
import { bwfkdr, bwstars, bwwins, swstars, swkdr, duelswins, duelswlr } from "config/reqs"
|
||||||
import { hypixelLevel, bedwarsLevel, skywarsLevel, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
import { hypixelLevel, bedwarsLevel, skywarsLevel, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
||||||
import { IButton } from "interfaces"
|
import { IButton } from "interfaces"
|
||||||
@@ -14,7 +14,7 @@ export = {
|
|||||||
const message = interaction.message
|
const message = interaction.message
|
||||||
const embed = message.embeds[0]
|
const embed = message.embeds[0]
|
||||||
const applicantId = embed.footer!.text.split(" ")[1]
|
const applicantId = embed.footer!.text.split(" ")[1]
|
||||||
const guildappdata = await guildapp.findOne({ userID: applicantId })
|
const guildappdata = await guildapp.findOne({ where: { userID: applicantId } })
|
||||||
const uuid = guildappdata!.uuid
|
const uuid = guildappdata!.uuid
|
||||||
|
|
||||||
const player = await getPlayer(uuid)
|
const player = await getPlayer(uuid)
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { ActionRowBuilder, ButtonStyle, ButtonBuilder, TextChannel } from "discord.js"
|
import { ActionRowBuilder, ButtonStyle, ButtonBuilder, TextChannel } from "discord.js"
|
||||||
import { embedColor, waitingListChannel, waitingListMessage, hypixelGuildID } from "config/options"
|
import { embedColor, waitingListChannel, waitingListMessage, hypixelGuildID } from "config/options"
|
||||||
import color from "utils/functions/colors"
|
import color from "utils/functions/colors"
|
||||||
import mongoose from "mongoose"
|
import guildapp from "schemas/guildAppTag"
|
||||||
import guildapp from "schemas/guildAppSchema"
|
import waitingList from "schemas/waitinglistTag"
|
||||||
import waitingList from "schemas/waitinglistSchema"
|
|
||||||
import { waitingListRole } from "config/roles"
|
import { waitingListRole } from "config/roles"
|
||||||
import { IButton } from "interfaces"
|
import { IButton } from "interfaces"
|
||||||
import { getGuild, getIGN } from "utils/Hypixel"
|
import { getGuild, getIGN } from "utils/Hypixel"
|
||||||
@@ -54,21 +53,18 @@ export = {
|
|||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
const applicantEntry = await guildapp.findOne({ userID: applicantId })
|
const applicantEntry = await guildapp.findOne({ where: { userID: applicantId } })
|
||||||
const applicantUUID = applicantEntry!.uuid
|
const applicantUUID = applicantEntry!.uuid
|
||||||
const time = Date.now()
|
const time = Date.now()
|
||||||
|
|
||||||
const waitingListAdd = new waitingList({
|
await waitingList.create({
|
||||||
_id: new mongoose.Types.ObjectId(),
|
|
||||||
userID: applicantId,
|
userID: applicantId,
|
||||||
uuid: applicantUUID,
|
uuid: applicantUUID,
|
||||||
timestamp: time
|
timestamp: time
|
||||||
})
|
})
|
||||||
|
|
||||||
await waitingListAdd.save()
|
|
||||||
|
|
||||||
await applicant.roles.add(waitingListRole)
|
await applicant.roles.add(waitingListRole)
|
||||||
await guildapp.findOneAndDelete({ userID: applicantId })
|
await applicantEntry?.destroy()
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
@@ -91,14 +87,14 @@ export = {
|
|||||||
const wlmessage = await channel!.messages.fetch(waitingListMessage)
|
const wlmessage = await channel!.messages.fetch(waitingListMessage)
|
||||||
|
|
||||||
const wlembed = wlmessage.embeds[0]
|
const wlembed = wlmessage.embeds[0]
|
||||||
const accepted = await waitingList.find()
|
const accepted = await waitingList.findAll()
|
||||||
|
|
||||||
for (let i = 0; i < accepted.length; i++) {
|
for (let i = 0; i < accepted.length; i++) {
|
||||||
const uuid = accepted[i].uuid
|
const uuid = accepted[i].uuid
|
||||||
const guild = await getGuild(uuid)
|
const guild = await getGuild(uuid)
|
||||||
|
|
||||||
if (guild && guild._id === hypixelGuildID) {
|
if (guild && guild._id === hypixelGuildID) {
|
||||||
await waitingList.findOneAndDelete({ uuid: uuid })
|
await waitingList.destroy({ where: { uuid: uuid } })
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ import { embedColor, applicationsChannel } from "config/options"
|
|||||||
import { largeM, smallM, ignM } from "config/limitmessages"
|
import { largeM, smallM, ignM } from "config/limitmessages"
|
||||||
import questions from "config/questions"
|
import questions from "config/questions"
|
||||||
import { guildRole } from "config/roles"
|
import { guildRole } from "config/roles"
|
||||||
import mongoose from "mongoose"
|
import guildapp from "schemas/guildAppTag"
|
||||||
import guildapp from "schemas/guildAppSchema"
|
|
||||||
import { IButton } from "interfaces"
|
import { IButton } from "interfaces"
|
||||||
import applicationQuestions from "utils/functions/applicationquestions"
|
import applicationQuestions from "utils/functions/applicationquestions"
|
||||||
|
|
||||||
@@ -32,7 +31,7 @@ export = {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const application = await guildapp.findOne({ userID: user.user.id })
|
const application = await guildapp.findOne({ where: { userID: user.user.id } })
|
||||||
|
|
||||||
if (application) {
|
if (application) {
|
||||||
await interaction.editReply("You already have an application in progress.")
|
await interaction.editReply("You already have an application in progress.")
|
||||||
@@ -249,14 +248,11 @@ export = {
|
|||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
const newGuildApp = new guildapp({
|
await guildapp.create({
|
||||||
_id: new mongoose.Types.ObjectId(),
|
|
||||||
userID: user.user.id,
|
userID: user.user.id,
|
||||||
uuid: uuid
|
uuid: uuid,
|
||||||
})
|
})
|
||||||
|
|
||||||
await newGuildApp.save()
|
|
||||||
|
|
||||||
const channel = guild.channels.cache.get(applicationsChannel) as TextChannel
|
const channel = guild.channels.cache.get(applicationsChannel) as TextChannel
|
||||||
await channel.send({
|
await channel.send({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
|
|||||||
@@ -17,10 +17,11 @@ export = {
|
|||||||
const userRoles = user.roles.cache
|
const userRoles = user.roles.cache
|
||||||
|
|
||||||
if (!userRoles.some(role => guildRoles.includes(role.id))) {
|
if (!userRoles.some(role => guildRoles.includes(role.id))) {
|
||||||
return await interaction.reply({
|
await interaction.reply({
|
||||||
content: "Only guild members can use this button.",
|
content: "Only guild members can use this button.",
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
})
|
})
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
function sq(n: number): string {
|
function sq(n: number): string {
|
||||||
@@ -44,10 +45,11 @@ export = {
|
|||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return await interaction.reply({
|
await interaction.reply({
|
||||||
content: "Please enable your DMs.",
|
content: "Please enable your DMs.",
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
})
|
})
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js"
|
import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js"
|
||||||
import { embedColor } from "config/options"
|
import { embedColor } from "config/options"
|
||||||
import staffapp from "schemas/staffAppSchema"
|
import staffapp from "schemas/staffAppTag"
|
||||||
import { IButton } from "interfaces"
|
import { IButton } from "interfaces"
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
@@ -43,7 +43,8 @@ export = {
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
await staffapp.findOneAndDelete({ userID: applicantId })
|
const app = await staffapp.findOne({ where: { userID: applicantId } })
|
||||||
|
await app?.destroy()
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ import { embedColor, staffApplicationsChannel } from "config/options"
|
|||||||
import { largeM, ignM } from "config/limitmessages"
|
import { largeM, ignM } from "config/limitmessages"
|
||||||
import questions from "config/questions"
|
import questions from "config/questions"
|
||||||
import { guildRole, guildStaff } from "config/roles"
|
import { guildRole, guildStaff } from "config/roles"
|
||||||
import mongoose from "mongoose"
|
import staffapp from "schemas/staffAppTag"
|
||||||
import staffapp from "schemas/staffAppSchema"
|
import settings from "schemas/settingsTag"
|
||||||
import settings from "schemas/settingsSchema"
|
|
||||||
import { IButton } from "interfaces"
|
import { IButton } from "interfaces"
|
||||||
import env from "utils/Env"
|
import env from "utils/Env"
|
||||||
import applicationQuestions from "utils/functions/applicationquestions"
|
import applicationQuestions from "utils/functions/applicationquestions"
|
||||||
@@ -18,8 +17,8 @@ export = {
|
|||||||
const user = interaction.member as GuildMember
|
const user = interaction.member as GuildMember
|
||||||
const guild = interaction.guild!
|
const guild = interaction.guild!
|
||||||
const userRoles = user.roles.cache
|
const userRoles = user.roles.cache
|
||||||
const setting = await settings.findOne({ name: "staffAppStatus" })
|
const setting = await settings.findOne({ where: { name: "staffAppStatus" } })
|
||||||
const status = setting!.value || "0"
|
const status = setting?.value || "0"
|
||||||
const staffQuestions = questions.staff
|
const staffQuestions = questions.staff
|
||||||
|
|
||||||
function sq(n: number): string {
|
function sq(n: number): string {
|
||||||
@@ -50,7 +49,7 @@ export = {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const application = await staffapp.findOne({ userID: user.user.id })
|
const application = await staffapp.findOne({ where: { userID: user.user.id } })
|
||||||
|
|
||||||
if (application) {
|
if (application) {
|
||||||
await interaction.editReply("You already have an application in progress.")
|
await interaction.editReply("You already have an application in progress.")
|
||||||
@@ -222,13 +221,11 @@ export = {
|
|||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
const newStaffApp = new staffapp({
|
await staffapp.create({
|
||||||
_id: new mongoose.Types.ObjectId(),
|
|
||||||
userID: user.user.id,
|
userID: user.user.id,
|
||||||
uuid: uuid
|
uuid: uuid
|
||||||
})
|
})
|
||||||
|
|
||||||
await newStaffApp.save()
|
|
||||||
await user.deleteDM()
|
await user.deleteDM()
|
||||||
|
|
||||||
const channel = guild.channels.cache.get(staffApplicationsChannel) as TextChannel
|
const channel = guild.channels.cache.get(staffApplicationsChannel) as TextChannel
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import waitinglist from "schemas/waitinglistSchema"
|
import waitinglist from "schemas/waitinglistTag"
|
||||||
import { getGuild, getIGN } from "utils/Hypixel"
|
import { getGuild, getIGN } from "utils/Hypixel"
|
||||||
import { hypixelGuildID } from "config/options"
|
import { hypixelGuildID } from "config/options"
|
||||||
import { IButton } from "interfaces"
|
import { IButton } from "interfaces"
|
||||||
@@ -13,14 +13,14 @@ export = {
|
|||||||
const user = interaction.user
|
const user = interaction.user
|
||||||
const message = interaction.message
|
const message = interaction.message
|
||||||
const embed = message.embeds[0]
|
const embed = message.embeds[0]
|
||||||
const accepted = await waitinglist.find()
|
const accepted = await waitinglist.findAll()
|
||||||
|
|
||||||
for (let i = 0; i < accepted.length; i++) {
|
for (let i = 0; i < accepted.length; i++) {
|
||||||
const uuid = accepted[i].uuid
|
const uuid = accepted[i].uuid
|
||||||
const guild = await getGuild(uuid)
|
const guild = await getGuild(uuid)
|
||||||
|
|
||||||
if (guild && guild._id === hypixelGuildID) {
|
if (guild && guild._id === hypixelGuildID) {
|
||||||
await waitinglist.findOneAndDelete({ uuid: uuid })
|
await accepted[i].destroy()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, Message, GuildMember } from "discord.js"
|
import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, Message, GuildMember } from "discord.js"
|
||||||
import { embedColor } from "config/options"
|
import { embedColor } from "config/options"
|
||||||
import guildapp from "schemas/guildAppSchema"
|
import guildapp from "schemas/guildAppTag"
|
||||||
import { IModal } from "interfaces"
|
import { IModal } from "interfaces"
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
@@ -78,7 +78,8 @@ export = {
|
|||||||
responseEmbeds = [responseEmbed]
|
responseEmbeds = [responseEmbed]
|
||||||
}
|
}
|
||||||
|
|
||||||
await guildapp.findOneAndDelete({ userID: applicantId })
|
const app = await guildapp.findOne({ where: { userID: applicantId } })
|
||||||
|
await app?.destroy()
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: responseEmbeds
|
embeds: responseEmbeds
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js"
|
import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js"
|
||||||
import { embedColor } from "config/options"
|
import { embedColor } from "config/options"
|
||||||
import staffapp from "schemas/staffAppSchema"
|
import staffapp from "schemas/staffAppTag"
|
||||||
import { IModal } from "interfaces"
|
import { IModal } from "interfaces"
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
@@ -42,7 +42,8 @@ export = {
|
|||||||
|
|
||||||
await applicant.send({ embeds: [dmMessage] })
|
await applicant.send({ embeds: [dmMessage] })
|
||||||
|
|
||||||
await staffapp.findOneAndDelete({ userID: applicantId })
|
const app = await staffapp.findOne({ where: { userID: applicantId } })
|
||||||
|
await app?.destroy()
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel"
|
||||||
import { embedColor, hypixelGuildID, devMessage } from "config/options"
|
import { embedColor, hypixelGuildID, devMessage } from "config/options"
|
||||||
import verify from "schemas/verifySchema"
|
import verify from "schemas/verifyTag"
|
||||||
import mongoose from "mongoose"
|
|
||||||
import { gm, manager, moderator, beast, elite, member, guildRole, guildStaff, defaultMember } from "config/roles"
|
import { gm, manager, moderator, beast, elite, member, guildRole, guildStaff, defaultMember } from "config/roles"
|
||||||
import { IModal } from "interfaces"
|
import { IModal } from "interfaces"
|
||||||
import { GuildMember } from "discord.js"
|
import { GuildMember } from "discord.js"
|
||||||
@@ -15,7 +14,7 @@ export = {
|
|||||||
|
|
||||||
const user = interaction.member as GuildMember
|
const user = interaction.member as GuildMember
|
||||||
const ign = interaction.fields.fields.get("verifyign")!.value
|
const ign = interaction.fields.fields.get("verifyign")!.value
|
||||||
const verifyData = await verify.findOne({ userID: user.user.id })
|
const verifyData = await verify.findOne({ where: { userID: user.user.id } })
|
||||||
if (verifyData) {
|
if (verifyData) {
|
||||||
interaction.editReply("You are already verified.\n" + "Try running /update to update your roles.")
|
interaction.editReply("You are already verified.\n" + "Try running /update to update your roles.")
|
||||||
return
|
return
|
||||||
@@ -124,14 +123,11 @@ export = {
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
})
|
})
|
||||||
|
|
||||||
const newVerify = new verify({
|
await verify.create({
|
||||||
_id: new mongoose.Types.ObjectId(),
|
|
||||||
userID: user.id,
|
userID: user.id,
|
||||||
uuid: uuid
|
uuid: uuid
|
||||||
})
|
})
|
||||||
|
|
||||||
await newVerify.save()
|
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
title: interaction.guild!.name,
|
title: interaction.guild!.name,
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
import { Schema, model } from "mongoose"
|
|
||||||
|
|
||||||
const guildAppSchema = new Schema({
|
|
||||||
_id: Schema.Types.ObjectId,
|
|
||||||
userID: { type: String, required: true },
|
|
||||||
uuid: { type: String, required: true }
|
|
||||||
})
|
|
||||||
|
|
||||||
export = model("guildapp", guildAppSchema, "guildapp")
|
|
||||||
20
src/schemas/guildAppTag.ts
Normal file
20
src/schemas/guildAppTag.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import Sequelize, { InferAttributes, InferCreationAttributes, Model } from "sequelize"
|
||||||
|
import { sequelize } from "utils/Illegitimate"
|
||||||
|
|
||||||
|
interface GuildApp extends Model<InferAttributes<GuildApp>, InferCreationAttributes<GuildApp>> {
|
||||||
|
userID: string
|
||||||
|
uuid: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const tag = sequelize.define<GuildApp>("guildApp", {
|
||||||
|
userID: {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
allowNull: false
|
||||||
|
},
|
||||||
|
uuid: {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
allowNull: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default tag
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import { Schema, model } from "mongoose"
|
|
||||||
|
|
||||||
const settingsSchema = new Schema({
|
|
||||||
_id: Schema.Types.ObjectId,
|
|
||||||
name: { type: String, required: true },
|
|
||||||
value: { type: String, required: true }
|
|
||||||
})
|
|
||||||
|
|
||||||
export = model("settings", settingsSchema, "settings")
|
|
||||||
20
src/schemas/settingsTag.ts
Normal file
20
src/schemas/settingsTag.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import Sequelize, { InferAttributes, InferCreationAttributes, Model } from "sequelize"
|
||||||
|
import { sequelize } from "utils/Illegitimate"
|
||||||
|
|
||||||
|
interface Settings extends Model<InferAttributes<Settings>, InferCreationAttributes<Settings>> {
|
||||||
|
name: string
|
||||||
|
value: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const tag = sequelize.define<Settings>("settings", {
|
||||||
|
name: {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
allowNull: false
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
allowNull: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default tag
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import { Schema, model } from "mongoose"
|
|
||||||
|
|
||||||
const staffAppSchema = new Schema({
|
|
||||||
_id: Schema.Types.ObjectId,
|
|
||||||
userID: { type: String, required: true },
|
|
||||||
uuid: { type: String, required: true }
|
|
||||||
})
|
|
||||||
|
|
||||||
export = model("staffapp", staffAppSchema, "staffapp")
|
|
||||||
20
src/schemas/staffAppTag.ts
Normal file
20
src/schemas/staffAppTag.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import Sequelize, { InferAttributes, InferCreationAttributes, Model } from "sequelize"
|
||||||
|
import { sequelize } from "utils/Illegitimate"
|
||||||
|
|
||||||
|
interface StaffApp extends Model<InferAttributes<StaffApp>, InferCreationAttributes<StaffApp>> {
|
||||||
|
userID: string
|
||||||
|
uuid: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const tag = sequelize.define<StaffApp>("staffApp", {
|
||||||
|
userID: {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
allowNull: false
|
||||||
|
},
|
||||||
|
uuid: {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
allowNull: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default tag
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import { Schema, model } from "mongoose"
|
|
||||||
|
|
||||||
const verifySchema = new Schema({
|
|
||||||
_id: Schema.Types.ObjectId,
|
|
||||||
userID: { type: String, required: true },
|
|
||||||
uuid: { type: String, required: true }
|
|
||||||
})
|
|
||||||
|
|
||||||
export = model("verify", verifySchema, "verify")
|
|
||||||
20
src/schemas/verifyTag.ts
Normal file
20
src/schemas/verifyTag.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import Sequelize, { InferAttributes, InferCreationAttributes, Model } from "sequelize"
|
||||||
|
import { sequelize } from "utils/Illegitimate"
|
||||||
|
|
||||||
|
interface Verify extends Model<InferAttributes<Verify>, InferCreationAttributes<Verify>> {
|
||||||
|
userID: string
|
||||||
|
uuid: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const tag = sequelize.define<Verify>("verify", {
|
||||||
|
userID: {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
allowNull: false
|
||||||
|
},
|
||||||
|
uuid: {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
allowNull: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default tag
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import { Schema, model } from "mongoose"
|
|
||||||
|
|
||||||
const waitinglistSchema = new Schema({
|
|
||||||
_id: Schema.Types.ObjectId,
|
|
||||||
userID: { type: String, required: true },
|
|
||||||
uuid: { type: String, required: true },
|
|
||||||
timestamp: { type: Number, required: true }
|
|
||||||
})
|
|
||||||
|
|
||||||
export = model("waitinglist", waitinglistSchema, "waitinglist")
|
|
||||||
25
src/schemas/waitinglistTag.ts
Normal file
25
src/schemas/waitinglistTag.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import Sequelize, { InferAttributes, InferCreationAttributes, Model } from "sequelize"
|
||||||
|
import { sequelize } from "utils/Illegitimate"
|
||||||
|
|
||||||
|
interface WaitingList extends Model<InferAttributes<WaitingList>, InferCreationAttributes<WaitingList>> {
|
||||||
|
userID: string;
|
||||||
|
uuid: string;
|
||||||
|
timestamp: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tag = sequelize.define<WaitingList>("waitingList", {
|
||||||
|
userID: {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
allowNull: false
|
||||||
|
},
|
||||||
|
uuid: {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
allowNull: false
|
||||||
|
},
|
||||||
|
timestamp: {
|
||||||
|
type: Sequelize.INTEGER,
|
||||||
|
allowNull: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default tag
|
||||||
@@ -5,10 +5,17 @@ import env from "utils/Env"
|
|||||||
import { connect } from "mongoose"
|
import { connect } from "mongoose"
|
||||||
import loadAllEvents from "./Events"
|
import loadAllEvents from "./Events"
|
||||||
import { Player } from "discord-player"
|
import { Player } from "discord-player"
|
||||||
|
import { Sequelize } from "sequelize"
|
||||||
|
|
||||||
const client = new Client()
|
const client = new Client()
|
||||||
const redis = new Redis(env.prod.redisURI!)
|
const redis = new Redis(env.prod.redisURI!)
|
||||||
const player = new Player(client)
|
const player = new Player(client)
|
||||||
|
const sequelize = new Sequelize("illegitimate", "root", "password", {
|
||||||
|
host: "localhost",
|
||||||
|
dialect: "sqlite",
|
||||||
|
logging: false,
|
||||||
|
storage: "data/database.sqlite",
|
||||||
|
})
|
||||||
|
|
||||||
let ft: "js" | "ts"
|
let ft: "js" | "ts"
|
||||||
if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT === "true") {
|
if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT === "true") {
|
||||||
@@ -33,6 +40,9 @@ class Illegitimate {
|
|||||||
connect(env.prod.mongoURI!, {}).then(() => {
|
connect(env.prod.mongoURI!, {}).then(() => {
|
||||||
console.log(color("Connected to MongoDB", "green"))
|
console.log(color("Connected to MongoDB", "green"))
|
||||||
})
|
})
|
||||||
|
sequelize.sync().then(() => {
|
||||||
|
console.log(color("Connected to SQLite", "green"))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private async init() {
|
private async init() {
|
||||||
@@ -54,4 +64,4 @@ class Illegitimate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Illegitimate, client, redis }
|
export { Illegitimate, client, redis, sequelize }
|
||||||
|
|||||||
Reference in New Issue
Block a user