CampFirePlay/commands/invite.js
Degradin 9e2eef59de v6.3
Обновление меню организации
Новая система инвайт кодов
2025-01-24 00:17:08 +03:00

60 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 {
weaponshop,
slots,
rarecars,
simplecars,
houses,
cars,
phones,
weapons,
equipment,
UserModel,
InviteModel,
WorldModel,
JobModel,
PropertyModel,
BusinessModel,
ReportModel,
BlockModel,
PromocodeModel,
mainChat,
adminList,
expToUp,
topSym
} = global.config
const {
spaces,
spacesWithMarkdown,
escape,
generatePromo,
generateVoucher,
getCurrentTime,
getSlot,
giveExp,
matPriceUpdate,
rand,
random,
setCooldown,
weaponShopUpdate,
stats
} = require('../utils')
module.exports = async (ctx) => {
let user = await UserModel.findByPk(ctx.from.id);
const invites = await InviteModel.findAll({ where: { type: 'referral', author: ctx.from.id } });
if (invites.length == 0) {
const invite = await InviteModel.create({ author: ctx.from.id, uid: `${user.username}_ref_invite`, type: 'referral' });
return ctx.reply( `
Для приглашения друга по реферальной системе, отправьте ему ссылку-приглашение
Как только он перейдет по ней и начнет игру, Вы получите 3 дня статуса "Bronze".
Ваша ссылка: https://t.me/CampFireGameBot?start=${invite.uid})
`);
}
const invite = invites[0];
return ctx.reply( `
Для приглашения друга по реферальной системе, отправьте ему ссылку-приглашение
Как только он перейдет по ней и начнет игру, Вы получите 3 дня статуса "Bronze".
Ваша ссылка: https://t.me/CampFireGameBot?start=${invite.uid})
`);
}