CampFirePlay/commands/erase.js
Degradin baa0b5f3a9 global refactoring
Все переведено в модули
2023-10-08 23:43:12 +03:00

67 lines
1.5 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 {
Telegraf,
Scenes,
session,
Stage,
Markup
} = require('telegraf')
const {
weaponshop,
slots,
rarecars,
simplecars,
houses,
cars,
phones,
weapons,
equipment,
UserModel,
WorldModel,
JobModel,
PropertyModel,
BusinessModel,
ReportModel,
BlockModel,
PromocodeModel,
mainChat,
adminList,
expToUp,
topSym
} = require('/workspace/degradin/Dev/Telegram/CampFire Play/config')
const {
spaces,
spacesWithMarkdown,
escape,
generatePromo,
generateVoucher,
getCurrentTime,
getSlot,
giveExp,
matPriceUpdate,
rand,
random,
setCooldown,
weaponShopUpdate,
stats
} = require('/workspace/degradin/Dev/Telegram/CampFire Play/utils')
module.exports = async (ctx) => {
// Получаем контекст canvas
const canvas = ctx.update.callback_query.message.photo[0].file_id;
const ctx = new Canvas(cardWidth, cardHeight);
// Увеличиваем координаты верхнего слоя
topLayerX += 10;
topLayerY += 10;
// Отправляем обновленную карточку
ctx.replyWithPhoto({ source: canvas.toBuffer() }, Markup.inlineKeyboard([
Markup.callbackButton('Стереть', 'erase'),
]).extra());
// Проверяем, достиг ли верхний слой края карточки
if (topLayerX + cardWidth > cardWidth) {
// Отправляем сообщение с выигрышем
ctx.reply('Поздравляю, вы выиграли!');
}
}