diff --git a/bot.js b/bot.js index 1e377a5..03343e7 100644 --- a/bot.js +++ b/bot.js @@ -9,7 +9,7 @@ import { } from './types' import { currentTime } from './utility' import { getEntityDeathMessage, getEntityName } from './ru' -import stringTable from 'string-table' +import table from '1table' const bot = new Telegraf('643297173:AAGuqfZx3GhiiARwvY7AtWTTFw1T-2FiwCM') const markdown = TelegrafExtra.markdown() @@ -19,12 +19,33 @@ bot.command( 'players', ({ replyWithMarkdown }) => getPlayersData() .then(getPlayersData => replyWithMarkdown( - stringTable.create(getPlayersData - .map(({ displayName, level, online }) => ({ - 'имя': `👤 *${displayName}*`, - 'уровень': level, - 'статус': `${online ? '✅ *онлайн*' : '❔ оффлайн'}` - }))) + table( + getPlayersData + .map(({ displayName, level, online }) => ([ + `👤 *${displayName}*`, + level, + `${online ? '✅ *онлайн*' : '❔ оффлайн'}` + ])), + { + border: { + topBody: ``, + topJoin: ``, + topLeft: ``, + topRight: ``, + bottomBody: ``, + bottomJoin: ``, + bottomLeft: ``, + bottomRight: ``, + bodyLeft: ``, + bodyRight: ``, + bodyJoin: `|`, + joinBody: `-`, + joinLeft: ``, + joinRight: ``, + joinJoin: `|` + } + } + ) )) ) bot.launch() diff --git a/package.json b/package.json index 235db7e..9599858 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "express": "^4.16.4", "sqlite3": "^4.0.6", "string-table": "^0.1.5", + "table": "^5.2.3", "telegraf": "^3.27.1" } }