mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-29 13:17:56 +00:00
Refuse to ban and warn admins on datastore level
This commit is contained in:
parent
16f303622b
commit
1a36b1a85d
@ -111,7 +111,7 @@ const isAdmin = (user) => {
|
|||||||
|
|
||||||
const ban = ({ id }, ban_details) =>
|
const ban = ({ id }, ban_details) =>
|
||||||
User.update(
|
User.update(
|
||||||
{ id },
|
{ id, $not: { status: 'admin' } },
|
||||||
{ $set: { ban_details, status: 'banned' } },
|
{ $set: { ban_details, status: 'banned' } },
|
||||||
{ upsert: true }
|
{ upsert: true }
|
||||||
);
|
);
|
||||||
@ -141,7 +141,7 @@ const isBanned = ({ id }) =>
|
|||||||
|
|
||||||
const warn = ({ id }, reason) =>
|
const warn = ({ id }, reason) =>
|
||||||
User.update(
|
User.update(
|
||||||
{ id },
|
{ id, $not: { status: 'admin' } },
|
||||||
{ $push: { warns: reason } },
|
{ $push: { warns: reason } },
|
||||||
{ returnUpdatedDocs: true }
|
{ returnUpdatedDocs: true }
|
||||||
).then(getUpdatedDocument);
|
).then(getUpdatedDocument);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user