2
0
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:
GingerPlusPlus 2019-05-31 14:09:22 +02:00
parent 16f303622b
commit 1a36b1a85d

View File

@ -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);