This commit is contained in:
smsteel
2019-02-11 02:00:52 +03:00
parent 9315a55f65
commit 2ca64ec422
3 changed files with 90 additions and 31 deletions

12
bot.js
View File

@ -9,7 +9,7 @@ import {
} from './types'
import { currentTime } from './utility'
import { getEntityDeathMessage, getEntityName } from './ru'
import stringTable from 'string-table'
import table from 'table'
const bot = new Telegraf('643297173:AAGuqfZx3GhiiARwvY7AtWTTFw1T-2FiwCM')
const markdown = TelegrafExtra.markdown()
@ -19,12 +19,12 @@ bot.command(
'players',
({ replyWithMarkdown }) => getPlayersData()
.then(getPlayersData => replyWithMarkdown(
stringTable.create(getPlayersData
.map(({ displayName, level, online }) => ({
name: `👤 *${displayName}*`,
table(getPlayersData
.map(({ displayName, level, online }) => ([
`👤 *${displayName}*`,
level,
status: `${online ? '✅ *онлайн*' : '❔ оффлайн'}`
})))
`${online ? '✅ *онлайн*' : '❔ оффлайн'}`
])))
))
)
bot.launch()