Skip to content

Commit 471e390

Browse files
committed
Allow custom emojis in setcurrency
1 parent 32ce548 commit 471e390

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

commands/Administrator/setup.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -681,24 +681,26 @@ class Setup extends Command {
681681
);
682682
}
683683

684-
let channel;
685684
args.shift();
686685
let channelArg = args[0];
687686
let kickAmount = parseInt(args[1]);
688687
let banAmount = parseInt(args[2]);
689688

690-
channel = await this.client.util.getChannel(msg, channelArg);
689+
let logChannel = await this.client.util.getChannel(msg, channelArg);
691690

692-
while (!channel) {
691+
while (!logChannel) {
693692
channelArg = await this.client.util.awaitReply(
694693
msg,
695694
'That was an invalid channel. What channel do you want to setup logging in?',
696695
);
697-
channel = await this.client.util.getChannel(msg, channelArg);
696+
logChannel = await this.client.util.getChannel(msg, channelArg);
698697
}
699698

700699
while (isNaN(kickAmount)) {
701-
kickAmount = await this.client.util.awaitReply(msg, 'How many points should be required to kick the member?');
700+
kickAmount = await this.client.util.awaitReply(
701+
msg,
702+
'How many points should be required to kick the member? Please respond with a number.',
703+
);
702704
if (!kickAmount) {
703705
errorEmbed.setDescription('You did not reply in time, the command has been cancelled.');
704706
return msg.channel.send({ embeds: [errorEmbed] });
@@ -707,7 +709,10 @@ class Setup extends Command {
707709
}
708710

709711
while (isNaN(banAmount)) {
710-
banAmount = await this.client.util.awaitReply(msg, 'How many points should be required to ban the member?');
712+
banAmount = await this.client.util.awaitReply(
713+
msg,
714+
'How many points should be required to ban the member? Please respond with a number.',
715+
);
711716
if (!banAmount) {
712717
errorEmbed.setDescription('You did not reply in time, the command has been cancelled.');
713718
return msg.channel.send({ embeds: [errorEmbed] });
@@ -717,7 +722,7 @@ class Setup extends Command {
717722

718723
await db.set(`servers.${msg.guild.id}.warns.kick`, kickAmount);
719724
await db.set(`servers.${msg.guild.id}.warns.ban`, banAmount);
720-
await db.set(`servers.${msg.guild.id}.warns.channel`, channel.id);
725+
await db.set(`servers.${msg.guild.id}.warns.channel`, logChannel.id);
721726

722727
const em = new EmbedBuilder()
723728
.setTitle('Warns System Setup')
@@ -734,7 +739,7 @@ class Setup extends Command {
734739
.setTimestamp();
735740

736741
await msg.channel.send({ embeds: [em] });
737-
return msg.guild.channels.cache.get(channel.id).send({ embeds: [em] });
742+
return msg.guild.channels.cache.get(logChannel.id).send({ embeds: [em] });
738743
}
739744
// End of the warns setup
740745

@@ -758,8 +763,8 @@ class Setup extends Command {
758763
{
759764
name: 'Warns',
760765
value: stripIndents`
761-
To setup the warns system please use:
762-
\`${msg.settings.prefix}Setup Warns <channel-name> <Points for kick> <Points for ban>\``,
766+
To setup the warnings system please use:
767+
\`${msg.settings.prefix}Setup Warnings <channel-name> <Points for kick> <Points for ban>\``,
763768
},
764769
])
765770
.setAuthor({ name: msg.member.displayName, iconURL: msg.author.displayAvatarURL() });

commands/Economy/set-currency.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,17 @@ class SetCurrency extends Command {
2424
`The currency symbol for this server is: ${oldSymbol} \nUsage: ${msg.settings.prefix}set-currency <symbol>`,
2525
);
2626

27-
if (/\d/.test(symbol)) {
27+
// Remove custom emojis before checking for numbers
28+
const filteredSymbol = symbol.replace(/<a?:\w+:\d+>/g, '');
29+
30+
if (/\d/.test(filteredSymbol)) {
2831
return msg.channel.send('The currency symbol cannot contain numbers.');
2932
}
3033

31-
if (symbol.length > 50) return msg.channel.send('The maximum length for the currency symbol is 50 characters.');
32-
if (symbol === oldSymbol) return msg.channel.send('That is already the currency symbol.');
34+
if (filteredSymbol.length > 50) {
35+
return msg.channel.send('The maximum length for the currency symbol is 50 characters.');
36+
}
37+
if (filteredSymbol === oldSymbol) return msg.channel.send('That is already the currency symbol.');
3338

3439
await db.set(`servers.${msg.guild.id}.economy.symbol`, symbol);
3540

0 commit comments

Comments
 (0)