v3.2.2 push 4

This commit is contained in:
DJj123dj
2023-02-24 21:48:59 +01:00
parent 6e730f058d
commit 65f82171d3
6 changed files with 93 additions and 71 deletions
+1 -1
View File
@@ -33,5 +33,5 @@ module.exports = () => {
}
})
log("info","loaded plugins",[{key:"success",value:successcount},{key:"error",value:failcount},{key:"total",value:totalcount}])
require("../startscreen").headerDataPlugins({total:totalcount,success:successcount,error:failcount})
}
+2 -2
View File
@@ -13,13 +13,13 @@ if (lfexists) localLanguage = require("../language/"+config.languagefile+".json"
const errorLog = async () => {
const chalk = await (await import("chalk")).default
console.log(chalk.red("Something went wrong when loading the language!")+"\nCheck the config file or create a ticket in our server!")
require("./startscreen").headerDataLanguage("Something went wrong when loading the language!",true)
}
const successLog = async (language) => {
const chalk = await (await import("chalk")).default
console.log(chalk.green("loaded language "+language+"..."))
require("./startscreen").headerDataLanguage("sucessfully loaded language "+language,false)
}
if (!localLanguage){
+7
View File
@@ -0,0 +1,7 @@
██████╗ ██████╗ ███████╗███╗ ██╗ ████████╗██╗ ██████╗██╗ ██╗███████╗████████╗
██╔═══██╗██╔══██╗██╔════╝████╗ ██║ ╚══██╔══╝██║██╔════╝██║ ██╔╝██╔════╝╚══██╔══╝
██║ ██║██████╔╝█████╗ ██╔██╗ ██║ ██║ ██║██║ █████╔╝ █████╗ ██║
██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║ ██║ ██║██║ ██╔═██╗ ██╔══╝ ██║
╚██████╔╝██║ ███████╗██║ ╚████║ ██║ ██║╚██████╗██║ ██╗███████╗ ██║
╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝ ╚═╝
-1
View File
@@ -8,7 +8,6 @@ const act = discord.ApplicationCommandType
const acot = discord.ApplicationCommandOptionType
module.exports = async () => {
bot.errorLog.log("info","auto-updating slash commands...")
const sid = config.server_id
const ids = configParser.getTicketValuesArray("id")
+75
View File
@@ -0,0 +1,75 @@
const discord = require('discord.js')
const bot = require('../index')
const client = bot.client
const config = bot.config
const l = bot.language
const log = bot.errorLog.log
const logo = require("fs").readFileSync("./core/logo.txt").toString()
/**@param {import('chalk').ChalkInstance} chalk */
const showFlags = async (chalk) => {
var isFlag = false
if (process.argv.some((v) => v == "--devconfig")) console.log(chalk.blue("[FLAGS] => used dev config instead of normal config")); isFlag = true
if (process.argv.some((v) => v == "--nochecker")) console.log(chalk.blue("[FLAGS] => disabled checker.js")); isFlag = true
if (process.argv.some((v) => v == "--tsoffline")) console.log(chalk.blue("[FLAGS] => offline check for html transcripts disabled!")); isFlag = true
if (process.argv.some((v) => v == "--debug")) console.log(chalk.blue("[FLAGS] => enabled DEBUG mode")); isFlag = true
if (!isFlag) console.log(chalk.blue("no flags!"))
}
exports.run = async () => {
const chalk = await (await import("chalk")).default
console.log(chalk.hex("f8ba00")(logo))
const version = require("../package.json").version
var headertext = "v"+version+" - Support: https://discord.dj-dj.be - Language: "+config.languagefile
const spaceamount = (84-headertext.length)/2
var i = 0
while (i < spaceamount){
headertext = " "+headertext
i++
}
console.log(chalk.bold(headertext+"\n"))
console.log(chalk.bold(chalk.underline("FLAGS:")))
showFlags(chalk)
}
/**
* @param {import('chalk').ChalkInstance} chalk
* @param {{type:String,text:String,enabled:Boolean}} status
* @param {Boolean} updatingslash
* @param {Boolean} slashmode
*
*/
exports.headerDataReady = (chalk,status,updatingslash,slashmode) => {
console.log("\n"+chalk.bold(chalk.underline("STARTUP INFO:")))
if (status.enabled) console.log(chalk.hex("f8ba00")("status: ")+chalk.bold(status.type.toLowerCase())+" "+status.text)
if (slashmode){
console.log("\n\n"+chalk.red(chalk.underline("STARTING IN SLASH CMD CONFIGURATION MODE!")))
return
}
console.log(chalk.hex("f8ba00")("updating slash cmds: ")+chalk.bold(slashmode))
}
var languageMSG = ""
var languageErr = false
/**
* @param {String} message
* @param {Boolean} err
*/
exports.headerDataLanguage = async (message,err) => {
languageMSG = message
languageErr = err
}
/**
* @param {{total:Number,error:Number,success:Number}} plugins
*/
exports.headerDataPlugins = async (plugins) => {
const chalk = await (await import("chalk")).default
const lmsg = languageErr ? chalk.red(languageMSG) : languageMSG
console.log(chalk.hex("f8ba00")("language: ")+lmsg)
console.log(chalk.hex("f8ba00")("plugins loaded: ")+chalk.bold(plugins.total+" total ")+"("+plugins.success+"✅ "+plugins.error+"❌)")
console.log("\n"+chalk.bold(chalk.underline("LOGS:")))
}
+8 -67
View File
@@ -72,10 +72,6 @@ var tempconfig = require("./config.json")
var isDevConfig = false
if (process.argv.some((v) => v == "--devconfig")){
async function logFLAGS(){
const chalk = await (await import("chalk")).default
console.log(chalk.blue("[FLAGS] => used dev config instead of normal config"))
}; logFLAGS()
isDevConfig = true
try{
tempconfig = require("./devconfig.json")
@@ -83,24 +79,6 @@ if (process.argv.some((v) => v == "--devconfig")){
}else{
tempconfig = require("./config.json")
}
if (process.argv.some((v) => v == "--nochecker")){
async function logFLAGS(){
const chalk = await (await import("chalk")).default
console.log(chalk.blue("[FLAGS] => disabled checker.js"))
}; logFLAGS()
}
if (process.argv.some((v) => v == "--tsoffline")){
async function logFLAGS(){
const chalk = await (await import("chalk")).default
console.log(chalk.blue("[FLAGS] => offline check for html transcripts disabled!"))
}; logFLAGS()
}
if (process.argv.some((v) => v == "--debug")){
async function logFLAGS(){
const chalk = await (await import("chalk")).default
console.log(chalk.blue("[FLAGS] => enabled DEBUG mode"))
}; logFLAGS()
}
if (process.argv.some((v) => v == "--debug")) console.log("[TEMP_DEBUG]","loaded flags")
exports.developerConfig = isDevConfig
@@ -151,74 +129,37 @@ client.on('ready',async () => {
}
client.user.setActivity(text,{type:getTypeEnum(type)})
statusSet = true
log("system","loaded status",[{key:"type",value:type},{key:"text",value:text}])
}
this.errorLog.log("debug","bot status loaded")
const chalk = await (await import("chalk")).default
if (!process.argv[2]){
console.log(chalk.red("WELCOME TO OPEN TICKET!"))
require("./core/startscreen").run()
if (!process.argv[2] || (process.argv[2] && !process.argv[2].startsWith("slash"))){
this.errorLog.log("debug","loaded console interface")
log("info","open ticket ready",[{key:"version",value:require("./package.json").version},{key:"language",value:config.languagefile}])
require("./core/utils/liveStatus")()
console.log(chalk.blue("\n\nlogs:")+"\n============")
if (config.status.enabled){
setStatus(config.status.type,config.status.text)
}
var updatingSlash = false
if (fs.existsSync("./storage/slashcmdEnabled.txt")){
/**@type {"true"|"false"} */
const data = fs.readFileSync("./storage/slashcmdEnabled.txt").toString()
if (data === "true"){require("./core/slashSystem/autoSlashUpdate")()}
if (data === "true"){require("./core/slashSystem/autoSlashUpdate")(); updatingSlash = true}
}else{fs.writeFileSync("./storage/slashcmdEnabled.txt","false")}
log("system","bot logged in!")
try {
await client.guilds.cache.find((g) => g.id == config.server_id).members.fetch()
}catch{
this.errorLog.log("info","tried to cache user information, failed!")
}
return
}
if (process.argv[2] == "d"){
if (config.status.enabled){
setStatus(config.status.type,config.status.text)
}
}
if (!process.argv[2].startsWith("slash")){
console.log(chalk.red("WELCOME TO OPEN TICKET!"))
this.errorLog.log("debug","loaded console interface")
log("info","open ticket ready",[{key:"version",value:require("./package.json").version},{key:"language",value:config.languagefile}])
require("./core/utils/liveStatus")()
console.log(chalk.blue("\n\nlogs:")+"\n============")
if (config.status.enabled){
setStatus(config.status.type,config.status.text)
}
if (fs.existsSync("./storage/slashcmdEnabled.txt")){
/**@type {"true"|"false"} */
const data = fs.readFileSync("./storage/slashcmdEnabled.txt").toString()
if (data === "true"){require("./core/slashSystem/autoSlashUpdate")()}
}else{fs.writeFileSync("./storage/slashcmdEnabled.txt","false")}
log("system","bot logged in!")
try {
await client.guilds.cache.find((g) => g.id == config.server_id).members.fetch()
}catch{
this.errorLog.log("info","tried to cache user information, failed!")
}
require("./core/startscreen").headerDataReady(chalk,config.status,updatingSlash,false)
}else{
console.log(chalk.red("STARTING IN ")+chalk.blue("SLASH MODE")+chalk.red("..."))
require("./core/startscreen").headerDataReady(chalk,config.status,updatingSlash,true)
this.errorLog.log("debug","slashmode activated")
console.log("logs:\n================")
console.log("client logged in...")
console.log("loading files...")
if (process.argv[3] == "enable"){
console.log(chalk.green("switching to slashEnable.js"))
require("./core/slashSystem/slashEnable")()
@@ -226,7 +167,7 @@ client.on('ready',async () => {
console.log(chalk.green("switching to slashDisable.js"))
require("./core/slashSystem/slashDisable")()
}else{
console.log(chalk.red("[SLASH CMD MANAGER]: unknown slash mode!"))
console.log(chalk.bgRed("[SLASH CMD MANAGER]: unknown slash command action!"))
process.exit(1)
}
}