reaction event error feedback

This commit is contained in:
Baipyrus 2024-02-05 21:19:47 +01:00
parent 474a35a736
commit c66cff1d21
2 changed files with 10 additions and 2 deletions

View File

@ -35,7 +35,11 @@ export async function execute(reaction, user) {
// Fetch role from guild // Fetch role from guild
const guild = reaction.message.guild; const guild = reaction.message.guild;
const role = await guild.roles.fetch(rep.role); const role = await guild.roles.fetch(rep.role);
if (role === null) return; // Role not found
if (role === null) {
await user.send('Could not fetch role! Please contact server staff.');
return;
}
try { try {
// Add role to user // Add role to user

View File

@ -31,7 +31,11 @@ export async function execute(reaction, user) {
// Fetch role from guild // Fetch role from guild
const guild = reaction.message.guild; const guild = reaction.message.guild;
const role = await guild.roles.fetch(rep.role); const role = await guild.roles.fetch(rep.role);
if (role === null) return; // Role not found
if (role === null) {
await user.send('Could not fetch role! Please contact server staff.');
return;
}
try { try {
// Remove role from user // Remove role from user