30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
const {
|
||
UserModel
|
||
} = require('/workspace/degradin/Dev/Telegram/CampFire Play/config')
|
||
|
||
module.exports = async (ctx) => {
|
||
let user = await UserModel.findByPk(ctx.from.id)
|
||
let containers = []
|
||
let values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||
let oneValue = []
|
||
for(i = 0; i < 10; i++){
|
||
oneValue = values.random()
|
||
values = values.filter(value => value != oneValue);
|
||
containers.push({name: `📦 Контейнер ${i+1}`, value: oneValue})
|
||
}
|
||
let keyboardButtons = containers.map(container => {
|
||
return {text: container.name, callback_data: `container_${container.value}`}
|
||
})
|
||
let rows = []
|
||
while (keyboardButtons.length > 0) {
|
||
rows.push(keyboardButtons.splice(0, 2)) // разбиваем на подмассивы по 5 кнопок
|
||
}
|
||
console.log(containers)
|
||
await ctx.replyWithMarkdownV2('[Sueta Logistic International](https://telegra.ph/OOO-Sueta-Logistic-International-09-27)\nДоступные контейнеры в порту:',
|
||
{
|
||
reply_markup: {
|
||
inline_keyboard: rows
|
||
},
|
||
disable_web_page_preview: true
|
||
})
|
||
} |