CampFirePlay/commands/erase.js
2024-12-21 09:34:53 +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('/dev/Telegram/CampFireGameBot/config')
const {
spaces,
spacesWithMarkdown,
escape,
generatePromo,
generateVoucher,
getCurrentTime,
getSlot,
giveExp,
matPriceUpdate,
rand,
random,
setCooldown,
weaponShopUpdate,
stats
} = require('/dev/Telegram/CampFireGameBot/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('Поздравляю, вы выиграли!');
}
}