2020-04-02 02:35:28 +00:00
|
|
|
import config from "../../config.json";
|
2018-09-02 10:07:40 +00:00
|
|
|
|
2020-04-02 02:35:28 +00:00
|
|
|
export const getLevel = user => {
|
2018-09-02 10:07:40 +00:00
|
|
|
let ret = {
|
|
|
|
level: 0,
|
|
|
|
verified: false
|
|
|
|
};
|
|
|
|
if (typeof user !== "object")
|
|
|
|
return "user has to be an object!";
|
2020-04-02 02:35:28 +00:00
|
|
|
if (!user.prefix)
|
2018-09-02 10:07:40 +00:00
|
|
|
return ret;
|
2020-04-02 02:35:28 +00:00
|
|
|
|
|
|
|
let admin;
|
|
|
|
if(admin = config.admins.filter(e => e.prefix === user.prefix)[0]) {
|
|
|
|
ret = {
|
|
|
|
level: admin.level,
|
|
|
|
verified: true
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-09-02 10:07:40 +00:00
|
|
|
return ret;
|
2020-04-02 02:35:28 +00:00
|
|
|
};
|