diff --git a/src/commands/mod/about.ts b/src/commands/mod/about.ts
index fc656ff..7849dc6 100644
--- a/src/commands/mod/about.ts
+++ b/src/commands/mod/about.ts
@@ -1,5 +1,5 @@
 import { LoadingEmbed } from "../../utils/defaults.js";
-import type { HistorySchema } from "../../utils/database.js";
+import type { HistorySchema, FlagColors } from "../../utils/database.js";
 import Discord, {
     CommandInteraction,
     GuildMember,
@@ -10,7 +10,10 @@
     ButtonStyle,
     TextInputStyle,
     APIMessageComponentEmoji,
-    SlashCommandSubcommandBuilder
+    SlashCommandSubcommandBuilder,
+    StringSelectMenuBuilder,
+    StringSelectMenuOptionBuilder,
+    ContextMenuCommandInteraction
 } from "discord.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -326,35 +329,38 @@
     return timedOut ? 0 : 1;
 }
 
-const callback = async (interaction: CommandInteraction): Promise<unknown> => {
+export const noteMenu = async (member: GuildMember, interaction: CommandInteraction | ContextMenuCommandInteraction): Promise<unknown> => {
     let m: Message;
-    const member = interaction.options.getMember("user") as Discord.GuildMember;
     await interaction.reply({
         embeds: LoadingEmbed,
         ephemeral: true,
         fetchReply: true
     });
     let note;
-    let firstLoad = true;
     let timedOut = false;
     while (!timedOut) {
         note = await client.database.notes.read(member.guild.id, member.id);
-        if (firstLoad && !note) {
-            await showHistory(member, interaction);
+        const colors: Record<string, Discord.ColorResolvable> = {
+            none: "#424242",
+            red: "#F27878",
+            yellow: "#EDC575",
+            green: "#68D49E",
+            blue: "#6576CC",
+            purple: "#D46899",
+            gray: "#C4C4C4"
         }
-        firstLoad = false;
         m = (await interaction.editReply({
             embeds: [
                 new EmojiEmbed()
-                    .setEmoji("MEMBER.JOIN")
+                    .setEmoji(`ICONS.FLAGS.${(note?.flag ?? "none").toUpperCase()}`)
                     .setTitle("Mod notes for " + member.user.username)
-                    .setDescription(note ? note : "*No note set*")
-                    .setStatus("Success")
+                    .setDescription(note?.note ? note.note : "*No note set*")
+                    .setColor(colors[note?.flag ?? "none"]!)
             ],
             components: [
                 new ActionRowBuilder<Discord.ButtonBuilder>().addComponents([
                     new ButtonBuilder()
-                        .setLabel(`${note ? "Modify" : "Create"} note`)
+                        .setLabel(`${note?.note ? "Modify" : "Create"} note`)
                         .setStyle(ButtonStyle.Primary)
                         .setCustomId("modify")
                         .setEmoji(getEmojiByName("ICONS.EDIT", "id")),
@@ -363,6 +369,49 @@
                         .setStyle(ButtonStyle.Primary)
                         .setCustomId("history")
                         .setEmoji(getEmojiByName("ICONS.HISTORY", "id"))
+                ]),
+                new ActionRowBuilder<Discord.StringSelectMenuBuilder>().addComponents([
+                    new StringSelectMenuBuilder()
+                        .setCustomId("flag")
+                        .setPlaceholder("Select a flag")
+                        .addOptions(
+                            new StringSelectMenuOptionBuilder()
+                                .setLabel("None")
+                                .setDefault(!note?.flag)
+                                .setValue("none")
+                                .setDescription("Clear")
+                                .setEmoji(getEmojiByName("ICONS.FLAGS.NONE", "id")),
+                            new StringSelectMenuOptionBuilder()
+                                .setLabel("Red")
+                                .setDefault(note?.flag === "red")
+                                .setValue("red")
+                                .setEmoji(getEmojiByName("ICONS.FLAGS.RED", "id")),
+                            new StringSelectMenuOptionBuilder()
+                                .setLabel("Yellow")
+                                .setDefault(note?.flag === "yellow")
+                                .setValue("yellow")
+                                .setEmoji(getEmojiByName("ICONS.FLAGS.YELLOW", "id")),
+                            new StringSelectMenuOptionBuilder()
+                                .setLabel("Green")
+                                .setDefault(note?.flag === "green")
+                                .setValue("green")
+                                .setEmoji(getEmojiByName("ICONS.FLAGS.GREEN", "id")),
+                            new StringSelectMenuOptionBuilder()
+                                .setLabel("Blue")
+                                .setDefault(note?.flag === "blue")
+                                .setValue("blue")
+                                .setEmoji(getEmojiByName("ICONS.FLAGS.BLUE", "id")),
+                            new StringSelectMenuOptionBuilder()
+                                .setLabel("Purple")
+                                .setDefault(note?.flag === "purple")
+                                .setValue("purple")
+                                .setEmoji(getEmojiByName("ICONS.FLAGS.PURPLE", "id")),
+                            new StringSelectMenuOptionBuilder()
+                                .setLabel("Gray")
+                                .setDefault(note?.flag === "gray")
+                                .setValue("gray")
+                                .setEmoji(getEmojiByName("ICONS.FLAGS.GRAY", "id")),
+                        )
                 ])
             ]
         })) as Message;
@@ -382,60 +431,73 @@
             timedOut = true;
             continue;
         }
-        if (i.customId === "modify") {
-            await i.showModal(
-                new Discord.ModalBuilder()
-                    .setCustomId("modal")
-                    .setTitle("Editing moderator note")
-                    .addComponents(
-                        new ActionRowBuilder<Discord.TextInputBuilder>().addComponents(
-                            new Discord.TextInputBuilder()
-                                .setCustomId("note")
-                                .setLabel("Note")
-                                .setMaxLength(4000)
-                                .setRequired(false)
-                                .setStyle(TextInputStyle.Paragraph)
-                                .setValue(note ? note : " ")
+        if (i.isButton()) {
+
+            if (i.customId === "modify") {
+                await i.showModal(
+                    new Discord.ModalBuilder()
+                        .setCustomId("modal")
+                        .setTitle("Editing moderator note")
+                        .addComponents(
+                            new ActionRowBuilder<Discord.TextInputBuilder>().addComponents(
+                                new Discord.TextInputBuilder()
+                                    .setCustomId("note")
+                                    .setLabel("Note")
+                                    .setMaxLength(4000)
+                                    .setRequired(false)
+                                    .setStyle(TextInputStyle.Paragraph)
+                                    .setValue(note?.note ? note.note : " ")
+                            )
                         )
-                    )
-            );
-            await interaction.editReply({
-                embeds: [
-                    new EmojiEmbed()
-                        .setTitle("Mod notes for " + member.user.username)
-                        .setDescription("Modal opened. If you can't see it, click back and try again.")
-                        .setStatus("Success")
-                        .setEmoji("GUILD.TICKET.OPEN")
-                ],
-                components: [
-                    new ActionRowBuilder<Discord.ButtonBuilder>().addComponents([
-                        new ButtonBuilder()
-                            .setLabel("Back")
-                            .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
-                            .setStyle(ButtonStyle.Primary)
-                            .setCustomId("back")
-                    ])
-                ]
-            });
-            let out;
-            try {
-                out = await modalInteractionCollector(m, interaction.user);
-            } catch (e) {
-                timedOut = true;
-                continue;
+                );
+                await interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Mod notes for " + member.user.username)
+                            .setDescription("Modal opened. If you can't see it, click back and try again.")
+                            .setStatus("Success")
+                            .setEmoji("GUILD.TICKET.OPEN")
+                    ],
+                    components: [
+                        new ActionRowBuilder<Discord.ButtonBuilder>().addComponents([
+                            new ButtonBuilder()
+                                .setLabel("Back")
+                                .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                                .setStyle(ButtonStyle.Primary)
+                                .setCustomId("back")
+                        ])
+                    ]
+                });
+                let out;
+                try {
+                    out = await modalInteractionCollector(m, interaction.user);
+                } catch (e) {
+                    timedOut = true;
+                    continue;
+                }
+                if (out === null || out.isButton()) {
+                    continue;
+                } else {
+                    let toAdd = out.fields.getTextInputValue("note").trim() || null;
+                    if (toAdd === "") toAdd = null;
+                    await client.database.notes.create(member.guild.id, member.id, toAdd);
+                }
+            } else if (i.customId === "history") {
+                await i.deferUpdate();
+                if (!(await showHistory(member, interaction))) return;
             }
-            if (out === null || out.isButton()) {
-                continue;
-            } else {
-                let toAdd = out.fields.getTextInputValue("note").trim() || null;
-                if (toAdd === "") toAdd = null;
-                await client.database.notes.create(member.guild.id, member.id, toAdd);
-            }
-        } else if (i.customId === "history") {
+        } else if (i.isStringSelectMenu()) {
             await i.deferUpdate();
-            if (!(await showHistory(member, interaction))) return;
+            let flag: string | null = i.values[0]!;
+            if (flag === "none") flag = null;
+            await client.database.notes.flag(member.guild.id, member.id, flag as FlagColors | null);
         }
     }
+}
+
+const callback = async (interaction: CommandInteraction): Promise<void> => {
+    const member = interaction.options.getMember("user") as Discord.GuildMember;
+    await noteMenu(member, interaction);
 };
 
 const check = (interaction: CommandInteraction) => {
diff --git a/src/config/emojis.ts b/src/config/emojis.ts
index b7ed91a..b04c569 100644
--- a/src/config/emojis.ts
+++ b/src/config/emojis.ts
@@ -51,6 +51,7 @@
             CATEGORY: "1064943289708597348"
         },
         FLAGS: {
+            NONE: "1099782406417940520",
             RED: "1082719687219101800",
             YELLOW: "1082719684060794890",
             GREEN: "1082719681326108763",
diff --git a/src/context/users/flaguser.ts b/src/context/users/flaguser.ts
new file mode 100644
index 0000000..958274f
--- /dev/null
+++ b/src/context/users/flaguser.ts
@@ -0,0 +1,17 @@
+import { ContextMenuCommandBuilder, GuildMember, PermissionFlagsBits, UserContextMenuCommandInteraction } from "discord.js";
+import { noteMenu } from "../../commands/mod/about.js";
+
+const command = new ContextMenuCommandBuilder().setName("Flag User").setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages);
+
+const callback = async (interaction: UserContextMenuCommandInteraction) => {
+    const guild = interaction.guild!;
+    let member = interaction.targetMember as GuildMember | null;
+    if (!member) member = await guild.members.fetch(interaction.targetId);
+    await noteMenu(member, interaction);
+};
+
+const check = async (_interaction: UserContextMenuCommandInteraction) => {
+    return true;
+};
+
+export { command, callback, check };
diff --git a/src/context/users/userinfo.ts b/src/context/users/userinfo.ts
index b215685..e6af836 100644
--- a/src/context/users/userinfo.ts
+++ b/src/context/users/userinfo.ts
@@ -4,13 +4,10 @@
 const command = new ContextMenuCommandBuilder().setName("User info");
 
 const callback = async (interaction: UserContextMenuCommandInteraction) => {
-    try {
-        console.log("getting user info")
-        const guild = interaction.guild!;
-        let member = interaction.targetMember as GuildMember | null;
-        if (!member) member = await guild.members.fetch(interaction.targetId);
-        await userAbout(guild, member as GuildMember, interaction);
-    } catch (e) { console.log(e) }
+    const guild = interaction.guild!;
+    let member = interaction.targetMember as GuildMember | null;
+    if (!member) member = await guild.members.fetch(interaction.targetId);
+    await userAbout(guild, member as GuildMember, interaction);
 };
 
 const check = async (_interaction: UserContextMenuCommandInteraction) => {
diff --git a/src/utils/commandRegistration/register.ts b/src/utils/commandRegistration/register.ts
index 6b7c225..5889d54 100644
--- a/src/utils/commandRegistration/register.ts
+++ b/src/utils/commandRegistration/register.ts
@@ -187,15 +187,11 @@
     client.on("interactionCreate", async (interaction: Interaction) => {
         if (interaction.isUserContextMenuCommand()) {
             const commandName = "contextCommands/user/" + interaction.commandName;
-            console.log("trying " + commandName)
-            try {
-                console.log(client.commands[commandName])
-                await execute(
-                    client.commands[commandName]![0]?.check,
-                    client.commands[commandName]![0]?.callback,
-                    interaction
-                );
-            } catch (e) { console.log(e) }
+            await execute(
+                client.commands[commandName]![0]?.check,
+                client.commands[commandName]![0]?.callback,
+                interaction
+            );
             return;
         } else if (interaction.isMessageContextMenuCommand()) {
             const commandName = "contextCommands/message/" + interaction.commandName;
diff --git a/src/utils/database.ts b/src/utils/database.ts
index dd768a3..77ff875 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -696,18 +696,25 @@
         this.modNotes = database.collection<ModNoteSchema>("modNotes");
     }
 
+    async flag(guild: string, user: string, flag: FlagColors | null) {
+        const modNote = await this.modNotes.findOne({ guild: guild, user: user });
+        modNote
+            ? await this.modNotes.updateOne({ guild: guild, user: user }, { $set: { flag: flag } }, collectionOptions)
+            : await this.modNotes.insertOne({ guild: guild, user: user, note: null, flag: flag }, collectionOptions);
+    }
+
     async create(guild: string, user: string, note: string | null) {
         // console.log("ModNotes create");
         const modNote = await this.modNotes.findOne({ guild: guild, user: user });
         modNote
             ? await this.modNotes.updateOne({ guild: guild, user: user }, { $set: { note: note } }, collectionOptions)
-            : await this.modNotes.insertOne({ guild: guild, user: user, note: note }, collectionOptions);
+            : await this.modNotes.insertOne({ guild: guild, user: user, note: note, flag: null }, collectionOptions);
     }
 
     async read(guild: string, user: string) {
         // console.log("ModNotes read");
         const entry = await this.modNotes.findOne({ guild: guild, user: user });
-        return entry?.note ?? null;
+        return entry ?? null;
     }
 
     async delete(guild: string) {
@@ -1036,10 +1043,13 @@
     amount: string | null;
 }
 
+export type FlagColors = "red" | "yellow" | "green" | "blue" | "purple" | "gray";
+
 export interface ModNoteSchema {
     guild: string;
     user: string;
     note: string | null;
+    flag: FlagColors | null;
 }
 
 export interface PremiumSchema {
