This commit is contained in:
smsteel 2019-02-11 02:02:45 +03:00
parent 2ca64ec422
commit d3245d33ac
4 changed files with 18 additions and 76 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
node_modules
bot.db
package-lock.json

14
bot.js
View File

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

75
package-lock.json generated
View File

@ -904,11 +904,6 @@
"resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz",
"integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c="
},
"astral-regex": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz",
"integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg=="
},
"async-each": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz",
@ -1585,11 +1580,6 @@
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.113.tgz",
"integrity": "sha512-De+lPAxEcpxvqPTyZAXELNpRZXABRxf+uL/rSykstQhzj/B0l1150G/ExIIxKc16lI89Hgz81J0BHAcbTqK49g=="
},
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA=="
},
"encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
@ -4567,16 +4557,6 @@
"resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz",
"integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A=="
},
"slice-ansi": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz",
"integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==",
"requires": {
"ansi-styles": "3.2.1",
"astral-regex": "1.0.0",
"is-fullwidth-code-point": "2.0.0"
}
},
"snapdragon": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
@ -4852,6 +4832,14 @@
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
"integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew=="
},
"string-table": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/string-table/-/string-table-0.1.5.tgz",
"integrity": "sha1-h9rXSfsFTvUBY3u6OaFo8VheTmg=",
"requires": {
"colors": "1.3.3"
}
},
"string-width": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
@ -4907,53 +4895,6 @@
"integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=",
"dev": true
},
"table": {
"version": "5.2.3",
"resolved": "https://registry.npmjs.org/table/-/table-5.2.3.tgz",
"integrity": "sha512-N2RsDAMvDLvYwFcwbPyF3VmVSSkuF+G1e+8inhBLtHpvwXGw4QRPEZhihQNeEN0i1up6/f6ObCJXNdlRG3YVyQ==",
"requires": {
"ajv": "6.9.1",
"lodash": "4.17.11",
"slice-ansi": "2.1.0",
"string-width": "3.0.0"
},
"dependencies": {
"ajv": {
"version": "6.9.1",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.9.1.tgz",
"integrity": "sha512-XDN92U311aINL77ieWHmqCcNlwjoP5cHXDxIxbf2MaPYuCXOHS7gHH8jktxeK5omgd52XbSTX6a4Piwd1pQmzA==",
"requires": {
"fast-deep-equal": "2.0.1",
"fast-json-stable-stringify": "2.0.0",
"json-schema-traverse": "0.4.1",
"uri-js": "4.2.2"
}
},
"ansi-regex": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.0.0.tgz",
"integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w=="
},
"string-width": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.0.0.tgz",
"integrity": "sha512-rr8CUxBbvOZDUvc5lNIJ+OC1nPVpz+Siw9VBtUjB9b6jZehZLFt0JMCZzShFHIsI8cbhm0EsNIfWJMFV3cu3Ew==",
"requires": {
"emoji-regex": "7.0.3",
"is-fullwidth-code-point": "2.0.0",
"strip-ansi": "5.0.0"
}
},
"strip-ansi": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.0.0.tgz",
"integrity": "sha512-Uu7gQyZI7J7gn5qLn1Np3G9vcYGTVqB+lFTytnDJv83dd8T22aGH451P3jueT2/QemInJDfxHB5Tde5OzgG1Ow==",
"requires": {
"ansi-regex": "4.0.0"
}
}
}
},
"tar": {
"version": "4.4.8",
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.8.tgz",

View File

@ -23,7 +23,7 @@
"@babel/preset-env": "^7.3.1",
"express": "^4.16.4",
"sqlite3": "^4.0.6",
"table": "^5.2.3",
"string-table": "^0.1.5",
"telegraf": "^3.27.1"
}
}