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."));
|
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]
|
if(!res.data.platforms[currentPlatform]) currentPlatform = Object.keys(res.data.platforms)[0]
|
||||||
else currentPlatform = "twitter"
|
else currentPlatform = "twitter"
|
||||||
|
@ -141,9 +141,11 @@ module.exports = {
|
||||||
// Use the high-res emojipedia icon, if available
|
// 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 = `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["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
|
const DEFAULT_PLATFORM = currentPlatform
|
||||||
|
|
||||||
|
|
||||||
let currentView;
|
let currentView;
|
||||||
let currentRevision = "";
|
let currentRevision = "";
|
||||||
|
|
||||||
|
|
|
@ -88,18 +88,20 @@ module.exports = {
|
||||||
let newView = await emojipedia(context, ctx.data.customId)
|
let newView = await emojipedia(context, ctx.data.customId)
|
||||||
newView = newView.response.body
|
newView = newView.response.body
|
||||||
|
|
||||||
ico = newView.data.platforms["twitter"].images[0].src
|
let newIcon;
|
||||||
if(!newView.data.platforms["twitter"]) ico = Object.values(newView.data.platforms)[0].images[0].src
|
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, {
|
currentView = createEmbed("default", context, {
|
||||||
author: {
|
author: {
|
||||||
iconUrl: ico,
|
iconUrl: newIcon,
|
||||||
name: `${newView.data.name} • Emoji ${newView.data.metadata.version.emoji}`,
|
name: `${newView.data.name} • Emoji ${newView.data.metadata.version.emoji}`,
|
||||||
url: newView.data.link
|
url: newView.data.link
|
||||||
},
|
},
|
||||||
description: newView.data.codes.map((c)=>pill(c)).join(' ') + "\n\n" + newView.data.metadata.description,
|
description: newView.data.codes.map((c)=>pill(c)).join(' ') + "\n\n" + newView.data.metadata.description,
|
||||||
image: {
|
image: {
|
||||||
url: newView.data.platforms["twitter"].images[0].src || STATIC_ASSETS.emoji_placeholder
|
url: newIcon || STATIC_ASSETS.emoji_placeholder
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
iconUrl: STATICS.emojipedia,
|
iconUrl: STATICS.emojipedia,
|
||||||
|
@ -138,25 +140,21 @@ module.exports = {
|
||||||
}, 100000)
|
}, 100000)
|
||||||
|
|
||||||
// Use the high-res emojipedia icon, if available
|
// 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
|
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
|
||||||
let iPreviewImage;
|
if(!ico && Object.values(res.data.platforms).length >= 1) ico = Object.values(res.data.platforms)[0].images[0].src
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
currentView = createEmbed("default", context, {
|
currentView = createEmbed("default", context, {
|
||||||
author: {
|
author: {
|
||||||
iconUrl: ico,
|
// TODO: emoji_placeholder_small
|
||||||
name: `${res.data.name} • Unicode ${res.data.metadata.version.unicode}`,
|
iconUrl: ico || STATIC_ASSETS.emoji_placeholder,
|
||||||
|
name: `${res.data.name} • Emoji ${res.data.metadata.version.emoji}`,
|
||||||
url: res.data.link
|
url: res.data.link
|
||||||
},
|
},
|
||||||
description: res.data.codes.map((c)=>pill(c)).join(' ') + "\n\n" + res.data.metadata.description,
|
description: res.data.codes.map((c)=>pill(c)).join(' ') + "\n\n" + res.data.metadata.description,
|
||||||
image: {
|
image: {
|
||||||
url: iPreviewImage || STATIC_ASSETS.emoji_placeholder
|
url: ico || STATIC_ASSETS.emoji_placeholder
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
iconUrl: STATICS.emojipedia,
|
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]){
|
if(!res.data.platforms[args.type]){
|
||||||
let embed = createEmbed("error", context, "No emoji image available for platform '" + args.type + "'.")
|
let embed = createEmbed("error", context, "No emoji image available for platform '" + args.type + "'.")
|
||||||
embed.footer = {
|
embed.footer = {
|
||||||
|
@ -166,6 +169,7 @@ module.exports = {
|
||||||
// Use the high-res emojipedia icon, if available
|
// 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 = `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["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
|
const DEFAULT_PLATFORM = args.type
|
||||||
|
|
||||||
|
|
|
@ -78,26 +78,22 @@ module.exports = {
|
||||||
|
|
||||||
let newView = await emojipedia(context, ctx.data.customId)
|
let newView = await emojipedia(context, ctx.data.customId)
|
||||||
newView = newView.response.body
|
newView = newView.response.body
|
||||||
|
|
||||||
ico = `https://raw.githubusercontent.com/jdecked/twemoji/main/assets/72x72/${toCodePoint(emoji[0])}.png`
|
let newIcon;
|
||||||
if(newView.data.platforms["twitter"]) ico = res.data.platforms["twitter"].images[0].src
|
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;
|
||||||
let previewImage;
|
if(!newIcon && Object.values(newView.data.platforms).length >= 1) newIcon = Object.values(newView.data.platforms)[0].images[0].src
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
currentView = createEmbed("default", context, {
|
currentView = createEmbed("default", context, {
|
||||||
author: {
|
author: {
|
||||||
iconUrl: ico,
|
// TODO: emoji_placeholder_small
|
||||||
|
iconUrl: newIcon || STATIC_ASSETS.emoji_placeholder,
|
||||||
name: `${newView.data.name} `,
|
name: `${newView.data.name} `,
|
||||||
url: newView.data.link
|
url: newView.data.link
|
||||||
},
|
},
|
||||||
description: newView.data.codes.map((c)=>pill(c)).join(' ') + "\n\n" + newView.data.metadata.description,
|
description: newView.data.codes.map((c)=>pill(c)).join(' ') + "\n\n" + newView.data.metadata.description,
|
||||||
image: {
|
image: {
|
||||||
url: previewImage || STATIC_ASSETS.emoji_placeholder
|
url: newIcon || STATIC_ASSETS.emoji_placeholder
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
iconUrl: STATICS.emojipedia,
|
iconUrl: STATICS.emojipedia,
|
||||||
|
@ -140,25 +136,21 @@ module.exports = {
|
||||||
}, 100000)
|
}, 100000)
|
||||||
|
|
||||||
// Use the high-res emojipedia icon, if available
|
// 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
|
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
|
||||||
let iPreviewImage;
|
if(!ico && Object.values(res.data.platforms).length >= 1) ico = Object.values(res.data.platforms)[0].images[0].src
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
currentView = createEmbed("default", context, {
|
currentView = createEmbed("default", context, {
|
||||||
author: {
|
author: {
|
||||||
iconUrl: ico,
|
// TODO: emoji_placeholder_small
|
||||||
|
iconUrl: ico || STATIC_ASSETS.emoji_placeholder,
|
||||||
name: `${res.data.name} `,
|
name: `${res.data.name} `,
|
||||||
url: res.data.link
|
url: res.data.link
|
||||||
},
|
},
|
||||||
description: res.data.codes.map((c)=>pill(c)).join(' ') + "\n\n" + res.data.metadata.description,
|
description: res.data.codes.map((c)=>pill(c)).join(' ') + "\n\n" + res.data.metadata.description,
|
||||||
image: {
|
image: {
|
||||||
url: iPreviewImage || STATIC_ASSETS.emoji_placeholder
|
url: ico || STATIC_ASSETS.emoji_placeholder
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
iconUrl: STATICS.emojipedia,
|
iconUrl: STATICS.emojipedia,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue