Fixed 2 bugs

This commit is contained in:
CorwinDev 2022-12-17 21:01:29 +01:00
parent bf374e7224
commit daccc918bd
2 changed files with 8 additions and 13 deletions

View file

@ -30,7 +30,7 @@ module.exports = async (client, interaction, args) => {
Schema.findOne({ Guild: interaction.guild.id, User: user.id }, async (err, targetData) => { Schema.findOne({ Guild: interaction.guild.id, User: user.id }, async (err, targetData) => {
if (targetData) { if (targetData) {
var targetMoney = targetData.Money; var targetMoney = targetData.Money;
if (targetData = undefined || !targetData || targetData.Money == 0 || targetData.Money < 0) { if (targetData = undefined || !targetData || targetMoney == 0 || targetMoney < 0) {
return client.errNormal({ error: `${user.username} does not have anything you can rob!`, type: 'editreply' }, interaction); return client.errNormal({ error: `${user.username} does not have anything you can rob!`, type: 'editreply' }, interaction);
} }
@ -80,7 +80,7 @@ module.exports = async (client, interaction, args) => {
}, interaction); }, interaction);
} }
else { else {
return client.errNormal({ error: `${user.user.username} does not have anything you can rob!`, type: 'editreply' }, interaction); return client.errNormal({ error: `${user.username} does not have anything you can rob!`, type: 'editreply' }, interaction);
} }
}) })
} }

View file

@ -36,21 +36,16 @@ module.exports = async (client, interaction, args) => {
}, interaction).then(msg => { }, interaction).then(msg => {
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
interaction.channel.awaitMessageComponent({ filter, max: 1, componentType: 'SELECT_MENU' }).then(async i => { interaction.channel.awaitMessageComponent({ filter, max: 1, componentType: Discord.ComponentType.StringSelect }).then(i => {
if (i.customId == 'gender-setup') { if (i.customId == 'gender-setup') {
data.Gender = i.values[0]; data.Gender = i.values[0];
data.save(); data.save();
client.api.interactions(i.id, i.token).callback.post({ client.succNormal({
data: { text: "Set your gender to " + i.values[0],
type: 4, type: 'editreply',
data: { components: [],
content: `Your gender is set`, }, interaction);
embeds: [],
flags: 64,
}
}
});
} }
}) })
}) })