Make several replies ephemeral
This commit is contained in:
parent
eee43d2976
commit
ae61e4761f
18
src/index.js
18
src/index.js
@ -49,12 +49,12 @@ client.on('interactionCreate', async(interaction) => {
|
|||||||
const gearType = interaction.options.get('geartype').value;
|
const gearType = interaction.options.get('geartype').value;
|
||||||
const employee = interaction.options.get('employee').value;
|
const employee = interaction.options.get('employee').value;
|
||||||
if ( addRemove == 'add') {
|
if ( addRemove == 'add') {
|
||||||
AddGear(gearType, employee)
|
const gearAdded = AddGear(gearType, employee)
|
||||||
interaction.reply(`Added a gear to ${employee}`)
|
interaction.reply({content: `Added a ${gearAdded} to ${employee}`, ephemeral: true})
|
||||||
};
|
};
|
||||||
|
|
||||||
} else if (interaction.commandName === 'gear' && !isManager) {
|
} else if (interaction.commandName === 'gear' && !isManager) {
|
||||||
interaction.reply("You aren't a manager! Get back to work.")
|
interaction.reply({content:"You aren't a manager! Get back to work.", ephemeral: true})
|
||||||
};
|
};
|
||||||
|
|
||||||
if (interaction.commandName === 'employee' && isManager) {
|
if (interaction.commandName === 'employee' && isManager) {
|
||||||
@ -69,7 +69,7 @@ client.on('interactionCreate', async(interaction) => {
|
|||||||
interaction.reply(`Fired ${employeeName}`)
|
interaction.reply(`Fired ${employeeName}`)
|
||||||
}
|
}
|
||||||
} else if (interaction.commandName === 'employee' && !isManager) {
|
} else if (interaction.commandName === 'employee' && !isManager) {
|
||||||
interaction.reply("You aren't a manager! Get back to work.")
|
interaction.reply({content:"You aren't a manager! Get back to work.", ephemeral: true})
|
||||||
};
|
};
|
||||||
|
|
||||||
if (interaction.commandName === 'promote' && isManager) {
|
if (interaction.commandName === 'promote' && isManager) {
|
||||||
@ -78,7 +78,7 @@ client.on('interactionCreate', async(interaction) => {
|
|||||||
PromoteEmployee(employeeName, rank);
|
PromoteEmployee(employeeName, rank);
|
||||||
interaction.reply(`Changed ${employeeName}\'s rank to ${rank}`);
|
interaction.reply(`Changed ${employeeName}\'s rank to ${rank}`);
|
||||||
} else if (interaction.commandName === 'promote' && !isManager) {
|
} else if (interaction.commandName === 'promote' && !isManager) {
|
||||||
interaction.reply("You aren't a manager! Get back to work.")
|
interaction.reply({content:"You aren't a manager! Get back to work.", ephemeral: true})
|
||||||
};
|
};
|
||||||
|
|
||||||
if (interaction.commandName === 'rename' && isManager) {
|
if (interaction.commandName === 'rename' && isManager) {
|
||||||
@ -102,7 +102,7 @@ client.on('interactionCreate', async(interaction) => {
|
|||||||
|
|
||||||
if (scoreBoardMessage != "") {
|
if (scoreBoardMessage != "") {
|
||||||
gearchannel.send(scoreBoardMessage);
|
gearchannel.send(scoreBoardMessage);
|
||||||
interaction.reply("Displaying Scoreboard");
|
interaction.reply({content: "Displaying Scoreboard", ephemeral: true});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("Something went wrong when building the scoreboard.");
|
console.log("Something went wrong when building the scoreboard.");
|
||||||
@ -113,7 +113,7 @@ client.on('interactionCreate', async(interaction) => {
|
|||||||
const gearMessage = await messagesInGearchannel.find(msg => msg.author.id === '1306647733490290809')
|
const gearMessage = await messagesInGearchannel.find(msg => msg.author.id === '1306647733490290809')
|
||||||
|
|
||||||
if (gearMessage === undefined) {
|
if (gearMessage === undefined) {
|
||||||
interaction.reply("Could not find a message to update, did you remember to display it first?");
|
interaction.reply({content: "Could not find a message to update, did you remember to display it first?", ephemeral: true});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gearMessage.edit(scoreBoardMessage);
|
gearMessage.edit(scoreBoardMessage);
|
||||||
@ -121,7 +121,7 @@ client.on('interactionCreate', async(interaction) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (interaction.commandName === 'scoreboard' && !isManager) {
|
} else if (interaction.commandName === 'scoreboard' && !isManager) {
|
||||||
interaction.reply("You aren't a manager! Get back to work.")
|
interaction.reply({content:"You aren't a manager! Get back to work.", ephemeral: true})
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -143,6 +143,8 @@ function AddGear(Type,Employee) {
|
|||||||
}
|
}
|
||||||
if (Type != "coppergear" && Type != "silvergear" && Type != "goldgear" && Type != "purplegear") return
|
if (Type != "coppergear" && Type != "silvergear" && Type != "goldgear" && Type != "purplegear") return
|
||||||
db.run(`UPDATE Employees SET ${Type} = ${Type} + 1 WHERE name = \'${Employee}\' `)
|
db.run(`UPDATE Employees SET ${Type} = ${Type} + 1 WHERE name = \'${Employee}\' `)
|
||||||
|
|
||||||
|
return Type;
|
||||||
};
|
};
|
||||||
function RemoveGear(Type, Employee) {
|
function RemoveGear(Type, Employee) {
|
||||||
if (Type != "coppergear" && Type != "silvergear" && Type != "goldgear" && Type != "purplegear") return
|
if (Type != "coppergear" && Type != "silvergear" && Type != "goldgear" && Type != "purplegear") return
|
||||||
|
Loading…
Reference in New Issue
Block a user