mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 14:13:02 -04:00
surface app directory and support in invite
This commit is contained in:
parent
602b68ad91
commit
2198b020f1
3 changed files with 22 additions and 17 deletions
|
@ -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,7 +23,9 @@ 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, {
|
||||
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')}.`,
|
||||
|
@ -35,7 +37,8 @@ module.exports = {
|
|||
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})
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue