diff --git a/commands/message/info/invite.js b/commands/message/info/invite.js index 4302f0b..3c8a04d 100644 --- a/commands/message/info/invite.js +++ b/commands/message/info/invite.js @@ -1,7 +1,7 @@ const { DISCORD_INVITES, OPEN_SOURCE_REPOSITORY_URL } = require("../../../labscore/constants"); const { createEmbed, formatPaginationEmbeds, page } = require("../../../labscore/utils/embed"); const { guildFeaturesField } = require("../../../labscore/utils/fields"); -const { icon, highlight, timestamp, iconPill, iconLinkPill } = require("../../../labscore/utils/markdown"); +const { icon, highlight, timestamp, iconPill, iconLinkPill, link } = require("../../../labscore/utils/markdown"); const { editOrReply } = require("../../../labscore/utils/message"); const { STATIC_ASSETS } = require("../../../labscore/utils/statics"); @@ -23,19 +23,22 @@ module.exports = { permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY], run: async (context, args) => { context.triggerTyping(); - if(!args.invite) return editOrReply(context, createEmbed("default", context, { - description: [ - '​', - icon('brand') + ` You can invite ${context.client.user.username} with this ${iconLinkPill("link", context.application.oauth2UrlFormat({ scope: 'bot applications.commands', permissions: 412317248576 }).replace("ptb.discordapp.com","discord.com"), 'Invite Link', 'Discord Application Invite URL')}.`, - '', - icon('robot') + ` Need help? Join our ${iconLinkPill("discord", DISCORD_INVITES.support, 'Support Server', "Click to join")}.`, - '', - iconLinkPill('gitlab', OPEN_SOURCE_REPOSITORY_URL, 'Source Code'), - ].join('\n'), - image: { - url: STATIC_ASSETS.embed_invite_spacer - } - })) + if(!args.invite) return editOrReply(context, { + content: link("https://canary.discord.com/application-directory/" + context.client.user.id + " ", "⠀", "App Directory Invite", true) + " " + link(DISCORD_INVITES.invite + " ", "⠀", "Support Server Invite", true), + embeds: [createEmbed("default", context, { + description: [ + '​', + icon('brand') + ` You can invite ${context.client.user.username} with this ${iconLinkPill("link", context.application.oauth2UrlFormat({ scope: 'bot applications.commands', permissions: 412317248576 }).replace("ptb.discordapp.com","discord.com"), 'Invite Link', 'Discord Application Invite URL')}.`, + '', + icon('robot') + ` Need help? Join our ${iconLinkPill("discord", DISCORD_INVITES.support, 'Support Server', "Click to join")}.`, + '', + iconLinkPill('gitlab', OPEN_SOURCE_REPOSITORY_URL, 'Source Code'), + ].join('\n'), + image: { + url: STATIC_ASSETS.embed_invite_spacer + } + }) + ]}) try{ const inviteCode = args.invite.match(/(?:(?:https|http):\/\/)?(?:(?:discord.gg|(?:discord|discordapp)\.com\/invite)\/)?([A-z0-z-]{2,32})/) const invite = await context.client.rest.fetchInvite(inviteCode[1], {withCounts: true}) diff --git a/labscore/constants.js b/labscore/constants.js index 787a67f..d22ce23 100644 --- a/labscore/constants.js +++ b/labscore/constants.js @@ -1,6 +1,7 @@ module.exports.DISCORD_INVITES = Object.freeze({ support: "https://discord.gg/8c4p6xcjru", - privacy: "https://discord.gg/sQs8FhcTGh" + privacy: "https://discord.gg/sQs8FhcTGh", + invite: "https://discord.gg/cHd28DrM7f" }) module.exports.DEFAULT_BOT_NAME = 'labsCore' diff --git a/labscore/utils/markdown.js b/labscore/utils/markdown.js index 4f878c9..6d28dcd 100644 --- a/labscore/utils/markdown.js +++ b/labscore/utils/markdown.js @@ -19,9 +19,10 @@ module.exports.codeblock = function(type, content = ""){ return "```" + type + "\n" + content.join('\n').replace(/\`/g, '`​') + "\n```" } -module.exports.link = function(url, masked, tooltip = ""){ +module.exports.link = function(url, masked, tooltip = "", embed = false){ if(tooltip.length) tooltip = ` '${tooltip}'` - if(masked) return `[${masked}](<${url}>${tooltip})` + if(masked && !embed) return `[${masked}](<${url}>${tooltip})` + if(masked && embed) return `[${masked}](${url}${tooltip})` return url }