community-relations/src/class/Command.ts

65 lines
1.6 KiB
TypeScript
Raw Normal View History

2020-04-14 13:15:33 -04:00
import { Member, Message } from 'eris';
import { Client } from '.';
export default class Command {
public client: Client;
/**
* The name of the command
*/
public name: string;
/**
* The description for the command.
*/
public description: string;
/**
* The aliases for the command.
*/
public aliases: string[];
/**
* - **0:** Everyone
* - **1:** Associates Team+
* - **2:** Sheriff+
* - **3:** Faculty Marshals+
* - **4:** Marshal Generals of Engineering
*/
public permissions: number;
/**
* Determines if the command is only available in server.
*/
public guildOnly: boolean;
/**
* Determines if the command is enabled or not.
*/
public enabled: boolean;
public run(message: Message, args: string[]): Promise<any> { return Promise.resolve(); }
constructor(client: Client) {
this.client = client;
}
public checkPermissions(member: Member): boolean {
if (member.id === '278620217221971968' || member.id === '253600545972027394') return true;
switch (this.permissions) {
case 0:
return true;
case 1:
return member.roles.some((r) => ['662163685439045632', '455972169449734144', '453689940140883988'].includes(r));
case 2:
return member.roles.some((r) => ['662163685439045632', '455972169449734144'].includes(r));
case 3:
return member.roles.some((r) => ['662163685439045632'].includes(r));
case 4:
return member.id === '278620217221971968' || member.id === '253600545972027394';
default:
return false;
}
}
}