mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 06:33:05 -04:00
icon redesign
This commit is contained in:
parent
a4df6550cd
commit
6b4e0f3347
19 changed files with 162 additions and 76 deletions
|
@ -1,4 +1,4 @@
|
|||
const { codeblock, highlight, icon, link, pill, smallPill } = require('../../../labscore/utils/markdown')
|
||||
const { codeblock, highlight, icon, link, pill, smallPill, iconPill } = require('../../../labscore/utils/markdown')
|
||||
const { createEmbed, formatPaginationEmbeds } = require('../../../labscore/utils/embed')
|
||||
|
||||
const { DISCORD_INVITES, DEFAULT_BOT_PREFIX } = require('../../../labscore/constants')
|
||||
|
@ -7,7 +7,7 @@ const { paginator } = require('../../../labscore/client');
|
|||
const { editOrReply } = require('../../../labscore/utils/message');
|
||||
|
||||
const { Permissions } = require("detritus-client/lib/constants");
|
||||
const { canUseLimitedTestCommands } = require('../utils/testing');
|
||||
const { canUseLimitedTestCommands } = require('../../../labscore/utils/testing');
|
||||
|
||||
function createHelpPage(context, title, contents, descriptions){
|
||||
return {
|
||||
|
@ -15,7 +15,7 @@ function createHelpPage(context, title, contents, descriptions){
|
|||
createEmbed("default", context, {
|
||||
description: `${title}\n\n` +
|
||||
renderCommandList(contents, descriptions) +
|
||||
`\n\n${icon("question")} Use ${pill(`${DEFAULT_BOT_PREFIX}help <command>`)} to view more information about a command.`
|
||||
`\n\n${icon("question")} Use ${smallPill(`${DEFAULT_BOT_PREFIX}help <command>`)} to view more information about a command.`
|
||||
})
|
||||
]
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ function renderCommandList(commands, descriptions, limit){
|
|||
if(desc.includes('\n')) desc = desc.split('\n')[0]
|
||||
if(desc.length >= 41) desc = desc.substr(0, 40) + '...'
|
||||
|
||||
render.push(` **\` ${c}${' '.repeat(pad)}\`** ${desc}`)
|
||||
render.push(` \` ${c}${' '.repeat(pad)}\` ${desc}`)
|
||||
i++
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ function createCommandPage(context, prefix, command){
|
|||
}
|
||||
|
||||
let explicit = '';
|
||||
if(command.metadata.explicit) explicit = `\n${icon('nsfw')} This command contains explicit content and can only be used in Age-Restricted channels. ${link("https://support.discord.com/hc/en-us/articles/115000084051-Age-Restricted-Channels-and-Content", "Learn More")}\n`
|
||||
if(command.metadata.explicit) explicit = `\n${icon('channel_nsfw')} This command contains explicit content and can only be used in Age-Restricted channels. ${link("https://support.discord.com/hc/en-us/articles/115000084051-Age-Restricted-Channels-and-Content", "Learn More")}\n`
|
||||
|
||||
// Render argument pills if present
|
||||
let args = [];
|
||||
|
@ -66,13 +66,13 @@ function createCommandPage(context, prefix, command){
|
|||
}
|
||||
|
||||
let page = createEmbed("default", context, {
|
||||
description: `${icon("command")} ${pill(command.name)}\n${alias}${explicit}\n${command.metadata.description}\n\n${args.join('\n\n')}`,
|
||||
description: `${icon("slash")} ${smallPill(command.name)}\n${alias}${explicit}\n${command.metadata.description}\n\n${args.join('\n\n')}`,
|
||||
fields: []
|
||||
})
|
||||
|
||||
// TODO: maybe try building a little parser that highlights things via ansi
|
||||
if(command.metadata.usage) page.fields.push({
|
||||
name: `${icon("util")} Usage`,
|
||||
name: `${icon("settings")} Usage`,
|
||||
value: codeblock("py", [prefix + command.metadata.usage]),
|
||||
inline: true
|
||||
})
|
||||
|
@ -81,7 +81,7 @@ function createCommandPage(context, prefix, command){
|
|||
let ex = []
|
||||
for(const e of command.metadata.examples) ex.push(prefix + e)
|
||||
page.fields.push({
|
||||
name: `${icon("info")} Examples`,
|
||||
name: `${icon("example")} Examples`,
|
||||
value: '```' + ex.join('``````') + '```',
|
||||
inline: false
|
||||
})
|
||||
|
@ -93,13 +93,13 @@ function createCommandPage(context, prefix, command){
|
|||
|
||||
// These categories will be displayed to users, add them in the correct order
|
||||
const categories = {
|
||||
"core": `${icon("house")} Core Commands`,
|
||||
"info": `${icon("info")} Information Commands`,
|
||||
"search": `${icon("search")} Search Commands`,
|
||||
"utils": `${icon("utils")} Utility Commands`,
|
||||
"fun": `${icon("fun")} Fun Commands`,
|
||||
"image": `${icon("image")} Image Commands`,
|
||||
"mod": `${icon("moderation")} Moderation Commands`
|
||||
"core": `${iconPill("home", "Core Commands")}`,
|
||||
"info": `${iconPill("information", "Information Commands")}`,
|
||||
"search": `${iconPill("search", "Search Commands")}`,
|
||||
"utils": `${iconPill("tools", "Utility Commands")}`,
|
||||
"fun": `${iconPill("stars", "Fun Commands")}`,
|
||||
"image": `${iconPill("image", "Image Commands")}`,
|
||||
"mod": `${iconPill("shield", "Moderation Commands")}`
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
@ -115,7 +115,7 @@ module.exports = {
|
|||
},
|
||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
if(canUseLimitedTestCommands(context)) categories["limited"] = `${icon("fun")} Limited Test Commands`;
|
||||
if(canUseLimitedTestCommands(context)) categories["limited"] = `${icon("stars")} Limited Test Commands`;
|
||||
if(args.command){
|
||||
await context.triggerTyping()
|
||||
// Detailed command view
|
||||
|
|
|
@ -20,7 +20,7 @@ module.exports = {
|
|||
ping = await context.client.ping()
|
||||
editOrReply(context, {
|
||||
embeds: [createEmbed("default", context, {
|
||||
description: `${icon("connection")} **Pong!**\n` + codeblock("ansi", [`rest ${format(`${ping.rest}ms`, "m")}`, `gateway ${format(`${ping.gateway}ms`, "m")}`])
|
||||
description: `${icon("latency")} **Pong!**\n` + codeblock("ansi", [`rest ${format(`${ping.rest}ms`, "m")}`, `gateway ${format(`${ping.gateway}ms`, "m")}`])
|
||||
})]
|
||||
})
|
||||
},
|
||||
|
|
|
@ -17,7 +17,7 @@ module.exports = {
|
|||
run: async (context) => {
|
||||
return await editOrReply(context,
|
||||
createEmbed("default", context, {
|
||||
description: `${icon("rules")} **labsCore Privacy Policy**\n*Last Updated: ${timestamp(PRIVACY_POLICY_LAST_UPDATE, "f")}*\n\n${PRIVACY_POLICY_SECTIONS.join('\n\n')}\n\nIf you have any further questions, please contact us via our ${link(DISCORD_INVITES.privacy, "Support Server")}`,
|
||||
description: `${icon("agreements")} **labsCore Privacy Policy**\n*Last Updated: ${timestamp(PRIVACY_POLICY_LAST_UPDATE, "f")}*\n\n${PRIVACY_POLICY_SECTIONS.join('\n\n')}\n\nIf you have any further questions, please contact us via our ${link(DISCORD_INVITES.privacy, "Support Server")}`,
|
||||
color: COLORS.brand
|
||||
})
|
||||
)
|
||||
|
|
|
@ -57,10 +57,10 @@ module.exports = {
|
|||
}
|
||||
|
||||
const display = [
|
||||
`${iconPill("house", "Servers ")} ${highlight(` ${formatted.guilds} `)}`,
|
||||
`${iconPill("robot", "Shard ")} ${highlight(` ${context.shardId + 1}/${context.manager.cluster.shardCount} `)}`,
|
||||
`${iconPill("connection", "Memory Usage")} ${highlight(` ${Math.round(formatted.usage / 1024 / 1024)}MB `)}`,
|
||||
`${iconPill("timer", "Uptime ")} ${highlight(` ${format(process.uptime())} `)}`,
|
||||
`${iconPill("home", "Servers ")} ${highlight(` ${formatted.guilds} `)}`,
|
||||
`${iconPill("robot", "Shard ")} ${highlight(` ${context.shardId + 1}/${context.manager.cluster.shardCount} `)}`,
|
||||
`${iconPill("latency", "Memory Usage")} ${highlight(` ${Math.round(formatted.usage / 1024 / 1024)}MB `)}`,
|
||||
`${iconPill("clock", "Uptime ")} ${highlight(` ${format(process.uptime())} `)}`,
|
||||
``,
|
||||
`${iconLinkPill('gitlab', OPEN_SOURCE_REPOSITORY_URL, 'Source Code')} ${iconLinkPill('link', context.application.oauth2UrlFormat({ scope: 'bot applications.commands', permissions: 412317248576 }), `Invite ${context.client.user.username}`)}`
|
||||
]
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
const { createEmbed } = require('../../../labscore/utils/embed')
|
||||
const { format } = require('../../../labscore/utils/ansi')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
|
||||
const superagent = require('superagent')
|
||||
const { codeblock, iconPill } = require('../../../labscore/utils/markdown')
|
||||
const { iconPill, smallIconPill } = require('../../../labscore/utils/markdown')
|
||||
|
||||
const { Permissions } = require("detritus-client/lib/constants");
|
||||
const { canUseLimitedTestCommands } = require('../utils/testing')
|
||||
const { Regexes } = require('detritus-client/lib/utils/markup')
|
||||
const { DiscordRegexNames } = require('detritus-client/lib/constants')
|
||||
const { canUseLimitedTestCommands } = require('../../../labscore/utils/testing')
|
||||
const { STATICS } = require('../../../labscore/utils/statics')
|
||||
|
||||
module.exports = {
|
||||
name: 'chat',
|
||||
label: 'text',
|
||||
metadata: {
|
||||
description: `${iconPill("fun", "LIMITED TESTING")}\n\nTalk to ChatGPT.\n\n<:bonzi:1138585089891106836> He will explore the Internet with you as your very own friend and sidekick! He can talk, walk, and joke like no other friend you've ever had!`,
|
||||
description: `${iconPill("generative_ai", "LIMITED TESTING")}\n\nTalk to ChatGPT.\n\n<:bonzi:1138585089891106836> He will explore the Internet with you as your very own friend and sidekick! He can talk, walk, and joke like no other friend you've ever had!`,
|
||||
description_short: 'Talk to ChatGPT.',
|
||||
examples: ['chat How many otter species are there?'],
|
||||
category: 'limited',
|
||||
|
@ -47,7 +44,7 @@ module.exports = {
|
|||
model: "CHATGPT"
|
||||
})
|
||||
|
||||
let description = [codeblock("ansi", ["👤 " + format(args.text, "cyan")])]
|
||||
let description = [smallIconPill("generative_ai", args.text), '']
|
||||
description.push(res.body.output.substr(0, 2000 - args.text.length))
|
||||
|
||||
return editOrReply(context, {embeds:[createEmbed("default", context, {
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
const { createEmbed } = require('../../../labscore/utils/embed')
|
||||
const { format } = require('../../../labscore/utils/ansi')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
|
||||
const superagent = require('superagent')
|
||||
const { codeblock, iconPill } = require('../../../labscore/utils/markdown')
|
||||
const { codeblock, iconPill, smallIconPill } = require('../../../labscore/utils/markdown')
|
||||
|
||||
const { Permissions } = require("detritus-client/lib/constants");
|
||||
const { canUseLimitedTestCommands } = require('../utils/testing')
|
||||
const { canUseLimitedTestCommands } = require('../../../labscore/utils/testing')
|
||||
const { STATICS } = require('../../../labscore/utils/statics')
|
||||
|
||||
module.exports = {
|
||||
name: 'disstrack',
|
||||
label: 'text',
|
||||
metadata: {
|
||||
description: `${iconPill("fun", "LIMITED TESTING")}\n\nAI Generated Disstracks, powered by ChatGPT`,
|
||||
description: `${iconPill("generative_ai", "LIMITED TESTING")}\n\nAI Generated Disstracks, powered by ChatGPT`,
|
||||
description_short: 'AI generated disstracks.',
|
||||
examples: ['disstrack'],
|
||||
category: 'limited',
|
||||
|
@ -38,7 +37,7 @@ module.exports = {
|
|||
model: "CHATGPT"
|
||||
})
|
||||
return editOrReply(context, {embeds:[createEmbed("default", context, {
|
||||
description: codeblock("ansi", [res.body.output.substr(0, 2020)]),
|
||||
description: smallIconPill("generative_ai", args.text) + '\n' + codeblock("ansi", [res.body.output.substr(0, 2020 - args.text.length)]),
|
||||
footer: {
|
||||
text: `🗣🗣📢🔥🔥🔥🔥💯 • ${context.application.name}`,
|
||||
iconUrl: STATICS.openai
|
||||
|
|
|
@ -46,7 +46,7 @@ module.exports = {
|
|||
clearTimeout(noticeTimer)
|
||||
|
||||
await response.edit({
|
||||
embeds: [createEmbed("defaultNoFooter", context, { description: `${icon("audio")} Audio Generated in ${highlight(((Date.now() - t) / 1000).toFixed(2) + "s")}.` })],
|
||||
embeds: [createEmbed("defaultNoFooter", context, { description: `${icon("note")} Audio Generated in ${highlight(((Date.now() - t) / 1000).toFixed(2) + "s")}.` })],
|
||||
file: { value: img.body, filename: "music.mp3" }
|
||||
})
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ const applicationFlagNames = {
|
|||
GATEWAY_MESSAGE_CONTENT: "Message Content Intent",
|
||||
GATEWAY_MESSAGE_CONTENT_LIMITED: "Message Content Intent (Not approved)",
|
||||
EMBEDDED_FIRST_PARTY: "Embedded First Party",
|
||||
APPLICATION_COMMAND_BADGE: `Has Slash Commands ${icon("badge_slash")}`
|
||||
APPLICATION_COMMAND_BADGE: `Has Slash Commands ${icon("slash")}`
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
@ -76,8 +76,8 @@ module.exports = {
|
|||
|
||||
if(application.terms_of_service_url || application.privacy_policy_url){
|
||||
let content = []
|
||||
if(application.terms_of_service_url) content.push(`${icon("rules")} ${link(application.terms_of_service_url, "Terms of Service")}`)
|
||||
if(application.privacy_policy_url) content.push(`${icon("lock")} ${link(application.privacy_policy_url, "Privacy Policy")}`)
|
||||
if(application.terms_of_service_url) content.push(`${icon("agreements")} ${link(application.terms_of_service_url, "Terms of Service")}`)
|
||||
if(application.privacy_policy_url) content.push(`${icon("padlock")} ${link(application.privacy_policy_url, "Privacy Policy")}`)
|
||||
|
||||
embed.fields.push({
|
||||
name: `${icon("link")} Links`,
|
||||
|
@ -88,13 +88,13 @@ module.exports = {
|
|||
|
||||
if("bot_public" in application){
|
||||
let content = []
|
||||
if(application.bot_public) content.push(`• Bot is public`)
|
||||
if(application.custom_install_url) content.push(`${icon("link")} ${link(application.custom_install_url, "Invite Bot")}`)
|
||||
if(application.install_params) content.push(`${icon("downloading")} ${link(`https://discord.com/api/oauth2/authorize?client_id=${application.id}&permissions=${application.install_params.permissions}&scope=${application.install_params.scopes.join('+')}`, "Invite Bot")}`)
|
||||
if(application.bot_require_code_grant) content.push(`\n• Bot requires code grant`)
|
||||
if(application.bot_public) content.push(`• App is public`)
|
||||
if(application.custom_install_url) content.push(`${icon("link")} ${link(application.custom_install_url, "Invite App")}`)
|
||||
if(application.install_params) content.push(`${icon("link")} ${link(`https://discord.com/api/oauth2/authorize?client_id=${application.id}&permissions=${application.install_params.permissions}&scope=${application.install_params.scopes.join('+')}`, "OAuth2 Invite URL")}`)
|
||||
if(application.bot_require_code_grant) content.push(`\n• App requires code grant`)
|
||||
|
||||
if(content.length) embed.fields.push({
|
||||
name: `${icon("robouser")} Bot`,
|
||||
name: `${icon("user")} Bot`,
|
||||
value: content.join('\n'),
|
||||
inline: true
|
||||
})
|
||||
|
@ -102,7 +102,7 @@ module.exports = {
|
|||
|
||||
if(application.tags){
|
||||
embed.fields.push({
|
||||
name: `${icon("activity")} Tags`,
|
||||
name: `${icon("list")} Tags`,
|
||||
value: application.tags.map(t => highlight(t)).join(', '),
|
||||
inline: true
|
||||
})
|
||||
|
|
|
@ -34,7 +34,7 @@ module.exports = {
|
|||
const g = context.guild
|
||||
// Guild Card
|
||||
let guildCard = createEmbed("default", context, {
|
||||
description: `${icon("house")} **${g.name}** ${highlight(`(${g.id})`)}\n\n${icon("calendar")} **Created at: **${timestamp(g.createdAt, "f")}`,
|
||||
description: `${icon("home")} **${g.name}** ${highlight(`(${g.id})`)}\n\n${icon("calendar")} **Created at: **${timestamp(g.createdAt, "f")}`,
|
||||
fields: []
|
||||
})
|
||||
|
||||
|
@ -91,11 +91,11 @@ module.exports = {
|
|||
let i = 0;
|
||||
let ic = Math.ceil(featureCards.length / 2);
|
||||
|
||||
if(ic == 1) featureCards[0].name = `${icon("activity")} Guild Features`
|
||||
if(ic == 1) featureCards[0].name = `${icon("list")} Guild Features`
|
||||
while(featureCards.length >= 1){
|
||||
i++;
|
||||
const sub = featureCards.splice(0, 2)
|
||||
sub[0].name = `${icon("activity")} Guild Features (${i}/${ic})`
|
||||
sub[0].name = `${icon("list")} Guild Features (${i}/${ic})`
|
||||
|
||||
pages.push(page(JSON.parse(JSON.stringify(Object.assign({ ...guildCard }, { fields: sub })))))
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ module.exports = {
|
|||
'',
|
||||
icon('link') + ` You can invite ${context.client.user.username} with ${link(context.application.oauth2UrlFormat({ scope: 'bot applications.commands', permissions: 412317248576 }), 'this link')}.`,
|
||||
'',
|
||||
icon('robouser') + ` Need help? Join our ${link(DISCORD_INVITES.support, 'Support Server')}.`,
|
||||
icon('robot') + ` Need help? Join our ${link(DISCORD_INVITES.support, 'Support Server')}.`,
|
||||
'',
|
||||
iconLinkPill('gitlab', OPEN_SOURCE_REPOSITORY_URL, 'Source Code'),
|
||||
].join('\n'),
|
||||
|
@ -43,7 +43,7 @@ module.exports = {
|
|||
const g = invite.guild
|
||||
// Guild Card
|
||||
let inviteCard = createEmbed("default", context, {
|
||||
description: `${icon("link")} **https://discord.gg/${inviteCode[1]}**\n\n${icon("house")} **${g.name}** ${highlight(`(${g.id})`)}\n${icon("calendar")} **Created at: **${timestamp(g.createdAt, "f")}\n\n${iconPill("people", invite.approximateMemberCount.toLocaleString())} ${iconPill("online", invite.approximatePresenceCount.toLocaleString())} ${iconPill("offline", invite.approximateMemberCount - invite.approximatePresenceCount).toLocaleString()}`,
|
||||
description: `${icon("link")} **https://discord.gg/${inviteCode[1]}**\n\n${icon("home")} **${g.name}** ${highlight(`(${g.id})`)}\n${icon("calendar")} **Created at: **${timestamp(g.createdAt, "f")}\n\n${iconPill("user_multiple", invite.approximateMemberCount.toLocaleString())} ${iconPill("online", invite.approximatePresenceCount.toLocaleString())} ${iconPill("offline", invite.approximateMemberCount - invite.approximatePresenceCount).toLocaleString()}`,
|
||||
fields: []
|
||||
})
|
||||
|
||||
|
@ -67,11 +67,11 @@ module.exports = {
|
|||
let i = 0;
|
||||
let ic = Math.ceil(featureCards.length / 2);
|
||||
|
||||
if(ic == 1) featureCards[0].name = `${icon("activity")} Guild Features`
|
||||
if(ic == 1) featureCards[0].name = `${icon("list")} Guild Features`
|
||||
while(featureCards.length >= 1){
|
||||
i++;
|
||||
const sub = featureCards.splice(0, 2)
|
||||
sub[0].name = `${icon("activity")} Guild Features (${i}/${ic})`
|
||||
sub[0].name = `${icon("list")} Guild Features (${i}/${ic})`
|
||||
|
||||
pages.push(page(JSON.parse(JSON.stringify(Object.assign({ ...inviteCard }, { fields: sub })))))
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ module.exports = {
|
|||
if(u.discriminator && u.discriminator !== "0") usernameDisplay += `#${u.discriminator}`
|
||||
|
||||
let userCard = createEmbed("default", context, {
|
||||
description: `${icon("person")} **${usernameDisplay}**${botTag} ${highlight(`(${u.id})`)}`,
|
||||
description: `${icon("user")} **${usernameDisplay}**${botTag} ${highlight(`(${u.id})`)}`,
|
||||
thumbnail: {
|
||||
url: u.avatarUrl + `?size=4096`
|
||||
},
|
||||
|
@ -62,7 +62,7 @@ module.exports = {
|
|||
if(m.roles.length >= 1) guildFields.push(`**Roles: ** ${m.roles.length}/${context.guild.roles.length}`)
|
||||
if(m.premiumSince) guildFields.push(`**Boosting since: ** ${timestamp(m.premiumSince, 'f')}`)
|
||||
userCard.fields.push({
|
||||
name: `${icon("house")} Server`,
|
||||
name: `${icon("home")} Server`,
|
||||
value: guildFields.join('\n'),
|
||||
inline: true
|
||||
})
|
||||
|
|
|
@ -54,14 +54,14 @@ module.exports = {
|
|||
if (context.message.messageReference) {
|
||||
msg = await context.message.channel.fetchMessage(context.message.messageReference.messageId)
|
||||
args.input = msg.content
|
||||
msg = `${icon("robouser")} <@${msg.author.id}> (${msg.author.id})\n${codeblock("ansi", [msg.content])}\n`
|
||||
msg = `${icon("robot")} <@${msg.author.id}> (${msg.author.id})\n${codeblock("ansi", [msg.content])}\n`
|
||||
}
|
||||
|
||||
let perspectiveApi = await perspective(context, [args.input])
|
||||
|
||||
return await editOrReply(context, {
|
||||
embeds: [createEmbed("default", context, {
|
||||
description: `${msg}${iconPill("rules", "Scores")} ${codeblock("ansi", formatPerspectiveScores(perspectiveApi.response.body))}`,
|
||||
description: `${msg}${iconPill("agreements", "Scores")} ${codeblock("ansi", formatPerspectiveScores(perspectiveApi.response.body))}`,
|
||||
footer: {
|
||||
iconUrl: STATICS.perspectiveapi,
|
||||
text: `Perspective • ${context.application.name}`
|
||||
|
|
|
@ -31,14 +31,14 @@ function createRedditPage(context, result){
|
|||
|
||||
let awardData = []
|
||||
// Awards
|
||||
for(const a of Object.keys(result.awards)){
|
||||
awardData.push(`${icon(`reddit_${a}`)}${highlight(result.awards[a])}`)
|
||||
}
|
||||
//for(const a of Object.keys(result.awards)){
|
||||
// awardData.push(`${icon(`reddit_${a}`)}${highlight(result.awards[a])}`)
|
||||
//}
|
||||
|
||||
if(awardData.length >= 1) description.push(`${awardData.join(' ')}`)
|
||||
|
||||
description.push(``)
|
||||
description.push(`${iconPill("upvote", result.post.score)} ${icon("person")} ${link(result.author.link, `u/${result.author.name}`)}`)
|
||||
description.push(`${iconPill("upvote", result.post.score)} ${icon("user")} ${link(result.author.link, `u/${result.author.name}`)}`)
|
||||
|
||||
res.embeds[0].description = description.join('\n')
|
||||
return res;
|
||||
|
|
|
@ -36,9 +36,9 @@ function createYoutubePage(context, result){
|
|||
case 1: //video
|
||||
iconHeader = []
|
||||
|
||||
iconHeader.push(iconPill("eye", intToString(parseInt(result.metadata.views).toLocaleString('en-US')) + ' Views'))
|
||||
if(result.metadata.likes >= 1) iconHeader.push(iconPill("like", intToString(parseInt(result.metadata.likes)) + ' Likes'))
|
||||
if(result.metadata.comments >= 1) iconHeader.push('\n' + iconPill("message", intToString(parseInt(result.metadata.comments)) + ' Comments'))
|
||||
iconHeader.push(iconPill("stat_views", intToString(parseInt(result.metadata.views).toLocaleString('en-US')) + ' Views'))
|
||||
if(result.metadata.likes >= 1) iconHeader.push(iconPill("stat_likes", intToString(parseInt(result.metadata.likes)) + ' Likes'))
|
||||
if(result.metadata.comments >= 1) iconHeader.push('\n' + iconPill("stat_comments", intToString(parseInt(result.metadata.comments)) + ' Comments'))
|
||||
|
||||
res = page(createEmbed("default", context, {
|
||||
author: {
|
||||
|
@ -59,10 +59,10 @@ function createYoutubePage(context, result){
|
|||
case 2: // channel
|
||||
iconHeader = []
|
||||
|
||||
iconHeader.push(iconPill("people", intToString(parseInt(result.metadata.subscribers).toLocaleString('en-US')) + ' Subscribers'))
|
||||
iconHeader.push(iconPill("eye", intToString(parseInt(result.metadata.views).toLocaleString('en-US')) + ' Views'))
|
||||
iconHeader.push(iconPill("stat_people", intToString(parseInt(result.metadata.subscribers).toLocaleString('en-US')) + ' Subscribers'))
|
||||
iconHeader.push(iconPill("stat_views", intToString(parseInt(result.metadata.views).toLocaleString('en-US')) + ' Views'))
|
||||
|
||||
iconHeader.push('\n' + iconPill("videos", intToString(parseInt(result.metadata.videos).toLocaleString('en-US')) + ' Videos'))
|
||||
iconHeader.push('\n' + iconPill("stat_videos", intToString(parseInt(result.metadata.videos).toLocaleString('en-US')) + ' Videos'))
|
||||
|
||||
res = page(createEmbed("default", context, {
|
||||
author: {
|
||||
|
@ -83,7 +83,7 @@ function createYoutubePage(context, result){
|
|||
case 3: // playlist
|
||||
iconHeader = [
|
||||
'',
|
||||
iconPill("videos", intToString(parseInt(result.metadata.videos).toLocaleString('en-US')) + ' Videos')
|
||||
iconPill("stat_videos", intToString(parseInt(result.metadata.videos).toLocaleString('en-US')) + ' Videos')
|
||||
]
|
||||
res = page(createEmbed("default", context, {
|
||||
author: {
|
||||
|
|
|
@ -12,7 +12,7 @@ function createDictionaryPage(context, result, word){
|
|||
if(result.phonetic) phon = `\n*${result.phonetic}*`
|
||||
|
||||
let e = createEmbed("default", context, {
|
||||
description: `${icon("book")} **${link(`https://en.wiktionary.org/wiki/${encodeURIComponent(word.word)}`, word.word, "Definition on Wiktionary")}**`,
|
||||
description: `${icon("definition")} **${link(`https://en.wiktionary.org/wiki/${encodeURIComponent(word.word)}`, word.word, "Definition on Wiktionary")}**`,
|
||||
fields: []
|
||||
})
|
||||
|
||||
|
@ -28,7 +28,7 @@ function createDictionaryPage(context, result, word){
|
|||
defItms.push(d.definition, citation(ref, d.src))
|
||||
if(d.examples) defItms.push(`\n ${icon("message")} *${d.examples.join(`*\n ${icon("message")} *`)}*`)
|
||||
// Synonyms are limited to 5 to prevent overflow
|
||||
if(d.synonyms) defItms.push(`\n ${iconPill("book", "Synonyms")} ${d.synonyms.splice(0, 5).map((s)=>smallPill(s)).join(' ')}`)
|
||||
if(d.synonyms) defItms.push(`\n ${iconPill("definition", "Synonyms")} ${d.synonyms.splice(0, 5).map((s)=>smallPill(s)).join(' ')}`)
|
||||
|
||||
ref++;
|
||||
if([...defDesc, defItms.join(' ')].join('\n\n').length >= 1024) continue;
|
||||
|
|
|
@ -80,7 +80,7 @@ module.exports = {
|
|||
if(matches[0].animated) form = '.gif'
|
||||
|
||||
let tagline = ''
|
||||
if(context.guild.emojis.find((e)=>e.id == matches[0].id)) tagline = `\n${icon("house")} This emoji is from ${bold(context.guild.name)}`
|
||||
if(context.guild.emojis.find((e)=>e.id == matches[0].id)) tagline = `\n${icon("home")} This emoji is from ${bold(context.guild.name)}`
|
||||
|
||||
return editOrReply(context, createEmbed("default", context, {
|
||||
description: `${iconPill("emoji", `:${matches[0].name}:`)} ${highlight(`(${matches[0].id})`)}${tagline}`,
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
|
||||
// Get Test Config
|
||||
let LIMITED_TEST_GUILDS;
|
||||
if(process.env.TESTING_SERVER_IDS) LIMITED_TEST_GUILDS = process.env.TESTING_SERVER_IDS.split(';')
|
||||
let LIMITED_TEST_CHANNELS;
|
||||
if(process.env.TESTING_CHANNEL_IDS) LIMITED_TEST_CHANNELS = process.env.TESTING_CHANNEL_IDS.split(';')
|
||||
let LIMITED_TEST_USERS;
|
||||
if(process.env.TESTING_USER_IDS) LIMITED_TEST_USERS = process.env.TESTING_USER_IDS.split(';')
|
||||
|
||||
function canUseLimitedTestCommands(context){
|
||||
if(LIMITED_TEST_GUILDS && LIMITED_TEST_GUILDS.includes(context.guild.id)) return true;
|
||||
if(LIMITED_TEST_CHANNELS && LIMITED_TEST_CHANNELS.includes(context.channel.id)) return true;
|
||||
if(LIMITED_TEST_USERS && LIMITED_TEST_USERS.includes(context.user.id)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
canUseLimitedTestCommands
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue