Merge branch 'dev'
commit
29dbed7097
|
@ -45,6 +45,38 @@ export default class Apply extends Command {
|
|||
},
|
||||
});
|
||||
|
||||
this.services.set('cs::promot3', {
|
||||
description: 'Receive 25% off your first purchase of Tier 3.',
|
||||
type: 'SOFT',
|
||||
url: 'https://eds.libraryofcode.org/cs/t3-promo',
|
||||
validation: async (member: Member) => {
|
||||
if (!member.roles.includes('546457886440685578')) return false;
|
||||
const customer = await this.client.db.Customer.findOne({ userID: member.user.id }).lean().exec();
|
||||
if (!customer) return false;
|
||||
return true;
|
||||
},
|
||||
func: async (client: Client, ...data: any[]) => {
|
||||
const member = await client.guilds.get(client.config.guildID).getRESTMember(data[0]);
|
||||
const customer = await client.db.Customer.findOne({ userID: member.user.id }).lean().exec();
|
||||
const coupon = await client.stripe.coupons.create({
|
||||
percent_off: 25,
|
||||
duration: 'once',
|
||||
max_redemptions: 1,
|
||||
name: 'Tier 3 - EDS Discount',
|
||||
});
|
||||
const promo = await client.stripe.promotionCodes.create({
|
||||
coupon: coupon.id,
|
||||
customer: customer.cusID,
|
||||
max_redemptions: 1,
|
||||
restrictions: {
|
||||
first_time_transaction: true,
|
||||
},
|
||||
});
|
||||
const chan = await client.getDMChannel(customer.userID);
|
||||
chan.createMessage(`__**Tier 3 Coupon Code**__\n\`${promo.code}\`\n\n*Do not share this promotional code with anyone else. This promo code is good for your first purchase of Tier 2, 25% off applied. Will apply to your first invoice only, for more questions contact support.*`);
|
||||
},
|
||||
});
|
||||
|
||||
this.services.set('p::role::constants', {
|
||||
description: 'Pre-approval for Constants role assignment.',
|
||||
type: 'SOFT',
|
||||
|
|
Loading…
Reference in New Issue