2021-03-05 22:41:01 -05:00
|
|
|
import { Message } from 'eris';
|
|
|
|
import { Client, Command } from '../class';
|
|
|
|
|
|
|
|
export default class Profile_Bio extends Command {
|
|
|
|
constructor(client: Client) {
|
|
|
|
super(client);
|
|
|
|
this.name = 'bio';
|
|
|
|
this.description = 'Updates your bio on your profile.';
|
|
|
|
this.usage = `${this.client.config.prefix}bio <new bio>`;
|
|
|
|
this.permissions = 0;
|
|
|
|
this.enabled = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public async run(message: Message, args: string[]) {
|
|
|
|
if (!await this.client.db.Member.exists({ userID: message.author.id })) {
|
|
|
|
await this.client.db.Member.create({ userID: message.author.id });
|
|
|
|
}
|
2021-03-05 23:20:42 -05:00
|
|
|
const member = await this.client.db.Member.findOne({ userID: message.author.id });
|
|
|
|
|
|
|
|
if (!args[0]) {
|
|
|
|
await member.updateOne({
|
|
|
|
additional: {
|
|
|
|
...member.additional,
|
|
|
|
bio: null,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
return message.addReaction('modSuccess:578750988907970567');
|
|
|
|
}
|
2021-03-05 22:41:01 -05:00
|
|
|
const bio = args.join(' ');
|
|
|
|
if (bio.length >= 256) return this.error(message.channel, 'Bio too long. It must be less than or equal to 256 characters.');
|
|
|
|
await member.updateOne({
|
|
|
|
additional: {
|
|
|
|
...member.additional,
|
|
|
|
bio,
|
|
|
|
},
|
|
|
|
});
|
2021-03-05 23:20:42 -05:00
|
|
|
return message.addReaction('modSuccess:578750988907970567');
|
2021-03-05 22:41:01 -05:00
|
|
|
}
|
|
|
|
}
|