<commit_before>const Canvas = require('canvas');
const { Command } = require('discord.js-commando');
const Experience = require('../../currency/Experience');
const fs = global.Promise.promisifyAll(require('fs'));
const path = require('path');
const request = require('request-promise');

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

module.exports = class ProfileCommand extends Command {
	constructor(client) {
		super(client, {
			name: 'profile',
			aliases: ['p'],
			group: 'social',
			memberName: 'profile',
			description: 'Display your profile.',
			guildOnly: true,
			throttling: {
				usages: 1,
				duration: 60
			},

			args: [
				{
					key: 'member',
					prompt: 'What user profile would you like to see?\n',
					type: 'member',
					default: ''
				}
			]
		});
	}

	async run(msg, args) {
		const user = args.member || msg.member;
		const Image = Canvas.Image;

		const profile = await UserProfile.findOne({ where: { userID: user.id } });
		const personalMessage = profile.personalMessage;
		const balance = await Currency.getBalance(user.id);
		const currentExp = await Experience.getCurrentExperience(user.id);
		const level = await Experience.getLevel(user.id);
		const levelBounds = await Experience.getLevelBounds(level);
		const totalExp = await Experience.getTotalExperience(user.id);

		const fillValue = Math.min(Math.max(currentExp / (levelBounds.upperBound - levelBounds.lowerBound), 0), 1);

		Canvas.registerFont(path.join(__dirname, '../../assets/profile/fonts/Roboto.ttf'), { family: 'Roboto' });
		Canvas.registerFont(path.join(__dirname, '../../assets/profile/fonts/NotoEmoji-Regular.ttf'), { family: 'Roboto' });

		const canvas = new Canvas(300, 300);
		const ctx = canvas.getContext('2d');

		const lines = this.wrapText(ctx, personalMessage, 110);<commit_msg>Add failsafe just incase<commit_after>const Canvas = require('canvas');
const { Command } = require('discord.js-commando');
const Experience = require('../../currency/Experience');
const fs = global.Promise.promisifyAll(require('fs'));
const path = require('path');
const request = require('request-promise');

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

module.exports = class ProfileCommand extends Command {
	constructor(client) {
		super(client, {
			name: 'profile',
			aliases: ['p'],
			group: 'social',
			memberName: 'profile',
			description: 'Display your profile.',
			guildOnly: true,
			throttling: {
				usages: 1,
				duration: 60
			},

			args: [
				{
					key: 'member',
					prompt: 'What user profile would you like to see?\n',
					type: 'member',
					default: ''
				}
			]
		});
	}

	async run(msg, args) {
		const user = args.member || msg.member;
		const Image = Canvas.Image;

		const profile = await UserProfile.findOne({ where: { userID: user.id } });
		const personalMessage = profile.personalMessage || '';
		const balance = await Currency.getBalance(user.id);
		const currentExp = await Experience.getCurrentExperience(user.id);
		const level = await Experience.getLevel(user.id);
		const levelBounds = await Experience.getLevelBounds(level);
		const totalExp = await Experience.getTotalExperience(user.id);

		const fillValue = Math.min(Math.max(currentExp / (levelBounds.upperBound - levelBounds.lowerBound), 0), 1);

		Canvas.registerFont(path.join(__dirname, '../../assets/profile/fonts/Roboto.ttf'), { family: 'Roboto' });
		Canvas.registerFont(path.join(__dirname, '../../assets/profile/fonts/NotoEmoji-Regular.ttf'), { family: 'Roboto' });

		const canvas = new Canvas(300, 300);
		const ctx = canvas.getContext('2d');

		const lines = this.wrapText(ctx, personalMessage, 110);
{'fraction_non_alphanumeric': 0.15682119205298015, 'fraction_numerical': 0.007947019867549669, 'mean_word_length': 4.075268817204301, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4522460', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1134, 'n_words': 268}