mirror of
https://github.com/Sneed-Group/clanrocket-2
synced 2024-12-23 19:52:42 -06:00
Update 'index.js'
This commit is contained in:
parent
4db27d0f92
commit
7ce9ad50ec
1 changed files with 148 additions and 148 deletions
8
index.js
8
index.js
|
@ -106,7 +106,7 @@ client.on('interactionCreate', async interaction => {
|
||||||
if (commandName === 'xp') {
|
if (commandName === 'xp') {
|
||||||
const guildId = interactionGuildId;
|
const guildId = interactionGuildId;
|
||||||
const user = options.getUser('user') || interaction.user;
|
const user = options.getUser('user') || interaction.user;
|
||||||
const xp = db.get(`xp.${guildId}.${user.id}`) || 0;
|
const xp = await db.get(`xp.${guildId}.${user.id}`) || 0;
|
||||||
interaction.reply(`${user.username} has ${xp} XP.`);
|
interaction.reply(`${user.username} has ${xp} XP.`);
|
||||||
} else if (commandName === 'addxp') {
|
} else if (commandName === 'addxp') {
|
||||||
if (!interaction.member.permissions.has('ADMINISTRATOR')) {
|
if (!interaction.member.permissions.has('ADMINISTRATOR')) {
|
||||||
|
@ -116,8 +116,8 @@ client.on('interactionCreate', async interaction => {
|
||||||
const guildId = interactionGuildId;
|
const guildId = interactionGuildId;
|
||||||
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 = await db.get(`xp.${guildId}.${user.id}`) || 0;
|
||||||
db.set(`xp.${guildId}.${user.id}`, currentXp + amount);
|
const newXp = 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;
|
||||||
db.set(`xp.${guildId}.${user.id}`, Math.max(0, currentXp - amount));
|
const newXp = 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