Merge branch 'dev' into dev-v4.1.0
This commit is contained in:
@@ -472,6 +472,7 @@ export interface ODLanguageManagerIds_Default {
|
||||
"opendiscord:russian":ODLanguage,
|
||||
"opendiscord:swedish":ODLanguage,
|
||||
"opendiscord:vietnamese":ODLanguage,
|
||||
"opendiscord:persian":ODLanguage,
|
||||
//ADD NEW LANGUAGES HERE!!!
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ export class ODMain {
|
||||
|
||||
constructor(){
|
||||
this.versions = new ODVersionManager_Default()
|
||||
this.versions.add(ODVersion.fromString("opendiscord:version","v4.0.5"))
|
||||
this.versions.add(ODVersion.fromString("opendiscord:version","v4.0.6"))
|
||||
this.versions.add(ODVersion.fromString("opendiscord:api","v1.0.0"))
|
||||
this.versions.add(ODVersion.fromString("opendiscord:transcripts","v2.0.0"))
|
||||
this.versions.add(ODVersion.fromString("opendiscord:livestatus","v2.0.0"))
|
||||
|
||||
@@ -560,8 +560,8 @@ export class ODHTTPGetRequest {
|
||||
this.throwOnError = throwOnError
|
||||
const newConfig = config ?? {}
|
||||
newConfig.method = "GET"
|
||||
if (newConfig.headers) Object.assign(newConfig.headers,{"User-Agent":"OpenDiscordBots-OpenTicket/4.0.5"})
|
||||
else newConfig.headers = {"User-Agent":"OpenDiscordBots-OpenTicket/4.0.5"}
|
||||
if (newConfig.headers) Object.assign(newConfig.headers,{"User-Agent":"OpenDiscordBots-OpenTicket/4.0.6"})
|
||||
else newConfig.headers = {"User-Agent":"OpenDiscordBots-OpenTicket/4.0.6"}
|
||||
this.config = newConfig
|
||||
}
|
||||
|
||||
@@ -615,8 +615,8 @@ export class ODHTTPPostRequest {
|
||||
this.throwOnError = throwOnError
|
||||
const newConfig = config ?? {}
|
||||
newConfig.method = "POST"
|
||||
if (newConfig.headers) Object.assign(newConfig.headers,{"User-Agent":"OpenDiscordBots-OpenTicket/4.0.5"})
|
||||
else newConfig.headers = {"User-Agent":"OpenDiscordBots-OpenTicket/4.0.5"}
|
||||
if (newConfig.headers) Object.assign(newConfig.headers,{"User-Agent":"OpenDiscordBots-OpenTicket/4.0.6"})
|
||||
else newConfig.headers = {"User-Agent":"OpenDiscordBots-OpenTicket/4.0.6"}
|
||||
this.config = newConfig
|
||||
}
|
||||
|
||||
|
||||
@@ -578,8 +578,8 @@ export class ODSlashCommandComparator {
|
||||
}
|
||||
}
|
||||
/**Convert a `ODSlashCommandBuilder` to a universal Open Ticket slash command object for comparison. */
|
||||
convertBuilder(builder:ODSlashCommandBuilder,guildId:string|null): ODSlashCommandUniversalCommand {
|
||||
if (builder.type != discord.ApplicationCommandType.ChatInput) throw new ODSystemError("ODSlashCommandComparator:convertBuilder() is not supported for other types than 'ChatInput'!")
|
||||
convertBuilder(builder:ODSlashCommandBuilder,guildId:string|null): ODSlashCommandUniversalCommand|null {
|
||||
if (builder.type != discord.ApplicationCommandType.ChatInput) return null //throw new ODSystemError("ODSlashCommandComparator:convertBuilder() is not supported for other types than 'ChatInput'!")
|
||||
const nameLoc = builder.nameLocalizations ?? {}
|
||||
const descLoc = builder.descriptionLocalizations ?? {}
|
||||
return {
|
||||
@@ -598,8 +598,8 @@ export class ODSlashCommandComparator {
|
||||
}
|
||||
}
|
||||
/**Convert a `discord.ApplicationCommand` to a universal Open Ticket slash command object for comparison. */
|
||||
convertCommand(cmd:discord.ApplicationCommand): ODSlashCommandUniversalCommand {
|
||||
if (cmd.type != discord.ApplicationCommandType.ChatInput) throw new ODSystemError("ODSlashCommandComparator:convertCommand() is not supported for other types than 'ChatInput'!")
|
||||
convertCommand(cmd:discord.ApplicationCommand): ODSlashCommandUniversalCommand|null {
|
||||
if (cmd.type != discord.ApplicationCommandType.ChatInput) return null //throw new ODSystemError("ODSlashCommandComparator:convertCommand() is not supported for other types than 'ChatInput'!")
|
||||
const nameLoc = cmd.nameLocalizations ?? {}
|
||||
const descLoc = cmd.descriptionLocalizations ?? {}
|
||||
return {
|
||||
@@ -811,6 +811,10 @@ export class ODSlashCommandManager extends ODManager<ODSlashCommand> {
|
||||
//command is registered (and may need to be updated)
|
||||
const universalBuilder = this.comparator.convertBuilder(instance.builder,instance.guildId)
|
||||
const universalCmd = this.comparator.convertCommand(cmd)
|
||||
|
||||
//command is not of the type 'chatinput'
|
||||
if (!universalBuilder || !universalCmd) return
|
||||
|
||||
const didChange = !this.comparator.compare(universalBuilder,universalCmd)
|
||||
const requiresUpdate = didChange || (instance.requiresUpdate ? instance.requiresUpdate(universalCmd) : false)
|
||||
registered.push({instance,cmd:universalCmd,requiresUpdate})
|
||||
@@ -820,8 +824,10 @@ export class ODSlashCommandManager extends ODManager<ODSlashCommand> {
|
||||
})
|
||||
|
||||
cmds.forEach((cmd) => {
|
||||
//command does not exist in the manager
|
||||
unused.push({instance:null,cmd:this.comparator.convertCommand(cmd),requiresUpdate:false})
|
||||
//command does not exist in the manager (only append to unused when type == 'chatinput')
|
||||
const universalCmd = this.comparator.convertCommand(cmd)
|
||||
if (!universalCmd) return
|
||||
unused.push({instance:null,cmd:universalCmd,requiresUpdate:false})
|
||||
})
|
||||
|
||||
return {registered,unregistered,unused}
|
||||
|
||||
Reference in New Issue
Block a user