master
Matthew 2021-10-11 15:24:33 -04:00
parent ef777ea4e1
commit d70a274712
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
2 changed files with 42 additions and 5 deletions

View File

@ -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);
}
}
}

View File

@ -1,5 +1,6 @@
export { default as CallBackHandler } from './CallBackHandler';
export { default as CommandHandler } from './CommandHandler';
export { default as guildMemberAdd } from './guildMemberAdd';
export { default as messageReactionAdd } from './messageReactionAdd';
export { default as ready } from './ready';
export { default as CallBackHandler } from './CallBackHandler';
export { default as CommandHandler } from './CommandHandler';
export { default as guildMemberAdd } from './guildMemberAdd';
export { default as guildMemberUpdate } from './guildMemberUpdate';
export { default as messageReactionAdd } from './messageReactionAdd';
export { default as ready } from './ready';