mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-07 21:53:07 -04:00
several small adjustments smiley
This commit is contained in:
parent
f280311212
commit
cd624c9066
4 changed files with 47 additions and 37 deletions
|
@ -4,7 +4,7 @@ const { paginator } = require('#client');
|
|||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed')
|
||||
const { link, pill } = require('#utils/markdown')
|
||||
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
|
||||
const { Permissions, InteractionCallbackTypes } = require("detritus-client/lib/constants");
|
||||
|
@ -64,7 +64,13 @@ async function quoraPaginator(context, pages, refMappings, currentRef) {
|
|||
}
|
||||
await sctx.editOrRespond({
|
||||
embeds: [
|
||||
createEmbed("loading", context, "Loading quora result...")
|
||||
createEmbed("image", context, {
|
||||
url: STATIC_ASSETS.chat_loading,
|
||||
provider: {
|
||||
icon: STATICS.quora,
|
||||
text: `Quora • ${context.application.name}`
|
||||
}
|
||||
})
|
||||
],
|
||||
components: []
|
||||
})
|
||||
|
@ -110,7 +116,7 @@ async function quoraPaginator(context, pages, refMappings, currentRef) {
|
|||
options: selectOptions
|
||||
})
|
||||
|
||||
await ctx.editOrRespond({ content: `<@${context.userId}> Select a question.`, components })
|
||||
await ctx.editOrRespond({ embeds: context.response.embeds, components })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -61,7 +61,9 @@ module.exports.ICONS = Object.freeze({
|
|||
"flask_mini": "<:ico_subt_flask:1263593669215256597>",
|
||||
"subtext_lightbulb": "<:ico_subt_lightbulb:1263593690358616084>",
|
||||
|
||||
"button_mag": "<:ico_button_mag:1271212564122173552>",
|
||||
"button_thermometer": "<:ico_button_thermometer:1263593823016062987>",
|
||||
"button_trash": "<:ico_button_trash:1271212355883372716>",
|
||||
"button_user_profile_swap": "<:ico_button_user_profile_swap:1263594003442700368>",
|
||||
|
||||
"button_chevron_left": "<:button_chevron_left:1263594121256374413>",
|
||||
|
@ -227,6 +229,14 @@ module.exports.MUSIC_PLATFORM_ICONS = Object.freeze({
|
|||
"youtubeMusic": "1271169027124760736"
|
||||
})
|
||||
|
||||
module.exports.COMPONENT_BUTTON_ICONS = Object.freeze({
|
||||
NEXT: this.ICONS.button_chevron_right,
|
||||
PREVIOUS: this.ICONS.button_chevron_left,
|
||||
STOP: this.ICONS.button_trash,
|
||||
SEARCH: this.ICONS.button_mag,
|
||||
UNKNOWN: this.ICONS.question_large
|
||||
})
|
||||
|
||||
module.exports.GUILD_FEATURE_ICONS_REDESIGN = Object.freeze({
|
||||
"ActivitiesIcon": "<:ico_d_activities:1263595238929334272>",
|
||||
"AnnouncementsIcon": "<:ico_d_announcements:1263595270684545205>",
|
||||
|
@ -276,6 +286,7 @@ module.exports.GUILD_FEATURE_ICONS_REDESIGN = Object.freeze({
|
|||
"VoiceIcon": "<:ico_d_voicenormal:1263596678087446548>",
|
||||
})
|
||||
|
||||
// This list should be synced with https://docs.discord.sex/resources/guild#guild-features
|
||||
module.exports.GUILD_FEATURES = Object.freeze({
|
||||
"ACTIVITIES_ALPHA": { icon: this.GUILD_FEATURE_ICONS_REDESIGN.ActivitiesIcon },
|
||||
"ACTIVITIES_EMPLOYEE": { icon: this.GUILD_FEATURE_ICONS_REDESIGN.ActivitiesIcon },
|
||||
|
@ -1111,3 +1122,21 @@ module.exports.YOUTUBE_CATEGORIES = {
|
|||
|
||||
// Special character that allows for fully hidden masked links on all (supported) platforms.
|
||||
module.exports.HIDDEN_MASKED_LINK_CHARACTER = "󠄴";
|
||||
/**
|
||||
* These will force the command to become "incognito".
|
||||
*/
|
||||
module.exports.MESSAGE_BLOCK_REASONS = Object.freeze({
|
||||
20016: {
|
||||
message: "the channel's slowmode settings",
|
||||
support_article: 360016150952
|
||||
},
|
||||
200000: {
|
||||
message: "the server's AutoMod setup",
|
||||
support_article: 4421269296535
|
||||
},
|
||||
// TODO: Handle permissions properly, this works as a "hack" for now.
|
||||
50013: {
|
||||
message: "the channel's permission setup",
|
||||
support_article: 10543994968087
|
||||
}
|
||||
});
|
|
@ -1,3 +1,4 @@
|
|||
const { COMPONENT_BUTTON_ICONS } = require("#constants");
|
||||
const { icon } = require("#utils/markdown");
|
||||
const InteractionPaginator = require("./InteractionPaginator");
|
||||
const assert = require("assert");
|
||||
|
@ -10,14 +11,6 @@ const allowedEvents = new Set([
|
|||
"MESSAGE_CREATE"
|
||||
]);
|
||||
|
||||
const ButtonEmoji = Object.freeze({
|
||||
NEXT: icon("button_chevron_right"),
|
||||
PREVIOUS: icon("button_chevron_left"),
|
||||
STOP: '<:ico_trash:929498022386221096>',
|
||||
SEARCH: '<:search:1063080546365866056>',
|
||||
UNKNOWN: '<:ico_question:949420315677691934>'
|
||||
})
|
||||
|
||||
const { hasOwnProperty } = Object.prototype;
|
||||
|
||||
const instances = new WeakSet();
|
||||
|
@ -126,14 +119,14 @@ module.exports = class Paginator {
|
|||
customId: "custom",
|
||||
disabled: 0,
|
||||
style: 2,
|
||||
emoji: ButtonEmoji.UNKNOWN
|
||||
emoji: COMPONENT_BUTTON_ICONS.UNKNOWN
|
||||
}, b));
|
||||
} else {
|
||||
components.createButton({
|
||||
customId: b,
|
||||
disabled: 0,
|
||||
style: 2,
|
||||
emoji: ButtonEmoji[b.toUpperCase()]
|
||||
emoji: COMPONENT_BUTTON_ICONS[b.toUpperCase()]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +1,9 @@
|
|||
const { Permissions, MessageFlags } = require("detritus-client/lib/constants")
|
||||
const { basecamp } = require("../logging")
|
||||
const { createEmbed } = require("./embed")
|
||||
const { COLORS } = require("#constants")
|
||||
const { COLORS, MESSAGE_BLOCK_REASONS } = require("#constants")
|
||||
const { icon, link } = require("./markdown")
|
||||
|
||||
/**
|
||||
* These will force the command to become "incognito".
|
||||
*/
|
||||
const BLOCK_REASONS = {
|
||||
20016: {
|
||||
message: "the channel's slowmode settings",
|
||||
support_article: 360016150952
|
||||
},
|
||||
200000: {
|
||||
message: "the server's AutoMod setup",
|
||||
support_article: 4421269296535
|
||||
},
|
||||
// TODO: Handle permissions properly, this works as a "hack" for now.
|
||||
50013: {
|
||||
message: "the channel's permission setup",
|
||||
support_article: 10543994968087
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports.editOrReply = function(context, message, disableReference = false){
|
||||
// Apply message_reference
|
||||
|
@ -52,7 +34,7 @@ module.exports.editOrReply = function(context, message, disableReference = false
|
|||
|
||||
return context.editOrRespond(message).catch(async (e)=>{
|
||||
const errorData = await e.response.json();
|
||||
if(BLOCK_REASONS[errorData.code]){
|
||||
if(MESSAGE_BLOCK_REASONS[errorData.code]){
|
||||
// Delete the public response
|
||||
await context.deleteResponse();
|
||||
|
||||
|
@ -62,13 +44,13 @@ module.exports.editOrReply = function(context, message, disableReference = false
|
|||
if(message.content){
|
||||
if(message.embeds && message.embeds.length <= 4){
|
||||
message.embeds.unshift({
|
||||
description: `${icon("flask_incognito")} This response has been made incognito due to ${BLOCK_REASONS[errorData.code].message}.`,
|
||||
description: `${icon("flask_incognito")} This response has been made incognito due to ${MESSAGE_BLOCK_REASONS[errorData.code].message}.`,
|
||||
color: COLORS.incognito
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// Uses new subtext formatting to look more "native"
|
||||
message.content = `-# ${icon("flask_mini")} This response has been made incognito due to ${BLOCK_REASONS[errorData.code].message}. ${link("https://support.discord.com/hc/en-us/articles/" + BLOCK_REASONS[errorData.code].support_article, "Learn More", "Support Article")}`
|
||||
message.content = `-# ${icon("flask_mini")} This response has been made incognito due to ${MESSAGE_BLOCK_REASONS[errorData.code].message} • ${link("https://support.discord.com/hc/en-us/articles/" + MESSAGE_BLOCK_REASONS[errorData.code].support_article, "Learn More", "Support Article")}`
|
||||
}
|
||||
|
||||
let replacementMessage = await context.createMessage(message);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue