diff --git a/src/context/messages/purgeto.ts b/src/context/messages/purgeto.ts
index 02d5d2a..aef159b 100644
--- a/src/context/messages/purgeto.ts
+++ b/src/context/messages/purgeto.ts
@@ -1,10 +1,8 @@
 import confirmationMessage from '../../utils/confirmationMessage.js';
 import EmojiEmbed from '../../utils/generateEmojiEmbed.js';
 import { LoadingEmbed } from '../../utils/defaults.js';
-import Discord, { ActionRowBuilder, ButtonBuilder, ButtonStyle, ContextMenuCommandBuilder, GuildTextBasedChannel, Message, MessageContextMenuCommandInteraction } from "discord.js";
+import Discord, { ActionRowBuilder, ButtonBuilder, ButtonStyle, ContextMenuCommandBuilder, GuildMember, GuildTextBasedChannel, Message, MessageContextMenuCommandInteraction } from "discord.js";
 import client from "../../utils/client.js";
-import getEmojiByName from '../../utils/getEmojiByName.js';
-import { JSONTranscriptFromMessageArray, JSONTranscriptToHumanReadable } from "../../utils/logTranscripts.js";
 import { messageException } from '../../utils/createTemporaryStorage.js';
 
 const command = new ContextMenuCommandBuilder()
@@ -187,13 +185,16 @@
     log(data);
     const messages: Message[] = deleted.map(m => m).filter(m => m instanceof Message).map(m => m as Message);
     if (messages.length === 1) messageException(interaction.guild!.id, interaction.channel.id, messages[0]!.id)
-    const transcript = JSONTranscriptToHumanReadable(JSONTranscriptFromMessageArray(messages)!);
-    const attachmentObject = {
-        attachment: Buffer.from(transcript),
-        name: `purge-${channel.id}-${Date.now()}.txt`,
-        description: "Purge log"
-    };
-    const m = (await interaction.editReply({
+    const messageArray: Message[] = messages.filter(message => !(
+        message!.components.some(
+            component => component.components.some(
+                child => child.customId?.includes("transcript") ?? false
+            )
+        )
+    )).map(message => message as Message);
+    const transcript = await client.database.transcripts.createTranscript(messageArray, interaction, interaction.member as GuildMember);
+    const code = await client.database.transcripts.create(transcript);
+    await interaction.editReply({
         embeds: [
             new EmojiEmbed()
                 .setEmoji("CHANNEL.PURGE.GREEN")
@@ -203,47 +204,10 @@
         ],
         components: [
             new Discord.ActionRowBuilder<ButtonBuilder>().addComponents([
-                new Discord.ButtonBuilder()
-                    .setCustomId("download")
-                    .setLabel("Download transcript")
-                    .setStyle(ButtonStyle.Success)
-                    .setEmoji(getEmojiByName("CONTROL.DOWNLOAD", "id"))
+                new ButtonBuilder().setLabel("View").setStyle(ButtonStyle.Link).setURL(`https://clicks.codes/nucleus/transcript?code=${code}`),
             ])
         ]
-    })) as Discord.Message;
-    let component;
-    try {
-        component = await m.awaitMessageComponent({
-            filter: (i) => i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id && i.id === m.id,
-            time: 300000
-        });
-    } catch {
-        return;
-    }
-    if (component.customId === "download") {
-        interaction.editReply({
-            embeds: [
-                new EmojiEmbed()
-                    .setEmoji("CHANNEL.PURGE.GREEN")
-                    .setTitle("Purge")
-                    .setDescription("Transcript uploaded above")
-                    .setStatus("Success")
-            ],
-            components: [],
-            files: [attachmentObject]
-        });
-    } else {
-        interaction.editReply({
-            embeds: [
-                new EmojiEmbed()
-                    .setEmoji("CHANNEL.PURGE.GREEN")
-                    .setTitle("Purge")
-                    .setDescription("Messages cleared")
-                    .setStatus("Success")
-            ],
-            components: []
-        });
-    }
+    });
 }
 
 const check = async (_interaction: MessageContextMenuCommandInteraction) => {
