mirror of
https://github.com/Sneed-Group/clanrocket-2
synced 2025-01-09 17:53:13 +00:00
Update 'index.js'
This commit is contained in:
parent
7ce9ad50ec
commit
24dadb7c5c
1 changed files with 2 additions and 2 deletions
4
index.js
4
index.js
|
@ -117,7 +117,7 @@ client.on('interactionCreate', async interaction => {
|
||||||
const amount = options.getInteger('amount');
|
const amount = options.getInteger('amount');
|
||||||
const user = options.getUser('user') || interaction.user;
|
const user = options.getUser('user') || interaction.user;
|
||||||
const currentXp = await db.get(`xp.${guildId}.${user.id}`) || 0;
|
const currentXp = await db.get(`xp.${guildId}.${user.id}`) || 0;
|
||||||
const newXp = await db.set(`xp.${guildId}.${user.id}`, currentXp + amount);
|
await db.set(`xp.${guildId}.${user.id}`, currentXp + amount);
|
||||||
interaction.reply(`${amount} XP added to ${user.username}.`);
|
interaction.reply(`${amount} XP added to ${user.username}.`);
|
||||||
} else if (commandName === 'removexp') {
|
} else if (commandName === 'removexp') {
|
||||||
if (!interaction.member.permissions.has('ADMINISTRATOR')) {
|
if (!interaction.member.permissions.has('ADMINISTRATOR')) {
|
||||||
|
@ -128,7 +128,7 @@ client.on('interactionCreate', async interaction => {
|
||||||
const amount = options.getInteger('amount');
|
const amount = options.getInteger('amount');
|
||||||
const user = options.getUser('user') || interaction.user;
|
const user = options.getUser('user') || interaction.user;
|
||||||
const currentXp = db.get(`xp.${guildId}.${user.id}`) || 0;
|
const currentXp = db.get(`xp.${guildId}.${user.id}`) || 0;
|
||||||
const newXp = await db.set(`xp.${guildId}.${user.id}`, Math.max(0, currentXp - amount));
|
await db.set(`xp.${guildId}.${user.id}`, Math.max(0, currentXp - amount));
|
||||||
interaction.reply(`${amount} XP removed from ${user.username}.`);
|
interaction.reply(`${amount} XP removed from ${user.username}.`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue