[nextgen] Add DynamicCardStack

This commit is contained in:
big nutty 2025-02-13 01:41:05 +00:00
parent 048073b522
commit 4c8a9927ea
15 changed files with 874 additions and 94 deletions

View file

@ -24,7 +24,7 @@ function _icon(icon){
// Ensures potentially user-provided content won't escape pill components
function _escapeCodeblock(content){
return content.toString().replace(/\`/g, 'ˋ');
return content.toString().replace(/`/g, 'ˋ');
}
module.exports.icon = _icon;
@ -33,11 +33,10 @@ module.exports.iconAsEmojiObject = function(icon){
let i = _icon(icon);
return {
id: i.replace(/<:[a-z0-9_]*:([0-9]*)>/g,"$1"),
name: i,
animated: false, // TODO: fix this for animated emoji if we ever need them
id: i.replace(/<a?:[a-z0-9_]*:([0-9]*)>/g,"$1"),
name: "i",
animated: i.startsWith("<a:")
}
}
/**
@ -56,7 +55,7 @@ module.exports.weatherIcon = function(icon){
}
module.exports.highlight = function(content = ""){
return "`" + content.toString().replace(/\`/g, 'ˋ') + "`"
return "`" + content.toString().replace(/`/g, 'ˋ') + "`"
}
/**
@ -77,6 +76,16 @@ module.exports.link = function(url, masked, tooltip = "", embed = false){
return url
}
module.exports.TIMESTAMP_FLAGS = Object.freeze({
SHORT_TIME: "t",
LONG_TIME: "T",
SHORT_DATE: "d",
LONG_DATE: "D",
SHORT_DATE_TIME: "f",
LONG_DATE_TIME: "F",
RELATIVE_TIME: "R"
})
module.exports.timestamp = function(time, flag = "t"){
return `<t:${Math.floor(time/1000)}:${flag}>`
}