Minor Improvements + Code Cleanup
This commit is contained in:
@@ -22,7 +22,7 @@ const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
* - Check (./src/builders), (./src/actions), (./src/data) & (./src/commands) in general in the areas that were changed.
|
||||
*/
|
||||
|
||||
export const loadAllConfigCheckers = async () => {
|
||||
export async function loadAllConfigCheckers(){
|
||||
opendiscord.checkers.add(new api.ODChecker("opendiscord:general",opendiscord.checkers.storage,0,opendiscord.configs.get("opendiscord:general"),defaultGeneralStructure,{cliDisplayName:"General Config",cliDisplayDescription:"Configure the bot token, status, colors, permissions & more."}))
|
||||
opendiscord.checkers.add(new api.ODChecker("opendiscord:questions",opendiscord.checkers.storage,2,opendiscord.configs.get("opendiscord:questions"),defaultQuestionsStructure,{cliDisplayName:"Questions Config",cliDisplayDescription:"Create, modify & delete questions which are used in options."}))
|
||||
opendiscord.checkers.add(new api.ODChecker("opendiscord:options",opendiscord.checkers.storage,1,opendiscord.configs.get("opendiscord:options"),defaultOptionsStructure,{cliDisplayName:"Options Config",cliDisplayDescription:"Create, modify & delete options which are used in panels."}))
|
||||
@@ -30,13 +30,13 @@ export const loadAllConfigCheckers = async () => {
|
||||
opendiscord.checkers.add(new api.ODChecker("opendiscord:transcripts",opendiscord.checkers.storage,0,opendiscord.configs.get("opendiscord:transcripts"),defaultTranscriptsStructure,{cliDisplayName:"Transcript Config",cliDisplayDescription:"Configure everything related to transcripts."}))
|
||||
}
|
||||
|
||||
export const loadAllConfigCheckerFunctions = async () => {
|
||||
export async function loadAllConfigCheckerFunctions(){
|
||||
opendiscord.checkers.functions.add(new api.ODCheckerFunction("opendiscord:unused-options",defaultUnusedOptionsFunction))
|
||||
opendiscord.checkers.functions.add(new api.ODCheckerFunction("opendiscord:unused-questions",defaultUnusedQuestionsFunction))
|
||||
opendiscord.checkers.functions.add(new api.ODCheckerFunction("opendiscord:dropdown-options",defaultDropdownOptionsFunction))
|
||||
}
|
||||
|
||||
export const loadAllConfigCheckerTranslations = async () => {
|
||||
export async function loadAllConfigCheckerTranslations(){
|
||||
if ((generalConfig && generalConfig.data.system && generalConfig.data.system.useTranslatedConfigChecker) ? generalConfig.data.system.useTranslatedConfigChecker : false){
|
||||
registerDefaultCheckerSystemTranslations(opendiscord.checkers.translation,opendiscord.languages) //translate checker system text
|
||||
registerDefaultCheckerMessageTranslations(opendiscord.checkers.translation,opendiscord.languages) //translate checker messages
|
||||
|
||||
@@ -9,7 +9,7 @@ const statsDatabase = opendiscord.databases.get("opendiscord:stats")
|
||||
const optionDatabase = opendiscord.databases.get("opendiscord:options")
|
||||
const mainServer = opendiscord.client.mainServer
|
||||
|
||||
export const loadAllCode = async () => {
|
||||
export async function loadAllCode(){
|
||||
if (!generalConfig || !mainServer || !globalDatabase || !userDatabase || !ticketDatabase || !statsDatabase || !optionDatabase) return
|
||||
|
||||
loadCommandErrorHandlingCode()
|
||||
@@ -20,7 +20,7 @@ export const loadAllCode = async () => {
|
||||
loadAutoCode()
|
||||
}
|
||||
|
||||
export const loadCommandErrorHandlingCode = async () => {
|
||||
export async function loadCommandErrorHandlingCode(){
|
||||
//COMMAND ERROR HANDLING
|
||||
opendiscord.code.add(new api.ODCode("opendiscord:command-error-handling",14,() => {
|
||||
//invalid/missing options
|
||||
@@ -56,7 +56,7 @@ export const loadCommandErrorHandlingCode = async () => {
|
||||
}))
|
||||
}
|
||||
|
||||
export const loadStartListeningInteractionsCode = async () => {
|
||||
export async function loadStartListeningInteractionsCode(){
|
||||
//START LISTENING TO INTERACTIONS
|
||||
opendiscord.code.add(new api.ODCode("opendiscord:start-listening-interactions",13,() => {
|
||||
opendiscord.client.slashCommands.startListeningToInteractions()
|
||||
@@ -66,7 +66,7 @@ export const loadStartListeningInteractionsCode = async () => {
|
||||
}))
|
||||
}
|
||||
|
||||
export const loadDatabaseCleanersCode = async () => {
|
||||
export async function loadDatabaseCleanersCode(){
|
||||
if (!mainServer) return
|
||||
|
||||
//PANEL DATABASE CLEANER
|
||||
@@ -282,7 +282,7 @@ export const loadDatabaseCleanersCode = async () => {
|
||||
}))
|
||||
}
|
||||
|
||||
export const loadPanelAutoUpdateCode = async () => {
|
||||
export async function loadPanelAutoUpdateCode(){
|
||||
//PANEL AUTO UPDATE
|
||||
opendiscord.code.add(new api.ODCode("opendiscord:panel-auto-update",7,async () => {
|
||||
const globalDatabase = opendiscord.databases.get("opendiscord:global")
|
||||
@@ -316,7 +316,7 @@ export const loadPanelAutoUpdateCode = async () => {
|
||||
}))
|
||||
}
|
||||
|
||||
export const loadDatabaseSaversCode = async () => {
|
||||
export async function loadDatabaseSaversCode(){
|
||||
//TICKET SAVER
|
||||
opendiscord.code.add(new api.ODCode("opendiscord:ticket-saver",6,() => {
|
||||
const mainVersion = opendiscord.versions.get("opendiscord:version")
|
||||
|
||||
@@ -13,7 +13,7 @@ const lang = opendiscord.languages
|
||||
* - Check all files, test the bot carefully & try a lot of different scenario's with different settings.
|
||||
*/
|
||||
|
||||
export const loadAllSlashCommands = async () => {
|
||||
export async function loadAllSlashCommands(){
|
||||
const commands = opendiscord.client.slashCommands
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
if (!generalConfig) return
|
||||
@@ -642,7 +642,7 @@ export const loadAllSlashCommands = async () => {
|
||||
}))
|
||||
}
|
||||
|
||||
export const loadAllTextCommands = async () => {
|
||||
export async function loadAllTextCommands(){
|
||||
const commands = opendiscord.client.textCommands
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
if (!generalConfig) return
|
||||
@@ -1216,7 +1216,7 @@ export const loadAllTextCommands = async () => {
|
||||
}))
|
||||
}
|
||||
|
||||
export const loadAllContextMenus = async () => {
|
||||
export async function loadAllContextMenus(){
|
||||
const menus = opendiscord.client.contextMenus
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
if (!generalConfig) return
|
||||
|
||||
@@ -21,7 +21,7 @@ import * as fjs from "formatted-json-stringify"
|
||||
* - Check (./src/builders), (./src/actions), (./src/data) & (./src/commands) in general in the areas that were changed.
|
||||
*/
|
||||
|
||||
export const loadAllConfigs = async () => {
|
||||
export async function loadAllConfigs(){
|
||||
const devconfigFlag = opendiscord.flags.get("opendiscord:dev-config")
|
||||
const isDevconfig = devconfigFlag ? devconfigFlag.value : false
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllCooldowns = async () => {
|
||||
export async function loadAllCooldowns(){
|
||||
await opendiscord.options.loopAll((option) => {
|
||||
if (!(option instanceof api.ODTicketOption)) return
|
||||
loadTicketOptionCooldown(option)
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as fjs from "formatted-json-stringify"
|
||||
const devdatabaseFlag = opendiscord.flags.get("opendiscord:dev-database")
|
||||
const isDevdatabase = devdatabaseFlag ? devdatabaseFlag.value : false
|
||||
|
||||
export const loadAllDatabases = async () => {
|
||||
export async function loadAllDatabases(){
|
||||
opendiscord.databases.add(defaultGlobalDatabase)
|
||||
opendiscord.databases.add(defaultStatsDatabase)
|
||||
opendiscord.databases.add(defaultTicketsDatabase)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllFlags = async () => {
|
||||
export async function loadAllFlags(){
|
||||
opendiscord.flags.add(new api.ODFlag("opendiscord:no-migration","No Migration","Disable Open Ticket data migration on update!","--no-migration",["-nm"]))
|
||||
opendiscord.flags.add(new api.ODFlag("opendiscord:dev-config","Developer Config","Use the configs in /devconfig/ instead of /config/!","--dev-config",["-dc"]))
|
||||
opendiscord.flags.add(new api.ODFlag("opendiscord:dev-database","Developer Database","Use the databases in /devdatabase/ instead of /database/!","--dev-database",["-dd"]))
|
||||
|
||||
@@ -12,7 +12,7 @@ const lang = opendiscord.languages
|
||||
* - Check all files, test the bot carefully & try a lot of different scenario's with different settings.
|
||||
*/
|
||||
|
||||
export const loadAllHelpMenuCategories = async () => {
|
||||
export async function loadAllHelpMenuCategories(){
|
||||
const helpmenu = opendiscord.helpmenu
|
||||
|
||||
helpmenu.add(new api.ODHelpMenuCategory("opendiscord:general",5,utilities.emojiTitle("📎",lang.getTranslation("helpMenu.categories.general"))))
|
||||
@@ -24,7 +24,7 @@ export const loadAllHelpMenuCategories = async () => {
|
||||
helpmenu.add(new api.ODHelpMenuCategory("opendiscord:extra",0,utilities.emojiTitle("✨",lang.getTranslation("helpMenu.categories.extra"))))
|
||||
}
|
||||
|
||||
export const loadAllHelpMenuComponents = async () => {
|
||||
export async function loadAllHelpMenuComponents(){
|
||||
const helpmenu = opendiscord.helpmenu
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
if (!generalConfig) return
|
||||
|
||||
@@ -9,7 +9,7 @@ import {opendiscord, api, utilities} from "../../index.js"
|
||||
* - Update the Open Ticket Documentation.
|
||||
*/
|
||||
|
||||
export const loadAllLanguages = async () => {
|
||||
export async function loadAllLanguages(){
|
||||
//register languages
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:custom","custom.json"))
|
||||
opendiscord.languages.add(new api.ODJsonLanguage("opendiscord:english","english.json"))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllLiveStatusSources = async () => {
|
||||
export async function loadAllLiveStatusSources(){
|
||||
//DEFAULT DJDJ DEV
|
||||
opendiscord.livestatus.add(new api.ODLiveStatusUrlSource(opendiscord,"opendiscord:default-djdj-dev","https://raw.githubusercontent.com/open-discord-bots/open-ticket/refs/heads/dev/src/livestatus.json"))
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
export const loadAllPermissions = async () => {
|
||||
export async function loadAllPermissions(){
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
if (!generalConfig) return
|
||||
const mainServer = opendiscord.client.mainServer
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllPosts = async () => {
|
||||
export async function loadAllPosts(){
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
if (!generalConfig) return
|
||||
const transcriptConfig = opendiscord.configs.get("opendiscord:transcripts")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllProgressBarRenderers = async () => {
|
||||
export async function loadAllProgressBarRenderers(){
|
||||
const defaultSettings: api.ODDefaultProgressBarRendererSettings = {
|
||||
borderColor:"gray",
|
||||
filledBarColor:"openticket",
|
||||
@@ -53,7 +53,7 @@ export const loadAllProgressBarRenderers = async () => {
|
||||
opendiscord.progressbars.renderers.add(new api.ODDefaultProgressBarRenderer("opendiscord:time-min-renderer",timeMinRendererSettings))
|
||||
}
|
||||
|
||||
export const loadAllProgressBars = async () => {
|
||||
export async function loadAllProgressBars(){
|
||||
const fractRenderer = opendiscord.progressbars.renderers.get("opendiscord:fraction-renderer")
|
||||
|
||||
//SLASH COMMAND REMOVE (doesn't have correct amount yet)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
import ansis from "ansis"
|
||||
|
||||
export const loadAllStartScreenComponents = async () => {
|
||||
export async function loadAllStartScreenComponents(){
|
||||
//LOGO
|
||||
opendiscord.startscreen.add(new api.ODStartScreenLogoComponent("opendiscord:logo",1000,[
|
||||
" ██████╗ ██████╗ ███████╗███╗ ██╗ ████████╗██╗ ██████╗██╗ ██╗███████╗████████╗ ",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {opendiscord, api, utilities} from "../../index.js"
|
||||
|
||||
export const loadAllStates = async () => {
|
||||
export async function loadAllStates(){
|
||||
const stateDatabase = opendiscord.databases.get("opendiscord:message-states")
|
||||
|
||||
opendiscord.states.add(new api.ODMessageOriginState("opendiscord:message-origin",opendiscord.client,stateDatabase,{}))
|
||||
opendiscord.states.add(new api.ODInteractiveMessageState("opendiscord:interactive-message",opendiscord.client,stateDatabase,{}))
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import * as discord from "discord.js"
|
||||
const stats = opendiscord.statistics
|
||||
const lang = opendiscord.languages
|
||||
|
||||
export const loadAllStatisticScopes = async () => {
|
||||
export async function loadAllStatisticScopes(){
|
||||
stats.add(new api.ODStatisticGlobalScope("opendiscord:global",utilities.emojiTitle("📊",lang.getTranslation("stats.scopes.global"))))
|
||||
stats.add(new api.ODStatisticGlobalScope("opendiscord:system",utilities.emojiTitle("⚙️",lang.getTranslation("stats.scopes.system"))))
|
||||
stats.add(new api.ODStatisticScope("opendiscord:user",utilities.emojiTitle("📊",lang.getTranslation("stats.scopes.user"))))
|
||||
@@ -13,7 +13,7 @@ export const loadAllStatisticScopes = async () => {
|
||||
stats.add(new api.ODStatisticScope("opendiscord:messages",utilities.emojiTitle("💬",lang.getTranslation("stats.scopes.messages"))))
|
||||
}
|
||||
|
||||
export const loadAllStatistics = async () => {
|
||||
export async function loadAllStatistics(){
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
if (!generalConfig) return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user