Changed some variable names to prevent collision
Done some changes to fix registration issues
This commit is contained in:
@@ -31,7 +31,7 @@ module.exports = {
|
||||
)
|
||||
|
||||
,
|
||||
slashcommandGlobal:false,
|
||||
slashcommandGlobal:true,
|
||||
async function(interactionObject) {
|
||||
let ephemeral = interactionObject.options.getString("visibility")
|
||||
let serverid = interactionObject.options.getString("server_identifier")
|
||||
|
||||
@@ -37,7 +37,7 @@ module.exports = {
|
||||
)
|
||||
|
||||
,
|
||||
slashcommandGlobal:false,
|
||||
slashcommandGlobal:true,
|
||||
async function(interactionObject) {
|
||||
let ephemeral = interactionObject.options.getString("visibility")
|
||||
let action = interactionObject.options.getString("action")
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
const { config } = require('process');
|
||||
|
||||
const wait = require('util').promisify(setTimeout);
|
||||
|
||||
module.exports = {
|
||||
@@ -16,7 +14,7 @@ module.exports = {
|
||||
.setName("client_key")
|
||||
.setDescription("If you already have an account, create a client key, and add that one here to link your account")
|
||||
),
|
||||
slashcommandGlobal:false,
|
||||
slashcommandGlobal:true,
|
||||
async function(interactionObject) {
|
||||
|
||||
var username = interactionObject.options.getString("username")
|
||||
@@ -32,12 +30,6 @@ module.exports = {
|
||||
}
|
||||
await interactionObject.deferReply({ephemeral:ephemeral})
|
||||
|
||||
|
||||
|
||||
if(!config.panel.allowRegistration){
|
||||
return;
|
||||
}
|
||||
|
||||
// This part triggers only when the client key is present, and is the only part that will trigger in that case
|
||||
// It will request the user's data based on the presented key, and then append that data to the account in the database or create one if none should be found
|
||||
if(client_key != null){
|
||||
@@ -45,13 +37,13 @@ module.exports = {
|
||||
interactionObject.editReply("Incorrect Client Key size")
|
||||
return
|
||||
}
|
||||
fetch(`${config.panel.url}/api/client/account`,{
|
||||
fetch(`${mainconfig.panel.url}/api/client/account`,{
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `Bearer ${client_key}`,
|
||||
'User-Agent': `${config.panel.useragent}`,
|
||||
'User-Agent': `${mainconfig.panel.useragent}`,
|
||||
}
|
||||
})
|
||||
.then(async response => {
|
||||
@@ -61,6 +53,9 @@ module.exports = {
|
||||
case "500":
|
||||
interactionObject.editReply("Server Error")
|
||||
break;
|
||||
default:
|
||||
interactionObject.editReply(`Your key is likely incorrect, please make sure that you are using the right key\n${mainconfig.panel.url}/account/api`)
|
||||
break
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -83,18 +78,18 @@ module.exports = {
|
||||
interactionObject.editReply("You need to supply a valid username or a client key if you already have an account")
|
||||
return}
|
||||
|
||||
if(!config.panel.allowRegistration){
|
||||
if(!mainconfig.panel.allowRegistration){
|
||||
interactionObject.editReply("Registering new account has been disabled by the administrator")
|
||||
return
|
||||
}
|
||||
|
||||
fetch(`${config.panel.url}/api/application/users`,{
|
||||
fetch(`${mainconfig.panel.url}/api/application/users`,{
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `Bearer ${config.panel.applicationKey}`,
|
||||
'User-Agent': `${config.panel.useragent}`,
|
||||
"Authorization": `Bearer ${mainconfig.panel.applicationKey}`,
|
||||
'User-Agent': `${mainconfig.panel.useragent}`,
|
||||
},
|
||||
"body":JSON.stringify({
|
||||
"email": `${interactionObject.user.id}@goodanimemes.com`,
|
||||
@@ -129,12 +124,12 @@ module.exports = {
|
||||
|
||||
|
||||
interactionObject.user.send(
|
||||
`${config.panel.url}\n
|
||||
`${mainconfig.panel.url}\n
|
||||
The password for your account __${username}__ is __${password}__\n\n
|
||||
Now you can log into your account and go to your profile settings\n
|
||||
Go to \`API Credentials\` and create a new key\n
|
||||
Then go back to the server and use the register command again, this time using the \`client_key\` parameter with the key you just created
|
||||
This message will get deleted in 2 minutes`
|
||||
This message will get deleted <t:${Math.floor((new Date().getTime() + 120000)/1000)}:R>`
|
||||
).then(dm => {
|
||||
setTimeout(() => {
|
||||
dm.delete()
|
||||
|
||||
@@ -25,7 +25,7 @@ module.exports = {
|
||||
)
|
||||
|
||||
,
|
||||
slashcommandGlobal:false,
|
||||
slashcommandGlobal:true,
|
||||
async function(interactionObject) {
|
||||
let ephemeral = interactionObject.options.getString("visibility")
|
||||
let serverid = interactionObject.options.getString("server_identifier")
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
var pool = mysql.createPool({
|
||||
connectionLimit : 10,
|
||||
host: config.database.host,
|
||||
port: config.database.port,
|
||||
user: config.database.username,
|
||||
password: config.database.password,
|
||||
database: config.database.dbname,
|
||||
host: mainconfig.database.host,
|
||||
port: mainconfig.database.port,
|
||||
user: mainconfig.database.username,
|
||||
password: mainconfig.database.password,
|
||||
database: mainconfig.database.dbname,
|
||||
charset : 'utf8mb4'
|
||||
});
|
||||
|
||||
|
||||
@@ -90,12 +90,11 @@ folders.forEach(element => {
|
||||
|
||||
// console.log(commands)
|
||||
|
||||
client.login(config.token);
|
||||
client.login(mainconfig.token);
|
||||
|
||||
var ignorelist = config.ignorelist
|
||||
var prefix = config.prefix;
|
||||
var ignorelist = mainconfig.ignorelist
|
||||
var prefix = mainconfig.prefix;
|
||||
var platform = process.platform;
|
||||
// var main_config = client.commands.get("redis").function("getValJSON", "main_config");
|
||||
|
||||
client.on("ready", () => {
|
||||
commands.get("Startup_function").function()
|
||||
|
||||
+3
-1
@@ -7,11 +7,13 @@ client = new Discord.Client({
|
||||
})
|
||||
|
||||
fs = require("fs")
|
||||
config = require("./config/main.json")
|
||||
mainconfig = require("./config/main.json")
|
||||
readline = require("readline")
|
||||
MessageAttachment = { XXXXXXXXXXXXXXXX, MessageAttachment } = require('discord.js')
|
||||
mysql = require("mysql")
|
||||
fetch = require("node-fetch")
|
||||
Hashids = require("hashids/cjs")
|
||||
hashids = new Hashids("", 6)
|
||||
|
||||
MessageActionRow = Discord.MessageActionRow;
|
||||
MessageButton = Discord.MessageButton;
|
||||
|
||||
Reference in New Issue
Block a user