Updated german & fixed async forEach errors
This commit is contained in:
@@ -882,7 +882,7 @@ const blacklistEmbeds = () => {
|
||||
const {user} = params
|
||||
|
||||
const renderedUsers: string[] = []
|
||||
openticket.blacklist.loopAll((blacklist,id) => {renderedUsers.push(discord.userMention(id.value)+" - "+(blacklist.reason ? blacklist.reason : "/"))})
|
||||
await openticket.blacklist.loopAll((blacklist,id) => {renderedUsers.push(discord.userMention(id.value)+" - "+(blacklist.reason ? blacklist.reason : "/"))})
|
||||
|
||||
instance.setAuthor(user.displayName,user.displayAvatarURL())
|
||||
instance.setColor(generalConfig.data.mainColor)
|
||||
|
||||
@@ -65,7 +65,7 @@ export class ODCheckerManager extends ODManager<ODChecker> {
|
||||
if (!res.valid) isValid = false
|
||||
})
|
||||
|
||||
this.functions.loopAll((func) => {
|
||||
this.functions.getAll().forEach((func) => {
|
||||
const res = func.func(this,this.functions)
|
||||
final.push(...res.messages)
|
||||
|
||||
|
||||
@@ -496,7 +496,7 @@ export class ODSlashCommandManager extends ODManager<ODSlashCommand> {
|
||||
const existing: {cmd:ODSlashCommand, requiresUpdate:boolean}[] = []
|
||||
const nonExisting: ODSlashCommand[] = []
|
||||
|
||||
this.loopAll((cmd) => {
|
||||
await this.loopAll((cmd) => {
|
||||
if (guildId && cmd.guildId != guildId) return
|
||||
const result = cmds.find((cmddata) => cmddata.name == cmd.name)
|
||||
if (result){
|
||||
@@ -977,7 +977,7 @@ export class ODTextCommandManager extends ODManager<ODTextCommand> {
|
||||
|
||||
//filter commands for correct prefix
|
||||
const validPrefixCommands: {cmd:ODTextCommand,newContent:string}[] = []
|
||||
this.loopAll((cmd) => {
|
||||
await this.loopAll((cmd) => {
|
||||
if (msg.content.startsWith(cmd.builder.prefix)) validPrefixCommands.push({
|
||||
cmd:cmd,
|
||||
newContent:msg.content.substring(cmd.builder.prefix.length)
|
||||
@@ -1403,7 +1403,7 @@ export class ODTextCommandManager extends ODManager<ODTextCommand> {
|
||||
}
|
||||
}
|
||||
}else if (option.required){
|
||||
//REQUIRED => ERROR IF NOD EXISTING
|
||||
//REQUIRED => ERROR IF NOT EXISTING
|
||||
const invalidRegex = /^[^ ]+/
|
||||
const invalidRes = invalidRegex.exec(tempContent)
|
||||
if (invalidRes) optionError("invalid_option",option,location,invalidRes[0],"mentionable_not_found")
|
||||
|
||||
@@ -138,8 +138,8 @@ export class ODCounterCooldown extends ODCooldown<{value:number}> {
|
||||
}
|
||||
async init(){
|
||||
if (this.ready) return
|
||||
setInterval(() => {
|
||||
this.data.loopAll((cooldown) => {
|
||||
setInterval(async () => {
|
||||
await this.data.loopAll((cooldown) => {
|
||||
cooldown.data.value = cooldown.data.value - this.decrement
|
||||
if (cooldown.data.value <= this.cancelLimit){
|
||||
cooldown.active = false
|
||||
@@ -216,8 +216,8 @@ export class ODIncrementalCounterCooldown extends ODCooldown<{value:number}> {
|
||||
}
|
||||
async init(){
|
||||
if (this.ready) return
|
||||
setInterval(() => {
|
||||
this.data.loopAll((cooldown) => {
|
||||
setInterval(async () => {
|
||||
await this.data.loopAll((cooldown) => {
|
||||
cooldown.data.value = cooldown.data.value - this.decrement
|
||||
if (cooldown.data.value <= this.cancelLimit){
|
||||
cooldown.active = false
|
||||
|
||||
@@ -65,8 +65,8 @@ export class ODFlagManager extends ODManager<ODFlag> {
|
||||
}
|
||||
|
||||
/**Set all flags to their `process.argv` value. */
|
||||
init(){
|
||||
this.loopAll((flag) => {
|
||||
async init(){
|
||||
await this.loopAll((flag) => {
|
||||
flag.detectProcessParams(false)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ const preloadMigrationContext = async () => {
|
||||
|
||||
const unloadMigrationContext = async () => {
|
||||
openticket.debug.visible = false
|
||||
openticket.databases.loopAll((database,id) => {openticket.databases.remove(id)})
|
||||
openticket.configs.loopAll((config,id) => {openticket.configs.remove(id)})
|
||||
openticket.flags.loopAll((flag,id) => {openticket.flags.remove(id)})
|
||||
await openticket.databases.loopAll((database,id) => {openticket.databases.remove(id)})
|
||||
await openticket.configs.loopAll((config,id) => {openticket.configs.remove(id)})
|
||||
await openticket.flags.loopAll((flag,id) => {openticket.flags.remove(id)})
|
||||
openticket.debug.debug("-- MIGRATION CONTEXT END --")
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ const loadAllVersionMigrations = async (lastVersion:api.ODVersion) => {
|
||||
const saveAllVersionsToDatabase = async () => {
|
||||
const globalDatabase = openticket.databases.get("openticket:global")
|
||||
|
||||
openticket.versions.loopAll((version,id) => {
|
||||
await openticket.versions.loopAll((version,id) => {
|
||||
globalDatabase.set("openticket:last-version",id.value,version.toString())
|
||||
})
|
||||
}
|
||||
@@ -135,9 +135,9 @@ export const loadDatabaseCleanersCode = async () => {
|
||||
//OPTION DATABASE CLEANER
|
||||
openticket.code.add(new api.ODCode("openticket:option-database-cleaner",10,() => {
|
||||
//delete all unused options
|
||||
openticket.options.loopAll((option,id) => {
|
||||
if (optionDatabase.exists("openticket:used-option",id.value) && !openticket.tickets.getAll().some((ticket) => ticket.id.value == id.value)){
|
||||
optionDatabase.delete("openticket:used-option",id.value)
|
||||
openticket.options.getAll().forEach((option) => {
|
||||
if (optionDatabase.exists("openticket:used-option",option.id.value) && !openticket.tickets.getAll().some((ticket) => ticket.option.id.value == option.id.value)){
|
||||
optionDatabase.delete("openticket:used-option",option.id.value)
|
||||
}
|
||||
})
|
||||
}))
|
||||
@@ -331,9 +331,9 @@ export const loadDatabaseSaversCode = async () => {
|
||||
}
|
||||
|
||||
//delete all unused options on ticket move
|
||||
openticket.options.loopAll((option,id) => {
|
||||
if (optionDatabase.exists("openticket:used-option",id.value) && !openticket.tickets.getAll().some((ticket) => ticket.id.value == id.value)){
|
||||
optionDatabase.delete("openticket:used-option",id.value)
|
||||
openticket.options.getAll().forEach((option) => {
|
||||
if (optionDatabase.exists("openticket:used-option",option.id.value) && !openticket.tickets.getAll().some((ticket) => ticket.option.id.value == option.id.value)){
|
||||
optionDatabase.delete("openticket:used-option",option.id.value)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {openticket, api, utilities} from "../../index"
|
||||
|
||||
export const loadAllCooldowns = async () => {
|
||||
openticket.options.loopAll((option) => {
|
||||
await openticket.options.loopAll((option) => {
|
||||
if (!(option instanceof api.ODTicketOption)) return
|
||||
loadTicketOptionCooldown(option)
|
||||
})
|
||||
|
||||
@@ -30,7 +30,7 @@ export const loadAllPermissions = async () => {
|
||||
})
|
||||
|
||||
//TICKET ADMINS
|
||||
openticket.tickets.loopAll(async (ticket) => {
|
||||
await openticket.tickets.loopAll(async (ticket) => {
|
||||
try {
|
||||
const channel = await openticket.client.fetchGuildTextChannel(mainServer,ticket.id.value)
|
||||
if (!channel) return
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {openticket, api, utilities} from "../../index"
|
||||
|
||||
export const loadAllRoles = async () => {
|
||||
openticket.options.loopAll((opt) => {
|
||||
await openticket.options.loopAll((opt) => {
|
||||
if (opt instanceof api.ODRoleOption){
|
||||
openticket.roles.add(loadRole(opt))
|
||||
}
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ const main = async () => {
|
||||
//initiate flags
|
||||
await openticket.events.get("onFlagInit").emit([openticket.flags])
|
||||
if (openticket.defaults.getDefault("flagInitiating")){
|
||||
openticket.flags.init()
|
||||
await openticket.flags.init()
|
||||
openticket.debugfile.writeText("\n[ENABLED FLAGS]:\n"+openticket.flags.getFiltered((flag) => (flag.value == true)).map((flag) => flag.id.value).join("\n")+"\n")
|
||||
await openticket.events.get("afterFlagsInitiated").emit([openticket.flags])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user