diff --git a/src/premium/attachmentLogs.ts b/src/premium/attachmentLogs.ts
index 3c583f2..b2c8391 100644
--- a/src/premium/attachmentLogs.ts
+++ b/src/premium/attachmentLogs.ts
@@ -8,6 +8,7 @@
 import type { GuildTextBasedChannel, Message } from "discord.js";
 
 export default async function logAttachment(message: Message): Promise<AttachmentLogSchema> {
+    if (message.guild) client.database.premium.hasPremium(message.guild.id).finally(() => {});
     if (!message.guild) throw new Error("Tried to log an attachment in a non-guild message");
     const { renderUser, renderChannel, renderDelta } = client.logger;
     const attachments = [];
diff --git a/src/premium/createTranscript.ts b/src/premium/createTranscript.ts
index 20b790a..85e059f 100644
--- a/src/premium/createTranscript.ts
+++ b/src/premium/createTranscript.ts
@@ -8,83 +8,13 @@
     TextChannel,
     ButtonStyle,
     User,
-    ComponentType,
     ThreadChannel
 } from "discord.js";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../utils/getEmojiByName.js";
-import { PasteClient, Publicity, ExpireDate } from "pastebin-api";
 import client from "../utils/client.js";
 import { messageException } from '../utils/createTemporaryStorage.js';
 
-const pbClient = new PasteClient(client.config.pastebinApiKey);
-
-interface TranscriptEmbed {
-    title?: string;
-    description?: string;
-    fields?: {
-        name: string;
-        value: string;
-        inline: boolean;
-    }[];
-    footer?: {
-        text: string;
-        iconURL?: string;
-    };
-}
-
-interface TranscriptComponent {
-    type: number;
-    style?: ButtonStyle;
-    label?: string;
-    description?: string;
-    placeholder?: string;
-    emojiURL?: string;
-}
-
-interface TranscriptAuthor {
-    username: string;
-    discriminator: number;
-    nickname?: string;
-    id: string;
-    iconURL?: string;
-    topRole: {
-        color: number;
-        badgeURL?: string;
-    }
-}
-
-interface TranscriptAttachment {
-    url: string;
-    filename: string;
-    size: number;
-    log?: string;
-}
-
-interface TranscriptMessage {
-    id: string;
-    author: TranscriptAuthor;
-    content?: string;
-    embeds?: TranscriptEmbed[];
-    components?: TranscriptComponent[][];
-    editedTimestamp?: number;
-    createdTimestamp: number;
-    flags?: string[];
-    attachments?: TranscriptAttachment[];
-    stickerURLs?: string[];
-    referencedMessage?: string | [string, string, string];
-}
-
-interface Transcript {
-    type: "ticket" | "purge"
-    guild: string;
-    channel: string;
-    for: TranscriptAuthor
-    messages: TranscriptMessage[];
-    createdTimestamp: number;
-    createdBy: TranscriptAuthor;
-}
-
 const noTopic = new EmojiEmbed()
     .setTitle("User not found")
     .setDescription("There is no user associated with this ticket.")
@@ -114,175 +44,58 @@
         )
     ));
 
-    let out = "";
-    messages.reverse().forEach((message) => {
-        if (!message.author.bot) {
-            const sentDate = new Date(message.createdTimestamp);
-            out += `${message.author.username}#${message.author.discriminator} (${
-                message.author.id
-            }) [${sentDate.toUTCString()}]\n`;
-            const lines = message.content.split("\n");
-            lines.forEach((line) => {
-                out += `> ${line}\n`;
-            });
-            out += "\n\n";
-        }
-    });
-
-    const interactionMember = await interaction.guild?.members.fetch(interaction.user.id)
-
     let topic
