Utils/utility_functions.js
/**
 * Checks if a certain user has the permissions to change the alarm
 * @param {Discord.Message} message - The Discord Message object
 * @param {String} alarm_id - The string with the id of the alarm
 */
Checks if a certain user has the permissions to change the alarm
@param {Discord.Message} message - The Discord Message object
@param {String} alarm_id - The string with the id of the alarm
Checks if a certain user has the permissions to change the alarm @param { Discord . Message } message - The Discord Message object @param { String } alarm_id - The string with the id of the alarm
async function can_change_alarm(message, alarm_id) {
    let al = await alarm_db.get_alarm_by_id(alarm_id);
    if (!al) {
        return false;
    }
    let isOwner = al?.user_id == message.author.id;
    return (message.channel.type === 'dm' && isOwner) || isOwner || (!isPrivateAlarm && isAdministrator(message) && al?.guild === message.guild.id);
}
async function can_change_alarm ( message , alarm_id ) { let al = await alarm_db . get_alarm_by_id ( alarm_id ) ; if ( ! al ) { return false ; } let isOwner = al ?. user_id == message . author . id ; return ( message . channel . type === 'dm' && isOwner ) || isOwner || ( ! isPrivateAlarm && isAdministrator ( message ) && al ?. guild === message . guild . id ) ; }
Checks if a certain user has the permissions to change the alarm
 @param {Discord.Message} message - The Discord Message object
 @param {String} alarm_id - The string with the id of the alarm
Checks if a certain user has the permissions to change the alarm @param { Discord . Message } message - The Discord Message object @param { String } alarm_id - The string with the id of the alarm