merge
parent
ef777ea4e1
commit
d70a274712
|
@ -0,0 +1,36 @@
|
||||||
|
// 585600289747369987
|
||||||
|
import { Member } from 'eris';
|
||||||
|
import { Client, Event } from '../class';
|
||||||
|
import { CloudServicesUtil } from '../util';
|
||||||
|
|
||||||
|
export default class GuildMemberAdd extends Event {
|
||||||
|
public client: Client;
|
||||||
|
|
||||||
|
constructor(client: Client) {
|
||||||
|
super(client);
|
||||||
|
this.event = 'guildMemberAdd';
|
||||||
|
}
|
||||||
|
|
||||||
|
public async run(_, member: Member, oldMember: { roles: string[], premiumSince: number }) {
|
||||||
|
try {
|
||||||
|
if (member.roles.includes('585600289747369987') && !oldMember.roles.includes('585600289747369987')) {
|
||||||
|
const csAccountData = await CloudServicesUtil.fetchAccountStatus(member.id, this.client.config.internalKey);
|
||||||
|
if (csAccountData.tier > 1) return;
|
||||||
|
|
||||||
|
const status = await CloudServicesUtil.upgradeT2(member.id, this.client.config.internalKey);
|
||||||
|
if (status !== 200) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!member.roles.includes('585600289747369987') && oldMember.roles.includes('585600289747369987')) {
|
||||||
|
const csAccountData = await CloudServicesUtil.fetchAccountStatus(member.id, this.client.config.internalKey);
|
||||||
|
if (csAccountData.tier > 1) return;
|
||||||
|
|
||||||
|
const status = await CloudServicesUtil.downgradeT2(member.id, this.client.config.internalKey);
|
||||||
|
if (status !== 200) return;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
this.client.util.handleError(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
export { default as CallBackHandler } from './CallBackHandler';
|
export { default as CallBackHandler } from './CallBackHandler';
|
||||||
export { default as CommandHandler } from './CommandHandler';
|
export { default as CommandHandler } from './CommandHandler';
|
||||||
export { default as guildMemberAdd } from './guildMemberAdd';
|
export { default as guildMemberAdd } from './guildMemberAdd';
|
||||||
export { default as messageReactionAdd } from './messageReactionAdd';
|
export { default as guildMemberUpdate } from './guildMemberUpdate';
|
||||||
export { default as ready } from './ready';
|
export { default as messageReactionAdd } from './messageReactionAdd';
|
||||||
|
export { default as ready } from './ready';
|
||||||
|
|
Loading…
Reference in New Issue