table test
This commit is contained in:
parent
6eacd8bcd2
commit
b6e46ed0a9
35
bot.js
35
bot.js
@ -9,7 +9,7 @@ import {
|
|||||||
} from './types'
|
} from './types'
|
||||||
import { currentTime } from './utility'
|
import { currentTime } from './utility'
|
||||||
import { getEntityDeathMessage, getEntityName } from './ru'
|
import { getEntityDeathMessage, getEntityName } from './ru'
|
||||||
import stringTable from 'string-table'
|
import table from '1table'
|
||||||
|
|
||||||
const bot = new Telegraf('643297173:AAGuqfZx3GhiiARwvY7AtWTTFw1T-2FiwCM')
|
const bot = new Telegraf('643297173:AAGuqfZx3GhiiARwvY7AtWTTFw1T-2FiwCM')
|
||||||
const markdown = TelegrafExtra.markdown()
|
const markdown = TelegrafExtra.markdown()
|
||||||
@ -19,12 +19,33 @@ bot.command(
|
|||||||
'players',
|
'players',
|
||||||
({ replyWithMarkdown }) => getPlayersData()
|
({ replyWithMarkdown }) => getPlayersData()
|
||||||
.then(getPlayersData => replyWithMarkdown(
|
.then(getPlayersData => replyWithMarkdown(
|
||||||
stringTable.create(getPlayersData
|
table(
|
||||||
.map(({ displayName, level, online }) => ({
|
getPlayersData
|
||||||
'имя': `👤 *${displayName}*`,
|
.map(({ displayName, level, online }) => ([
|
||||||
'уровень': level,
|
`👤 *${displayName}*`,
|
||||||
'статус': `${online ? '✅ *онлайн*' : '❔ оффлайн'}`
|
level,
|
||||||
})))
|
`${online ? '✅ *онлайн*' : '❔ оффлайн'}`
|
||||||
|
])),
|
||||||
|
{
|
||||||
|
border: {
|
||||||
|
topBody: ``,
|
||||||
|
topJoin: ``,
|
||||||
|
topLeft: ``,
|
||||||
|
topRight: ``,
|
||||||
|
bottomBody: ``,
|
||||||
|
bottomJoin: ``,
|
||||||
|
bottomLeft: ``,
|
||||||
|
bottomRight: ``,
|
||||||
|
bodyLeft: ``,
|
||||||
|
bodyRight: ``,
|
||||||
|
bodyJoin: `|`,
|
||||||
|
joinBody: `-`,
|
||||||
|
joinLeft: ``,
|
||||||
|
joinRight: ``,
|
||||||
|
joinJoin: `|`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
))
|
))
|
||||||
)
|
)
|
||||||
bot.launch()
|
bot.launch()
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
"express": "^4.16.4",
|
"express": "^4.16.4",
|
||||||
"sqlite3": "^4.0.6",
|
"sqlite3": "^4.0.6",
|
||||||
"string-table": "^0.1.5",
|
"string-table": "^0.1.5",
|
||||||
|
"table": "^5.2.3",
|
||||||
"telegraf": "^3.27.1"
|
"telegraf": "^3.27.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user