table test
This commit is contained in:
parent
6eacd8bcd2
commit
b6e46ed0a9
35
bot.js
35
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()
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user