-    let member: GuildMember | null = null;
+    let member: GuildMember = interaction.guild?.members.me!;
     if (interaction.channel instanceof TextChannel) {
         topic = interaction.channel.topic;
         if (topic === null) return await interaction.reply({ embeds: [noTopic] });
-        member = interaction.guild!.members.cache.get(topic.split(" ")[1]!) ?? null;
+        const mem = interaction.guild!.members.cache.get(topic.split(" ")[1]!);
+        if (mem) member = mem;
     } else {
         topic = interaction.channel.name;
         const split = topic.split("-").map(p => p.trim()) as [string, string, string];
-        member = interaction.guild!.members.cache.get(split[1]) ?? null;
-        if (member === null) return await interaction.reply({ embeds: [noTopic] });
+        const mem = interaction.guild!.members.cache.get(split[1])
+        if (mem) member = mem;
     }
 
-
-    const newOut: Transcript = {
-        type: "ticket",
-        for: {
-            username: member!.user.username,
-            discriminator: parseInt(member!.user.discriminator),
-            id: member!.user.id,
-            topRole: {
-                color: member!.roles.highest.color
-            }
-        },
-        guild: interaction.guild!.id,
-        channel: interaction.channel!.id,
-        messages: [],
-        createdTimestamp: Date.now(),
-        createdBy: {
-            username: interaction.user.username,
-            discriminator: parseInt(interaction.user.discriminator),
-            id: interaction.user.id,
-            topRole: {
-                color: interactionMember?.roles.highest.color ?? 0x000000
-            }
-        }
-    }
-    if(interactionMember?.roles.icon) newOut.createdBy.topRole.badgeURL = interactionMember.roles.icon.iconURL()!;
-    messages.reverse().forEach((message) => {
-        const msg: TranscriptMessage = {
-            id: message.id,
-            author: {
-                username: message.author.username,
-                discriminator: parseInt(message.author.discriminator),
-                id: message.author.id,
-                topRole: {
-                    color: message.member!.roles.highest.color
-                }
-            },
-            createdTimestamp: message.createdTimestamp
-        };
-        if (message.member!.roles.icon) msg.author.topRole.badgeURL = message.member!.roles.icon.iconURL()!;
-        if (message.content) msg.content = message.content;
-        if (message.embeds.length > 0) msg.embeds = message.embeds.map(embed => {
-            const obj: TranscriptEmbed = {};
-            if (embed.title) obj.title = embed.title;
-            if (embed.description) obj.description = embed.description;
-            if (embed.fields.length > 0) obj.fields = embed.fields.map(field => {
-                return {
-                    name: field.name,
-                    value: field.value,
-                    inline: field.inline ?? false
-                }
-            });
-            if (embed.footer) obj.footer = {
-                text: embed.footer.text,
-            };
-            if (embed.footer?.iconURL) obj.footer!.iconURL = embed.footer.iconURL;
-            return obj;
-        });
-        if (message.components.length > 0) msg.components = message.components.map(component => component.components.map(child => {
-            const obj: TranscriptComponent = {
-                type: child.type
-            }
-            if (child.type === ComponentType.Button) {
-                obj.style = child.style;
-                obj.label = child.label ?? "";
-            } else if (child.type > 2) {
-                obj.placeholder = child.placeholder ?? "";
-            }
-            return obj
-        }));
-        if (message.editedTimestamp) msg.editedTimestamp = message.editedTimestamp;
-        msg.flags = message.flags.toArray();
-
-        if (message.stickers.size > 0) msg.stickerURLs = message.stickers.map(sticker => sticker.url);
-        if (message.reference) msg.referencedMessage = [message.reference.guildId ?? "", message.reference.channelId, message.reference.messageId ?? ""];
-        newOut.messages.push(msg);
-    });
+    const newOut = await client.database.transcripts.createTranscript(messages, interaction, member);
 
     const code = await client.database.transcripts.create(newOut);
