mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 06:03:04 -04:00
various emoji related fixes
This commit is contained in:
parent
3b6043ee16
commit
c984799654
5 changed files with 36 additions and 24 deletions
|
@ -4,7 +4,7 @@ const { createEmbed } = require("#utils/embed");
|
||||||
const { acknowledge } = require("#utils/interactions");
|
const { acknowledge } = require("#utils/interactions");
|
||||||
const { icon, pill, iconPill, highlight, timestamp } = require("#utils/markdown");
|
const { icon, pill, iconPill, highlight, timestamp } = require("#utils/markdown");
|
||||||
const { editOrReply } = require("#utils/message");
|
const { editOrReply } = require("#utils/message");
|
||||||
const { STATICS } = require("#utils/statics");
|
const { STATICS, STATIC_ASSETS } = require("#utils/statics");
|
||||||
|
|
||||||
const { ingest } = require("#logging");
|
const { ingest } = require("#logging");
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
description: res.data.codes.map((c)=>pill(c)).join(' '),
|
description: res.data.codes.map((c)=>pill(c)).join(' '),
|
||||||
image: {
|
image: {
|
||||||
url: res.data.platforms[DEFAULT_PLATFORM].images[0].src
|
url: res.data.platforms[DEFAULT_PLATFORM].images[0].src || STATIC_ASSETS.emoji_placeholder
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
iconUrl: STATICS.emojipedia,
|
iconUrl: STATICS.emojipedia,
|
||||||
|
@ -204,7 +204,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
description: res.data.codes.map((c)=>pill(c)).join(' '),
|
description: res.data.codes.map((c)=>pill(c)).join(' '),
|
||||||
image: {
|
image: {
|
||||||
url: emojiAsset[0].src
|
url: emojiAsset[0].src || STATIC_ASSETS.emoji_placeholder
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
iconUrl: STATICS.emojipedia,
|
iconUrl: STATICS.emojipedia,
|
||||||
|
@ -255,7 +255,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
description: res.data.codes.map((c)=>pill(c)).join(' '),
|
description: res.data.codes.map((c)=>pill(c)).join(' '),
|
||||||
image: {
|
image: {
|
||||||
url: res.data.platforms[DEFAULT_PLATFORM].images[0].src
|
url: res.data.platforms[DEFAULT_PLATFORM].images[0].src || STATIC_ASSETS.emoji_placeholder
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
iconUrl: STATICS.emojipedia,
|
iconUrl: STATICS.emojipedia,
|
||||||
|
|
|
@ -3,7 +3,7 @@ const { emojipedia } = require("#api");
|
||||||
const { createEmbed } = require("#utils/embed");
|
const { createEmbed } = require("#utils/embed");
|
||||||
const { pill } = require("#utils/markdown");
|
const { pill } = require("#utils/markdown");
|
||||||
const { editOrReply } = require("#utils/message");
|
const { editOrReply } = require("#utils/message");
|
||||||
const { STATICS } = require("#utils/statics");
|
const { STATICS, STATIC_ASSETS } = require("#utils/statics");
|
||||||
|
|
||||||
const { Components } = require("detritus-client/lib/utils");
|
const { Components } = require("detritus-client/lib/utils");
|
||||||
const { InteractionCallbackTypes, MessageComponentButtonStyles, ApplicationCommandOptionTypes } = require("detritus-client/lib/constants");
|
const { InteractionCallbackTypes, MessageComponentButtonStyles, ApplicationCommandOptionTypes } = require("detritus-client/lib/constants");
|
||||||
|
@ -33,7 +33,7 @@ function toCodePoint(unicodeSurrogates, sep) {
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'emoji-info',
|
name: 'emojipedia',
|
||||||
description: 'Shows detailed information about an emoji.',
|
description: 'Shows detailed information about an emoji.',
|
||||||
contexts: [
|
contexts: [
|
||||||
0,
|
0,
|
||||||
|
@ -46,7 +46,7 @@ module.exports = {
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'emoji',
|
name: 'emoji',
|
||||||
description: 'Emoji to enlarge. Use two built-in emoji to mix them.',
|
description: 'Emoji to look up.',
|
||||||
type: ApplicationCommandOptionTypes.TEXT,
|
type: ApplicationCommandOptionTypes.TEXT,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
@ -99,7 +99,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
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
|
url: newView.data.platforms["twitter"].images[0].src || STATIC_ASSETS.emoji_placeholder
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
iconUrl: STATICS.emojipedia,
|
iconUrl: STATICS.emojipedia,
|
||||||
|
@ -139,7 +139,14 @@ module.exports = {
|
||||||
|
|
||||||
// Use the high-res emojipedia icon, if available
|
// Use the high-res emojipedia icon, if available
|
||||||
let ico = `https://abs.twimg.com/emoji/v2/72x72/${toCodePoint(emoji[0])}.png`
|
let ico = `https://abs.twimg.com/emoji/v2/72x72/${toCodePoint(emoji[0])}.png`
|
||||||
if(!res.data.platforms["twitter"]) ico = Object.values(res.data.platforms)[0].images[0].src
|
if(!res.data.platforms["twitter"] && Object.values(res.data.platforms)[0]) ico = Object.values(res.data.platforms)[0].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
|
||||||
|
}
|
||||||
|
|
||||||
currentView = createEmbed("default", context, {
|
currentView = createEmbed("default", context, {
|
||||||
author: {
|
author: {
|
||||||
|
@ -149,7 +156,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
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: res.data.platforms["twitter"].images[0].src
|
url: iPreviewImage || STATIC_ASSETS.emoji_placeholder
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
iconUrl: STATICS.emojipedia,
|
iconUrl: STATICS.emojipedia,
|
||||||
|
|
|
@ -5,7 +5,7 @@ const { ingest } = require("#logging");
|
||||||
const { createEmbed } = require("#utils/embed");
|
const { createEmbed } = require("#utils/embed");
|
||||||
const { icon, pill, iconPill, highlight, timestamp, smallIconPill } = require("#utils/markdown");
|
const { icon, pill, iconPill, highlight, timestamp, smallIconPill } = require("#utils/markdown");
|
||||||
const { editOrReply } = require("#utils/message");
|
const { editOrReply } = require("#utils/message");
|
||||||
const { STATICS } = require("#utils/statics");
|
const { STATICS, STATIC_ASSETS } = require("#utils/statics");
|
||||||
|
|
||||||
const { Utils } = require("detritus-client");
|
const { Utils } = require("detritus-client");
|
||||||
const { Components, Snowflake } = require("detritus-client/lib/utils");
|
const { Components, Snowflake } = require("detritus-client/lib/utils");
|
||||||
|
@ -226,7 +226,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
description: res.data.codes.map((c)=>pill(c)).join(' '),
|
description: res.data.codes.map((c)=>pill(c)).join(' '),
|
||||||
image: {
|
image: {
|
||||||
url: emojiAsset[0].src
|
url: emojiAsset[0].src || STATIC_ASSETS.emoji_placeholder
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
iconUrl: STATICS.emojipedia,
|
iconUrl: STATICS.emojipedia,
|
||||||
|
@ -286,7 +286,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
description: res.data.codes.map((c)=>pill(c)).join(' '),
|
description: res.data.codes.map((c)=>pill(c)).join(' '),
|
||||||
image: {
|
image: {
|
||||||
url: res.data.platforms[DEFAULT_PLATFORM].images[0].src
|
url: res.data.platforms[DEFAULT_PLATFORM].images[0].src || STATIC_ASSETS.emoji_placeholder
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
iconUrl: STATICS.emojipedia,
|
iconUrl: STATICS.emojipedia,
|
||||||
|
|
|
@ -3,7 +3,7 @@ const { emojipedia } = require("#api");
|
||||||
const { createEmbed } = require("#utils/embed");
|
const { createEmbed } = require("#utils/embed");
|
||||||
const { pill, smallIconPill } = require("#utils/markdown");
|
const { pill, smallIconPill } = require("#utils/markdown");
|
||||||
const { editOrReply } = require("#utils/message");
|
const { editOrReply } = require("#utils/message");
|
||||||
const { STATICS } = require("#utils/statics");
|
const { STATICS, STATIC_ASSETS } = require("#utils/statics");
|
||||||
|
|
||||||
// TODO: Turn this into a general purpose permissions constant
|
// TODO: Turn this into a general purpose permissions constant
|
||||||
const { Permissions, InteractionCallbackTypes, MessageComponentButtonStyles } = require("detritus-client/lib/constants");
|
const { Permissions, InteractionCallbackTypes, MessageComponentButtonStyles } = require("detritus-client/lib/constants");
|
||||||
|
@ -33,8 +33,8 @@ function toCodePoint(unicodeSurrogates, sep) {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
label: "emoji",
|
label: "emoji",
|
||||||
name: "emojiinfo",
|
name: "emojipedia",
|
||||||
aliases: ['ei'],
|
aliases: ["emojiinfo", "ei"],
|
||||||
metadata: {
|
metadata: {
|
||||||
description: `${smallIconPill("reply", "Supports Replies")}\n\nDisplays more detailed information about emoji. Only supports unicode emoji.`,
|
description: `${smallIconPill("reply", "Supports Replies")}\n\nDisplays more detailed information about emoji. Only supports unicode emoji.`,
|
||||||
description_short: 'Detailed information about an emoji.',
|
description_short: 'Detailed information about an emoji.',
|
||||||
|
@ -78,8 +78,8 @@ 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
|
ico = `https://abs.twimg.com/emoji/v2/72x72/${toCodePoint(emoji[0])}.png`
|
||||||
if(!newView.data.platforms["twitter"]) ico = Object.values(newView.data.platforms)[0].images[0].src
|
if(!newView.data.platforms["twitter"] && Object.values(newView.data.platforms)[0]) ico = Object.values(newView.data.platforms)[0].images[0].src
|
||||||
|
|
||||||
let previewImage;
|
let previewImage;
|
||||||
if(!newView.data.platforms["twitter"]){
|
if(!newView.data.platforms["twitter"]){
|
||||||
|
@ -96,7 +96,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
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
|
url: previewImage || STATIC_ASSETS.emoji_placeholder
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
iconUrl: STATICS.emojipedia,
|
iconUrl: STATICS.emojipedia,
|
||||||
|
@ -140,12 +140,12 @@ module.exports = {
|
||||||
|
|
||||||
// Use the high-res emojipedia icon, if available
|
// Use the high-res emojipedia icon, if available
|
||||||
let ico = `https://abs.twimg.com/emoji/v2/72x72/${toCodePoint(emoji[0])}.png`
|
let ico = `https://abs.twimg.com/emoji/v2/72x72/${toCodePoint(emoji[0])}.png`
|
||||||
if(!res.data.platforms["twitter"]) ico = Object.values(res.data.platforms)[0].images[0].src
|
if(!res.data.platforms["twitter"] && Object.values(res.data.platforms)[0]) ico = Object.values(res.data.platforms)[0].images[0].src
|
||||||
|
|
||||||
let iPreviewImage;
|
let iPreviewImage;
|
||||||
if(!res.data.platforms["twitter"]){
|
if(!res.data.platforms["twitter"] && Object.values(res.data.platforms)[0]){
|
||||||
iPreviewImage = res.data.platforms[Object.keys(res.data.platforms)[0]].images[0].src
|
iPreviewImage = res.data.platforms[Object.keys(res.data.platforms)[0]].images[0].src
|
||||||
} else {
|
} else if(res.data.platforms["twitter"]){
|
||||||
iPreviewImage = res.data.platforms["twitter"].images[0].src
|
iPreviewImage = res.data.platforms["twitter"].images[0].src
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
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
|
url: iPreviewImage || STATIC_ASSETS.emoji_placeholder
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
iconUrl: STATICS.emojipedia,
|
iconUrl: STATICS.emojipedia,
|
||||||
|
|
|
@ -16,6 +16,10 @@ const Statics = Object.freeze({
|
||||||
file: "misc/embed-spacer-botinvite.png",
|
file: "misc/embed-spacer-botinvite.png",
|
||||||
revision: 0
|
revision: 0
|
||||||
},
|
},
|
||||||
|
emoji_placeholder: {
|
||||||
|
file: "misc/emoji-placeholder.png",
|
||||||
|
revision: 0
|
||||||
|
},
|
||||||
},
|
},
|
||||||
brands: {
|
brands: {
|
||||||
anthropic: {
|
anthropic: {
|
||||||
|
@ -236,5 +240,6 @@ module.exports.STATIC_ICONS = Object.freeze({
|
||||||
module.exports.STATIC_ASSETS = Object.freeze({
|
module.exports.STATIC_ASSETS = Object.freeze({
|
||||||
chat_loading: staticAsset(Statics.assets.chat_loading),
|
chat_loading: staticAsset(Statics.assets.chat_loading),
|
||||||
image_loading: staticAsset(Statics.assets.image_loading),
|
image_loading: staticAsset(Statics.assets.image_loading),
|
||||||
embed_invite_spacer: staticAsset(Statics.assets.embed_invite_spacer)
|
embed_invite_spacer: staticAsset(Statics.assets.embed_invite_spacer),
|
||||||
|
emoji_placeholder: staticAsset(Statics.assets.emoji_placeholder)
|
||||||
})
|
})
|
Loading…
Add table
Add a link
Reference in a new issue