more prefix related fixes

This commit is contained in:
derpystuff 2023-06-12 22:30:13 +02:00
parent 236b17255b
commit 6628fc3233
4 changed files with 46 additions and 8 deletions

View file

@ -1,7 +1,7 @@
const { codeblock, highlight, icon, link, pill, smallPill } = require('../../../labscore/utils/markdown') const { codeblock, highlight, icon, link, pill, smallPill } = require('../../../labscore/utils/markdown')
const { createEmbed, formatPaginationEmbeds } = require('../../../labscore/utils/embed') const { createEmbed, formatPaginationEmbeds } = require('../../../labscore/utils/embed')
const { DISCORD_INVITES } = require('../../../labscore/constants') const { DISCORD_INVITES, DEFAULT_BOT_PREFIX } = require('../../../labscore/constants')
const { paginator } = require('../../../labscore/client'); const { paginator } = require('../../../labscore/client');
const { editOrReply } = require('../../../labscore/utils/message'); const { editOrReply } = require('../../../labscore/utils/message');
@ -12,7 +12,7 @@ function createHelpPage(context, title, contents, descriptions){
createEmbed("default", context, { createEmbed("default", context, {
description: `${title}\n\n` + description: `${title}\n\n` +
renderCommandList(contents, descriptions) + renderCommandList(contents, descriptions) +
`\n\n${icon("question")} Use ${pill(`${context.commandClient.prefixes.custom.first()}help <command>`)} to view more information about a command.` `\n\n${icon("question")} Use ${pill(`${DEFAULT_BOT_PREFIX}help <command>`)} to view more information about a command.`
}) })
] ]
} }
@ -120,7 +120,7 @@ module.exports = {
} }
let pages = [] let pages = []
let prefix = context.commandClient.prefixes.custom.first() let prefix = DEFAULT_BOT_PREFIX
try{ try{
if(results.length == 0) return editOrReply(context, {embeds: [createEmbed("warning", context, "No commands found for the provided query.")]}) if(results.length == 0) return editOrReply(context, {embeds: [createEmbed("warning", context, "No commands found for the provided query.")]})
@ -158,7 +158,6 @@ module.exports = {
let commands = {} let commands = {}
let descriptions = {} let descriptions = {}
let prefix = context.commandClient.prefixes.custom.first()
for(const c of context.commandClient.commands){ for(const c of context.commandClient.commands){
if(!categories[c.metadata.category]) continue; if(!categories[c.metadata.category]) continue;
if(c.metadata.explicit && !context.channel.nsfw) continue; if(c.metadata.explicit && !context.channel.nsfw) continue;

View file

@ -3,6 +3,7 @@ const { editOrReply } = require('../../../labscore/utils/message')
const superagent = require('superagent'); const superagent = require('superagent');
const { codeblock } = require('../../../labscore/utils/markdown'); const { codeblock } = require('../../../labscore/utils/markdown');
const { DEFAULT_BOT_PREFIX } = require('../../../labscore/constants');
const SIZES = Object.freeze({ const SIZES = Object.freeze({
"wallpaper": { x: 1120, y: 630}, "wallpaper": { x: 1120, y: 630},
@ -80,11 +81,11 @@ module.exports = {
}) })
res = JSON.parse(res.text) res = JSON.parse(res.text)
await response.edit({ await response.edit({
embeds: [ embeds: [
createEmbed("default", context, { createEmbed("default", context, {
description: `${codeblock(`py`, [`${context.commandClient.prefixes.custom.first()}art -type ${args.type.toLowerCase()} -seed ${seed} -variance ${variance} -rotate ${rotate}`])}`, description: `${codeblock(`py`, [`${DEFAULT_BOT_PREFIX}art -type ${args.type.toLowerCase()} -seed ${seed} -variance ${variance} -rotate ${rotate}`])}`,
image: { image: {
url: res.image_link url: res.image_link
}, },

View file

@ -33,12 +33,13 @@ module.exports.paginator = new Paginator(cluster, {
// Clients // Clients
let commandPrefixes = ['lc..', 'ic.', 'lc.'] // Migration from beta -> main, remove lc.. eventually let commandPrefixes = ['lc.', 'ic.', 'lc..'] // Migration from beta -> main, remove lc.. eventually
if(process.env.PREFIX_OVERRIDE) commandPrefixes = process.env.PREFIX_OVERRIDE.split('|'); if(process.env.PREFIX_OVERRIDE) commandPrefixes = process.env.PREFIX_OVERRIDE.split('|');
const commandClient = new CommandClient(cluster, { const commandClient = new CommandClient(cluster, {
activateOnEdits: true, activateOnEdits: true,
mentionsEnabled: false, mentionsEnabled: false,
prefix: commandPrefixes[0],
prefixes: commandPrefixes, prefixes: commandPrefixes,
useClusterClient: true, useClusterClient: true,
ratelimits: [ ratelimits: [
@ -57,7 +58,8 @@ const { editOrReply } = require('./utils/message');
// Delete command responses if the user chooses to delete their trigger or edits the command away // Delete command responses if the user chooses to delete their trigger or edits the command away
commandClient.on('commandDelete', async ({context, reply}) => { commandClient.on('commandDelete', async ({context, reply}) => {
if(context.message?.deleted && !reply.deleted || !context.message.content.startsWith(commandPrefix)) reply.delete(); for(const p of commandPrefixes) if(context.message.content.startsWith(p)) return;
if(context.message?.deleted && !reply.deleted) reply.delete();
}) })
commandClient.on('commandRunError', async ({context, error}) => { commandClient.on('commandRunError', async ({context, error}) => {

View file

@ -3,6 +3,8 @@ module.exports.DISCORD_INVITES = Object.freeze({
privacy: "https://discord.gg/sQs8FhcTGh" privacy: "https://discord.gg/sQs8FhcTGh"
}) })
module.exports.DEFAULT_BOT_PREFIX = 'lc.'
module.exports.PRIVACY_POLICY_SECTIONS = [ module.exports.PRIVACY_POLICY_SECTIONS = [
'labsCore does not collect any sort of data about its users.', 'labsCore does not collect any sort of data about its users.',
'If the bot encounters unexpected errors we report information about the server, channel, user and command/command arguments (excluding images) to a private log in order to assist with debugging and resolving the issue. You can reference the provided error ID in our support server for further details. Contents of these automated reports will never be shared with third parties and are only accessible to the bots developers.', 'If the bot encounters unexpected errors we report information about the server, channel, user and command/command arguments (excluding images) to a private log in order to assist with debugging and resolving the issue. You can reference the provided error ID in our support server for further details. Contents of these automated reports will never be shared with third parties and are only accessible to the bots developers.',
@ -629,4 +631,38 @@ module.exports.GOOGLE_CLOUD_SAFETY_LABELS = Object.freeze({
icon: "exclaim_4", icon: "exclaim_4",
name: "Very Likely " name: "Very Likely "
} }
})
module.exports.MAPKIT_ACTIONS = Object.freeze({
SEARCH: "search",
STATIC_MAP: "render"
})
module.exports.REXTESTER_LANGUAGES = Object.freeze({
"bash": "38",
"node": "23",
"js": "23",
"py": "5",
"java": "4",
"lua": "14",
"ruby": "12",
"perl": "13",
"go": "20",
//"kt": "43",
"rust": "46",
"php": "8",
"c": "6",
"cpp": "7",
'cs': "1",
"elixir": "41",
"swift": "37",
"bf": "44",
"scala": "21",
"haskell": "11"
})
module.exports.REXTESTER_COMPILER_ARGS = Object.freeze({
"6": "-Wall -std=gnu99 -O2 -o a.out source_file.c",
"7": "-Wall -std=c++14 -O2 -o a.out source_file.cpp",
"11": "-o a.out source_file.hs"
}) })