mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-13 18:59:19 +00:00
Add length check
This commit is contained in:
@@ -40,6 +40,20 @@ const EMBEDS = {
|
|||||||
user: (data instanceof Interaction) ? data.user : data.author
|
user: (data instanceof Interaction) ? data.user : data.author
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
PREFIX_TOO_LONG: (data: Message | Interaction) => {
|
||||||
|
return makeErrorEmbed ({
|
||||||
|
title: 'Prefix too long',
|
||||||
|
description: `I bet you can't even remember that`,
|
||||||
|
user: (data instanceof Interaction) ? data.user : data.author
|
||||||
|
});
|
||||||
|
},
|
||||||
|
PREFIX_IS_MENTION: (data: Message | Interaction) => {
|
||||||
|
return makeErrorEmbed ({
|
||||||
|
title: 'Prefix cannot be mention of me',
|
||||||
|
description: `You can already call me by mentioning me. I got you covered, don't worry`,
|
||||||
|
user: (data instanceof Interaction) ? data.user : data.author
|
||||||
|
});
|
||||||
|
},
|
||||||
PREFIX_UPDATED: (data: Message | Interaction, newPrefix: string) => {
|
PREFIX_UPDATED: (data: Message | Interaction, newPrefix: string) => {
|
||||||
return makeSuccessEmbed ({
|
return makeSuccessEmbed ({
|
||||||
title: 'Prefix updated',
|
title: 'Prefix updated',
|
||||||
@@ -95,6 +109,12 @@ export default class Settings {
|
|||||||
if(!newPrefix)
|
if(!newPrefix)
|
||||||
return await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.NO_PREFIX_PROVIDED(data)] });
|
return await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.NO_PREFIX_PROVIDED(data)] });
|
||||||
|
|
||||||
|
if(newPrefix.length > 100)
|
||||||
|
return await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.PREFIX_TOO_LONG(data)] });
|
||||||
|
|
||||||
|
if(newPrefix.startsWith(`<@!${DiscordProvider.client.user?.id}>`))
|
||||||
|
return await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.PREFIX_IS_MENTION(data)] });
|
||||||
|
|
||||||
let placeholder = await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.PROCESSING(data)] });
|
let placeholder = await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.PROCESSING(data)] });
|
||||||
await Prisma.client.guild.update({ where: { id: data.guildId! }, data: { prefix: newPrefix }});
|
await Prisma.client.guild.update({ where: { id: data.guildId! }, data: { prefix: newPrefix }});
|
||||||
Cache.updateGuildCache(data.guildId!);
|
Cache.updateGuildCache(data.guildId!);
|
||||||
|
|||||||
Reference in New Issue
Block a user