text: const ArgumentCommand = require('../classes/argument-command');
  const NoteEntry = require('../classes/note-entry');
  const { getMember } = require('../util/utils');
  const { readMember, writeMember, readConfig } = require('../modules/data-manager');
  const ReadableError = require('../classes/errors/readable-error');
  const logger = require('../modules/logger');
  const { oneLineEmbed } = require('../util/embed-shop');
  
  class NoteCommand extends ArgumentCommand {
      meta = {
          commandName: 'note',
          description: "Places a note on a member's profile",
          aliases: [],
          allowedRoles: [readConfig().adminRoleId, readConfig().moderatorRoleId]
      };
  
      args = {
          memberId: null,
          text: null
      };
  
      async _run() {
          if (!this.args.text) {
              throw new ReadableError("You can't add an empty note");
          }
  
          const member = await getMember(this.dMsg.guild, this.args.memberId);
  
          const by = this.dMsg.author.tag;
  
          const memberProfile = readMember(this.args.memberId);
  
          memberProfile.record.notes.push(new NoteEntry(by, this.args.text));
          memberProfile.tag = member.user.tag;
  
          writeMember(memberProfile);
  
          logger.log(`Updated [${memberProfile.id}] after ${this.meta.commandName} command`);
  
          this.dMsg.channel.send(oneLineEmbed('Note added', 'success'));
      }
  }
  
  module.exports = NoteCommand;
  