mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 14:43:05 -04:00
changes relating to default emoji
This commit is contained in:
parent
d8c86959f5
commit
f49bd95116
4 changed files with 34 additions and 38 deletions
|
@ -133,7 +133,7 @@ module.exports = {
|
|||
|
||||
if(Object.keys(res.data.platforms).length === 0) return await editOrReply(context, createEmbed("error", context, "No images available for this emoji."));
|
||||
|
||||
let currentPlatform = "twitter";
|
||||
let currentPlatform = "discord";
|
||||
|
||||
if(!res.data.platforms[currentPlatform]) currentPlatform = Object.keys(res.data.platforms)[0]
|
||||
else currentPlatform = "twitter"
|
||||
|
@ -141,9 +141,11 @@ module.exports = {
|
|||
// Use the high-res emojipedia icon, if available
|
||||
let ico = `https://raw.githubusercontent.com/jdecked/twemoji/main/assets/72x72/${toCodePoint(emoji[0])}.png`
|
||||
if(res.data.platforms["twitter"]) ico = res.data.platforms["twitter"].images[0].src
|
||||
if(res.data.platforms["discord"]) ico = res.data.platforms["discord"].images[0].src
|
||||
|
||||
const DEFAULT_PLATFORM = currentPlatform
|
||||
|
||||
|
||||
let currentView;
|
||||
let currentRevision = "";
|
||||
|
||||
|
|
|
@ -88,18 +88,20 @@ module.exports = {
|
|||
let newView = await emojipedia(context, ctx.data.customId)
|
||||
newView = newView.response.body
|
||||
|
||||
ico = newView.data.platforms["twitter"].images[0].src
|
||||
if(!newView.data.platforms["twitter"]) ico = Object.values(newView.data.platforms)[0].images[0].src
|
||||
let newIcon;
|
||||
if(newView.data.platforms["twitter"]) newIcon = newView.data.platforms["twitter"].images[0].src;
|
||||
if(newView.data.platforms["discord"]) newIcon = newView.data.platforms["discord"].images[0].src;
|
||||
if(!newIcon && Object.values(newView.data.platforms).length >= 1) newIcon = Object.values(newView.data.platforms)[0].images[0].src
|
||||
|
||||
currentView = createEmbed("default", context, {
|
||||
author: {
|
||||
iconUrl: ico,
|
||||
iconUrl: newIcon,
|
||||
name: `${newView.data.name} • Emoji ${newView.data.metadata.version.emoji}`,
|
||||
url: newView.data.link
|
||||
},
|
||||
description: newView.data.codes.map((c)=>pill(c)).join(' ') + "\n\n" + newView.data.metadata.description,
|
||||
image: {
|
||||
url: newView.data.platforms["twitter"].images[0].src || STATIC_ASSETS.emoji_placeholder
|
||||
url: newIcon || STATIC_ASSETS.emoji_placeholder
|
||||
},
|
||||
footer: {
|
||||
iconUrl: STATICS.emojipedia,
|
||||
|
@ -138,25 +140,21 @@ module.exports = {
|
|||
}, 100000)
|
||||
|
||||
// Use the high-res emojipedia icon, if available
|
||||
let ico = `https://raw.githubusercontent.com/jdecked/twemoji/main/assets/72x72/${toCodePoint(emoji[0])}.png`
|
||||
let ico;
|
||||
if(res.data.platforms["twitter"]) ico = res.data.platforms["twitter"].images[0].src
|
||||
|
||||
let iPreviewImage;
|
||||
if(!res.data.platforms["twitter"] && Object.values(res.data.platforms)[0]){
|
||||
iPreviewImage = res.data.platforms[Object.keys(res.data.platforms)[0]].images[0].src
|
||||
} else if(res.data.platforms["twitter"]){
|
||||
iPreviewImage = res.data.platforms["twitter"].images[0].src
|
||||
}
|
||||
if(res.data.platforms["discord"]) ico = res.data.platforms["discord"].images[0].src
|
||||
if(!ico && Object.values(res.data.platforms).length >= 1) ico = Object.values(res.data.platforms)[0].images[0].src
|
||||
|
||||
currentView = createEmbed("default", context, {
|
||||
author: {
|
||||
iconUrl: ico,
|
||||
name: `${res.data.name} • Unicode ${res.data.metadata.version.unicode}`,
|
||||
// TODO: emoji_placeholder_small
|
||||
iconUrl: ico || STATIC_ASSETS.emoji_placeholder,
|
||||
name: `${res.data.name} • Emoji ${res.data.metadata.version.emoji}`,
|
||||
url: res.data.link
|
||||
},
|
||||
description: res.data.codes.map((c)=>pill(c)).join(' ') + "\n\n" + res.data.metadata.description,
|
||||
image: {
|
||||
url: iPreviewImage || STATIC_ASSETS.emoji_placeholder
|
||||
url: ico || STATIC_ASSETS.emoji_placeholder
|
||||
},
|
||||
footer: {
|
||||
iconUrl: STATICS.emojipedia,
|
||||
|
|
|
@ -155,6 +155,9 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
// This handles selecting the correct "default" platform for enlarge.
|
||||
if(res.data.platforms["discord"]) args.type = "discord"
|
||||
|
||||
if(!res.data.platforms[args.type]){
|
||||
let embed = createEmbed("error", context, "No emoji image available for platform '" + args.type + "'.")
|
||||
embed.footer = {
|
||||
|
@ -166,6 +169,7 @@ module.exports = {
|
|||
// Use the high-res emojipedia icon, if available
|
||||
let ico = `https://raw.githubusercontent.com/jdecked/twemoji/main/assets/72x72/${toCodePoint(emoji[0])}.png`
|
||||
if(res.data.platforms["twitter"]) ico = res.data.platforms["twitter"].images[0].src
|
||||
if(res.data.platforms["discord"]) ico = res.data.platforms["discord"].images[0].src
|
||||
|
||||
const DEFAULT_PLATFORM = args.type
|
||||
|
||||
|
|
|
@ -79,25 +79,21 @@ module.exports = {
|
|||
let newView = await emojipedia(context, ctx.data.customId)
|
||||
newView = newView.response.body
|
||||
|
||||
ico = `https://raw.githubusercontent.com/jdecked/twemoji/main/assets/72x72/${toCodePoint(emoji[0])}.png`
|
||||
if(newView.data.platforms["twitter"]) ico = res.data.platforms["twitter"].images[0].src
|
||||
|
||||
let previewImage;
|
||||
if(!newView.data.platforms["twitter"]){
|
||||
newView.data.platforms[Object.keys(newView.data.platforms)[0]].images[0].src
|
||||
} else {
|
||||
previewImage = newView.data.platforms["twitter"].images[0].src
|
||||
}
|
||||
let newIcon;
|
||||
if(newView.data.platforms["twitter"]) newIcon = newView.data.platforms["twitter"].images[0].src;
|
||||
if(newView.data.platforms["discord"]) newIcon = newView.data.platforms["discord"].images[0].src;
|
||||
if(!newIcon && Object.values(newView.data.platforms).length >= 1) newIcon = Object.values(newView.data.platforms)[0].images[0].src
|
||||
|
||||
currentView = createEmbed("default", context, {
|
||||
author: {
|
||||
iconUrl: ico,
|
||||
// TODO: emoji_placeholder_small
|
||||
iconUrl: newIcon || STATIC_ASSETS.emoji_placeholder,
|
||||
name: `${newView.data.name} `,
|
||||
url: newView.data.link
|
||||
},
|
||||
description: newView.data.codes.map((c)=>pill(c)).join(' ') + "\n\n" + newView.data.metadata.description,
|
||||
image: {
|
||||
url: previewImage || STATIC_ASSETS.emoji_placeholder
|
||||
url: newIcon || STATIC_ASSETS.emoji_placeholder
|
||||
},
|
||||
footer: {
|
||||
iconUrl: STATICS.emojipedia,
|
||||
|
@ -140,25 +136,21 @@ module.exports = {
|
|||
}, 100000)
|
||||
|
||||
// Use the high-res emojipedia icon, if available
|
||||
let ico = `https://raw.githubusercontent.com/jdecked/twemoji/main/assets/72x72/${toCodePoint(emoji[0])}.png`
|
||||
let ico;
|
||||
if(res.data.platforms["twitter"]) ico = res.data.platforms["twitter"].images[0].src
|
||||
|
||||
let iPreviewImage;
|
||||
if(!res.data.platforms["twitter"] && Object.values(res.data.platforms)[0]){
|
||||
iPreviewImage = res.data.platforms[Object.keys(res.data.platforms)[0]].images[0].src
|
||||
} else if(res.data.platforms["twitter"]){
|
||||
iPreviewImage = res.data.platforms["twitter"].images[0].src
|
||||
}
|
||||
if(res.data.platforms["discord"]) ico = res.data.platforms["discord"].images[0].src
|
||||
if(!ico && Object.values(res.data.platforms).length >= 1) ico = Object.values(res.data.platforms)[0].images[0].src
|
||||
|
||||
currentView = createEmbed("default", context, {
|
||||
author: {
|
||||
iconUrl: ico,
|
||||
// TODO: emoji_placeholder_small
|
||||
iconUrl: ico || STATIC_ASSETS.emoji_placeholder,
|
||||
name: `${res.data.name} `,
|
||||
url: res.data.link
|
||||
},
|
||||
description: res.data.codes.map((c)=>pill(c)).join(' ') + "\n\n" + res.data.metadata.description,
|
||||
image: {
|
||||
url: iPreviewImage || STATIC_ASSETS.emoji_placeholder
|
||||
url: ico || STATIC_ASSETS.emoji_placeholder
|
||||
},
|
||||
footer: {
|
||||
iconUrl: STATICS.emojipedia,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue