mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 06:03:04 -04:00
disable selects (depends on 4881bf6e)
This commit is contained in:
parent
28d67297b6
commit
a9a3c4bfbd
1 changed files with 14 additions and 19 deletions
|
@ -163,23 +163,6 @@ module.exports = {
|
||||||
else ico = res.data.platforms["twitter"].images[0].src
|
else ico = res.data.platforms["twitter"].images[0].src
|
||||||
|
|
||||||
const DEFAULT_PLATFORM = args.type
|
const DEFAULT_PLATFORM = args.type
|
||||||
let platformEmoji = res.data.platforms[DEFAULT_PLATFORM]
|
|
||||||
|
|
||||||
if(platformEmoji.images.length == 1) return editOrReply(context, createEmbed("default", context, {
|
|
||||||
author: {
|
|
||||||
iconUrl: ico,
|
|
||||||
name: `${res.data.name} • ${res.data.platforms[DEFAULT_PLATFORM].images[0].version}`,
|
|
||||||
url: res.data.link
|
|
||||||
},
|
|
||||||
description: res.data.codes.map((c)=>pill(c)).join(' '),
|
|
||||||
image: {
|
|
||||||
url: res.data.platforms[DEFAULT_PLATFORM].images[0].src
|
|
||||||
},
|
|
||||||
footer: {
|
|
||||||
iconUrl: STATICS.emojipedia,
|
|
||||||
text: `Emojipedia • ${context.application.name}`
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
|
|
||||||
let currentView;
|
let currentView;
|
||||||
let currentPlatform = args.type;
|
let currentPlatform = args.type;
|
||||||
|
@ -197,6 +180,12 @@ module.exports = {
|
||||||
currentPlatform = ctx.data.values[0];
|
currentPlatform = ctx.data.values[0];
|
||||||
currentRevision = res.data.platforms[currentPlatform].images[0].id
|
currentRevision = res.data.platforms[currentPlatform].images[0].id
|
||||||
|
|
||||||
|
// Ensure the select is disabled if we only have sprites for one platform
|
||||||
|
components.components[0].components[0].disabled = (res.data.platforms.length == 1)
|
||||||
|
|
||||||
|
// Disable options select if only one sprite is available
|
||||||
|
components.components[1].components[0].disabled = (res.data.platforms[currentPlatform].images.length == 1)
|
||||||
|
|
||||||
for (let i = 0; i < components.components[0].components[0].options.length; i++) {
|
for (let i = 0; i < components.components[0].components[0].options.length; i++) {
|
||||||
components.components[0].components[0].options[i].default = (components.components[0].components[0].options[i].value == currentPlatform)
|
components.components[0].components[0].options[i].default = (components.components[0].components[0].options[i].value == currentPlatform)
|
||||||
}
|
}
|
||||||
|
@ -214,7 +203,11 @@ module.exports = {
|
||||||
} else if(ctx.data.customId == "emoji-version"){
|
} else if(ctx.data.customId == "emoji-version"){
|
||||||
for (let i = 0; i < components.components[1].components[0].options.length; i++) {
|
for (let i = 0; i < components.components[1].components[0].options.length; i++) {
|
||||||
components.components[1].components[0].options[i].default = (components.components[1].components[0].options[i].value == ctx.data.values[0])
|
components.components[1].components[0].options[i].default = (components.components[1].components[0].options[i].value == ctx.data.values[0])
|
||||||
|
components.components[1].components[0].options[i].default = (components.components[1].components[0].options[i].value == ctx.data.values[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable options select if only one sprite is available
|
||||||
|
components.components[1].components[0].disabled = (res.data.platforms[currentPlatform].images.length == 1)
|
||||||
currentRevision = ctx.data.values[0];
|
currentRevision = ctx.data.values[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,13 +257,15 @@ module.exports = {
|
||||||
components.addSelectMenu({
|
components.addSelectMenu({
|
||||||
placeholder: "Select platform type",
|
placeholder: "Select platform type",
|
||||||
customId: "emoji-type",
|
customId: "emoji-type",
|
||||||
options: selectTypeOptions
|
options: selectTypeOptions,
|
||||||
|
disabled: (res.data.platforms.length === 1)
|
||||||
})
|
})
|
||||||
|
|
||||||
components.addSelectMenu({
|
components.addSelectMenu({
|
||||||
placeholder: "Select emoji revision",
|
placeholder: "Select emoji revision",
|
||||||
customId: "emoji-version",
|
customId: "emoji-version",
|
||||||
options: selectOptions
|
options: selectOptions,
|
||||||
|
disabled: (res.data.platforms[DEFAULT_PLATFORM].images.length === 1)
|
||||||
})
|
})
|
||||||
|
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue