2021-12-23 22:36:13 -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}profile bio <new bio>`;
|
|
|
|
this.permissions = 0;
|
|
|
|
this.enabled = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public async run(message: Message, args: string[]) {
|
2022-03-01 12:18:21 -05:00
|
|
|
if (!await this.client.db.mongo.Member.exists({ userID: message.author.id })) {
|
|
|
|
await this.client.db.mongo.Member.create({ userID: message.author.id });
|
2021-12-23 22:36:13 -05:00
|
|
|
}
|
2022-03-01 12:18:21 -05:00
|
|
|
const member = await this.client.db.mongo.Member.findOne({ userID: message.author.id });
|
2021-12-23 22:36:13 -05:00
|
|
|
|
|
|
|
if (!args[0]) {
|
|
|
|
await member.updateOne({
|
|
|
|
additional: {
|
|
|
|
...member.additional,
|
|
|
|
bio: null,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
return message.addReaction('modSuccess:578750988907970567');
|
|
|
|
}
|
|
|
|
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,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
return message.addReaction('modSuccess:578750988907970567');
|
|
|
|
}
|
|
|
|
}
|