-    if(!code) return await interaction.reply({embeds: [new EmojiEmbed().setTitle("Error").setDescription("An error occurred while creating the transcript.").setStatus("Danger").setEmoji("CONTROL.BLOCKCROSS")]})
-    let m: Message;
-    if (out !== "") {
-        const url = await pbClient.createPaste({
-            code: out,
-            expireDate: ExpireDate.Never,
-            name:
-                `Ticket Transcript ${
-                    member ? "for " + member.user.username + "#" + member.user.discriminator + " " : ""
-                }` + `(Created at ${new Date(interaction.channel.createdTimestamp!).toDateString()})`,
-            publicity: Publicity.Unlisted
-        });
-        const guildConfig = await client.database.guilds.read(interaction.guild!.id);
-        m = (await interaction.reply({
-            embeds: [
-                new EmojiEmbed()
-                    .setTitle("Transcript")
-                    .setDescription(
-                        "You can view the transcript using the link below. You can save the link for later" +
-                            (guildConfig.logging.logs.channel
-                                ? ` or find it in <#${guildConfig.logging.logs.channel}> once you press delete below. After this the channel will be deleted.`
-                                : ".")
-                    )
-                    .setStatus("Success")
-                    .setEmoji("CONTROL.DOWNLOAD")
-            ],
-            components: [
-                new ActionRowBuilder<ButtonBuilder>().addComponents([
-                    new ButtonBuilder().setLabel("View").setStyle(ButtonStyle.Link).setURL(url),
-                    new ButtonBuilder()
-                        .setLabel("Delete")
-                        .setStyle(ButtonStyle.Danger)
-                        .setCustomId("close")
-                        .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-                ])
-            ],
-            fetchReply: true
-        })) as Message;
-    } else {
-        m = (await interaction.reply({
-            embeds: [
-                new EmojiEmbed()
-                    .setTitle("Transcript")
-                    .setDescription(
-                        "The transcript was empty, so no changes were made. To delete this ticket, press the delete button below."
-                    )
-                    .setStatus("Success")
-                    .setEmoji("CONTROL.DOWNLOAD")
-            ],
-            components: [
-                new ActionRowBuilder<ButtonBuilder>().addComponents([
-                    new ButtonBuilder()
-                        .setLabel("Delete")
-                        .setStyle(ButtonStyle.Danger)
-                        .setCustomId("close")
-                        .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-                ])
-            ],
-            fetchReply: true
-        })) as Message;
-    }
+    if(!code) return await interaction.reply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Error")
+                .setDescription("An error occurred while creating the transcript.")
+                .setStatus("Danger")
+                .setEmoji("CONTROL.BLOCKCROSS")
+        ]
+    })
+    const guildConfig = await client.database.guilds.read(interaction.guild!.id);
+    const m: Message = (await interaction.reply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Transcript")
+                .setDescription(
+                    "You can view the transcript using the link below. You can save the link for later" +
+                        (guildConfig.logging.logs.channel
+                            ? ` or find it in <#${guildConfig.logging.logs.channel}> once you press delete below. After this the channel will be deleted.`
+                            : ".")
+                )
+                .setStatus("Success")
+                .setEmoji("CONTROL.DOWNLOAD")
+        ],
+        components: [
+            new ActionRowBuilder<ButtonBuilder>().addComponents([
+                new ButtonBuilder().setLabel("View").setStyle(ButtonStyle.Link).setURL(`https://clicks.codes/nucleus/transcript?code=${code}`),
+                new ButtonBuilder()
+                    .setLabel("Delete")
+                    .setStyle(ButtonStyle.Danger)
+                    .setCustomId("close")
+                    .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+            ])
+        ],
+        fetchReply: true
+    })) as Message;
     let i;
     try {
         i = await m.awaitMessageComponent({
@@ -303,7 +116,7 @@
             timestamp: Date.now()
         },
         list: {
-            ticketFor: member ? entry(member.id, renderUser(member.user)) : entry(null, "*Unknown*"),
+            ticketFor: entry(member.id, renderUser(member.user)),
             deletedBy: entry(interaction.member!.user.id, renderUser(interaction.member!.user as User)),
             deleted: entry(Date.now().toString(), renderDelta(Date.now()))
         },
