From 106cb0f718cd104c31687643dbe71a53788e1687 Mon Sep 17 00:00:00 2001 From: DJj123dj <80536295+DJj123dj@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:46:49 +0100 Subject: [PATCH] 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. --- plugins/example-plugin/index.ts | 1 - src/builders/dropdowns.ts | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/example-plugin/index.ts b/plugins/example-plugin/index.ts index 1a9396a..ec70562 100644 --- a/plugins/example-plugin/index.ts +++ b/plugins/example-plugin/index.ts @@ -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.isBeta) throw new api.ODPluginError("This plugin is made for the beta version of Open Ticket!") //Add Typescript autocomplete support for plugin data. (!!!OPTIONAL!!!) declare module "../../src/core/api/api.js" { diff --git a/src/builders/dropdowns.ts b/src/builders/dropdowns.ts index 5a35404..15f70fa 100644 --- a/src/builders/dropdowns.ts +++ b/src/builders/dropdowns.ts @@ -17,14 +17,15 @@ const panelDropdowns = () => { new api.ODWorker("openticket:panel-dropdown-tickets",0,async (instance,params) => { const {panel,options} = params - const parsedOptions: api.ODDropdownData["options"] = options.map((option) => { const desc = option.get("openticket:description").value.substring(0,100) + const emoji = option.get("openticket:button-emoji").value return { label:option.get("openticket:button-label").value.substring(0,100), value:"od:ticket-option_"+panel.id.value+"_"+option.id.value, - emoji:option.get("openticket:button-emoji").value, - description:(desc.length > 0) ? desc : undefined + emoji:(emoji.length > 0) ? emoji : undefined, + description:(desc.length > 0) ? desc : undefined, + default:false } })