CampFirePlay/commands/property/hatkeisList.js
2024-12-21 20:01:15 +03:00

32 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const {
Markup
} = require('telegraf')
const {
weaponshop
} = global.config
const {
spaces,
escape,
weaponShopUpdate
} = global.utils
module.exports = async (ctx) => {
let text = `[Hatkeis Gunsmith](https://telegra.ph/Hatkeis-Gunsmith-09-27)\n`
let shop = `\n Вы подходите к зданию с вывеской "Ништяки Хаткейса".\n Вот ассортимент на сегодня\n`
let prodArray = []
for (i in weaponshop) {
prodArray.push({text: i, callback_data: `{"action": "buy", "type": "equipment", "value": "${i}"}`})
shop += `${i}. ${weaponshop[i].name}${spaces(weaponshop[i].price)})\n`
}
prodArray.push({text: `Назад`, callback_data: `shopmenu`})
let rows = []
while (prodArray.length > 0) {
rows.push(prodArray.splice(0, 5)) // разбиваем на подмассивы по 5 кнопок
}
return await ctx.replyWithMarkdownV2(text + escape(shop),
{
reply_markup: {
inline_keyboard: rows
},
disable_web_page_preview: true})
}