mirror of
https://github.com/arthur-pbty/bot-discord-coins.git
synced 2026-06-26 06:32:56 +02:00
format all file
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
const db = require('./database.js');
|
||||
const db = require("./database.js");
|
||||
|
||||
module.exports = async function getPermissionLevel(serverId, user) {
|
||||
const roles = user.roles.cache.map(role => role.id);
|
||||
const roles = user.roles.cache.map((role) => role.id);
|
||||
|
||||
const perms = await new Promise((resolve, reject) => {
|
||||
db.all(`SELECT * FROM rolePermission WHERE guildId = ? AND roleId IN (${roles.map(() => '?').join(',')})`, [serverId, ...roles], (err, rows) => {
|
||||
if (err) reject(err);
|
||||
resolve(rows);
|
||||
});
|
||||
db.all(
|
||||
`SELECT * FROM rolePermission WHERE guildId = ? AND roleId IN (${roles.map(() => "?").join(",")})`,
|
||||
[serverId, ...roles],
|
||||
(err, rows) => {
|
||||
if (err) reject(err);
|
||||
resolve(rows);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
const highestPermission = Math.max(...perms.map(perm => perm.permission));
|
||||
|
||||
const highestPermission = Math.max(...perms.map((perm) => perm.permission));
|
||||
return highestPermission;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user