Fixed dropdown not supporting empty emojis
Fixed a bug that caused the bot to crash when spawning a dropdown panel which includes an option without emoji.
This commit is contained in:
@@ -7,7 +7,6 @@ import * as discord from "discord.js"
|
|||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
|
|
||||||
if (utilities.project != "openticket") throw new api.ODPluginError("This plugin only works in Open Ticket!")
|
if (utilities.project != "openticket") throw new api.ODPluginError("This plugin only works in Open Ticket!")
|
||||||
if (!utilities.isBeta) throw new api.ODPluginError("This plugin is made for the beta version of Open Ticket!")
|
|
||||||
|
|
||||||
//Add Typescript autocomplete support for plugin data. (!!!OPTIONAL!!!)
|
//Add Typescript autocomplete support for plugin data. (!!!OPTIONAL!!!)
|
||||||
declare module "../../src/core/api/api.js" {
|
declare module "../../src/core/api/api.js" {
|
||||||
|
|||||||
@@ -17,14 +17,15 @@ const panelDropdowns = () => {
|
|||||||
new api.ODWorker("openticket:panel-dropdown-tickets",0,async (instance,params) => {
|
new api.ODWorker("openticket:panel-dropdown-tickets",0,async (instance,params) => {
|
||||||
const {panel,options} = params
|
const {panel,options} = params
|
||||||
|
|
||||||
|
|
||||||
const parsedOptions: api.ODDropdownData["options"] = options.map((option) => {
|
const parsedOptions: api.ODDropdownData["options"] = options.map((option) => {
|
||||||
const desc = option.get("openticket:description").value.substring(0,100)
|
const desc = option.get("openticket:description").value.substring(0,100)
|
||||||
|
const emoji = option.get("openticket:button-emoji").value
|
||||||
return {
|
return {
|
||||||
label:option.get("openticket:button-label").value.substring(0,100),
|
label:option.get("openticket:button-label").value.substring(0,100),
|
||||||
value:"od:ticket-option_"+panel.id.value+"_"+option.id.value,
|
value:"od:ticket-option_"+panel.id.value+"_"+option.id.value,
|
||||||
emoji:option.get("openticket:button-emoji").value,
|
emoji:(emoji.length > 0) ? emoji : undefined,
|
||||||
description:(desc.length > 0) ? desc : undefined
|
description:(desc.length > 0) ? desc : undefined,
|
||||||
|
default:false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user