community-relations/src/commands/profile.ts

27 lines
1.0 KiB
TypeScript
Raw Normal View History

2021-03-05 22:41:01 -05:00
import { Message } from 'eris';
import { Client, Command } from '../class';
2021-03-05 23:20:42 -05:00
import Profile_Bio from './profile_bio';
import Profile_GitHub from './profile_github';
import Profile_Gitlab from './profile_gitlab';
2021-03-05 22:41:01 -05:00
export default class Profile extends Command {
constructor(client: Client) {
super(client);
this.name = 'profile';
2021-03-05 23:20:42 -05:00
this.description = 'Manages your profile on CR.';
2021-03-11 01:13:18 -05:00
this.usage = `${this.client.config.prefix}profile <bio/github/gitlab> <new value>\n*Provide no value in subcommand to clear data.*`;
2021-03-05 22:41:01 -05:00
this.permissions = 0;
this.enabled = true;
2021-03-05 23:20:42 -05:00
this.subcmds = [Profile_Bio, Profile_GitHub, Profile_Gitlab];
2021-03-05 22:41:01 -05:00
}
2021-03-05 23:20:42 -05:00
public async run(message: Message) {
2021-03-05 22:41:01 -05:00
if (!await this.client.db.Member.exists({ userID: message.author.id })) {
await this.client.db.Member.create({ userID: message.author.id });
}
this.error(message.channel, `Please specify a valid option to change. Choose from \`github\`, \`bio\` and \`gitlab\`. You can view your profile with \`${this.client.config.prefix}whois\`.`);
}
}