2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-08-31 22:25:15 +00:00

Minor improvements to /user

This commit is contained in:
GingerPlusPlus
2017-11-02 16:54:17 +01:00
parent 417bbb1dc9
commit 70b8f7bb0e

View File

@@ -7,7 +7,7 @@ const { link, scheduleDeletion } = require('../../utils/tg');
const { replyOptions } = require('../../bot/options'); const { replyOptions } = require('../../bot/options');
// DB // DB
const { getUser, getWarns } = require('../../stores/user'); const { getUser } = require('../../stores/user');
const getWarnsHandler = async ({ message, reply, state }) => { const getWarnsHandler = async ({ message, reply, state }) => {
const { isAdmin } = state; const { isAdmin } = state;
@@ -29,12 +29,11 @@ const getWarnsHandler = async ({ message, reply, state }) => {
).then(scheduleDeletion); ).then(scheduleDeletion);
} }
let i = 0; const { warns } = theUser;
const warns = await getWarns(theUser);
const warnsMessage = warns const warnsMessage = warns
? '⚠️ <b>Warns:</b>\n' + ? '⚠️ <b>Warns:</b>\n' +
warns warns
.map(warn => ++i + '. ' + warn) .map((warn, i) => `${i + 1}. ${warn}`)
.join('\n') .join('\n')
: '✅ <b>no warns</b>'; : '✅ <b>no warns</b>';