const { Command } = require('discord.js-commando');

const UserProfile = require('../../postgreSQL/models/UserProfile');

module.exports = class PersonalMessageCommand extends Command {
	constructor(client) {
		super(client, {
			name: 'personal-message',
			aliases: ['set-personal-message', 'set-biography', 'biography', 'set-bio', 'bio'],
			group: 'social',
			memberName: 'personal-message',
			description: 'Set your personal message for your profile.',
			details: 'Set your personal message for your profile.',
			guildOnly: true,
			throttling: {
				usages: 1,
				duration: 30
			},

			args: [
				{
					key: 'message',
					prompt: 'what would you like to set as your personal message?\n',
					type: 'string',
					validate: value => {
						if (value.length > 130) {
							return `
								your message was ${value.length} characters long.
								Please limit your personal message to 130 characters.
							`;
						}
						return true;
					}
				}
			]
		});
	}

	async run(msg, args) {
		const { personalMessage } = args;
		const profile = await UserProfile.findOne({ where: { userID: msg.author.id } });
		if (!profile) {
			return UserProfile.create({
				userID: msg.author.id,
				personalMessage
			}).then(() => msg.reply('your message has been updated!'));
		}

		profile.personalMessage = personalMessage;
		return profile.save().then(() => {
			msg.reply('your message has been updated!');
		});
	}
};

@@ -616,17 +616,25 @@
 %09%09key: '
-m
+personalM
 essage',
@@ -1149,22 +1149,21 @@
 e) %7B%0A%09%09%09
-return
+await
  UserPro
@@ -1228,27 +1228,27 @@
 ge%0A%09%09%09%7D)
-.then(() =%3E
+;%0A%09%09%09return
  msg.rep
@@ -1283,17 +1283,16 @@
 dated!')
-)
 ;%0A%09%09%7D%0A%0A%09
@@ -1337,22 +1337,21 @@
 sage;%0A%09%09
-return
+await
  profile
@@ -1361,25 +1361,19 @@
 ve()
-.then(() =%3E %7B%0A%09%09%09
+;%0A%09%09return 
 msg.
@@ -1413,20 +1413,14 @@
 ted!');%0A
-%09%09%7D);%0A
 %09%7D%0A%7D;%0A

Fix personal message