diff --git a/src/Unfinished/categorizationTest.ts b/src/Unfinished/categorizationTest.ts
index 763669c..dfe9098 100644
--- a/src/Unfinished/categorizationTest.ts
+++ b/src/Unfinished/categorizationTest.ts
@@ -51,7 +51,6 @@
         let channel: string | GuildChannel;
         if (typeof c === "string") channel = interaction.guild!.channels.cache.get(c as string)!.id;
         else channel = (c[0] as unknown as GuildChannel).id;
-        console.log(channel);
         if (!predicted[channel]) predicted[channel] = [];
         m = await interaction.editReply({
             embeds: [
@@ -139,7 +138,6 @@
         }
         categorized[channel] = selected;
     }
-    console.log(categorized);
 };
 
 const check = () => {
diff --git a/src/commands/nucleus/premium.ts b/src/commands/nucleus/premium.ts
index f544045..67b2be6 100644
--- a/src/commands/nucleus/premium.ts
+++ b/src/commands/nucleus/premium.ts
@@ -94,7 +94,6 @@
             closed = true;
         } else {
             const response = await client.database.premium.removePremium(interaction.user.id, i.values[0]!);
-            console.log(response);
         }
     } while (!closed);
     await interaction.deleteReply();
diff --git a/src/commands/settings/moderation.ts b/src/commands/settings/moderation.ts
index 6ee6e1e..4d850a9 100644
--- a/src/commands/settings/moderation.ts
+++ b/src/commands/settings/moderation.ts
@@ -29,7 +29,6 @@
     while (!timedOut) {
         const config = await client.database.guilds.read(interaction.guild!.id);
         const moderation = config.moderation;
-        console.log(moderation);
         await interaction.editReply({
             embeds: [
                 new EmojiEmbed()
diff --git a/src/commands/settings/tracks.ts b/src/commands/settings/tracks.ts
index b79f54d..e608f31 100644
--- a/src/commands/settings/tracks.ts
+++ b/src/commands/settings/tracks.ts
@@ -472,9 +472,7 @@
                     const newPage = await editTrack(i, m, roles);
                     if (_.isEqual(newPage, defaultTrackData)) break;
                     if (!newPage) break;
-                    console.log(newPage);
                     tracks.push(newPage);
-                    console.log(tracks);
                     page = tracks.length - 1;
                     break;
                 }
diff --git a/src/context/users/userinfo.ts b/src/context/users/userinfo.ts
index 7a75754..9c7433f 100644
--- a/src/context/users/userinfo.ts
+++ b/src/context/users/userinfo.ts
@@ -4,7 +4,6 @@
 const command = new ContextMenuCommandBuilder().setName("User info");
 
 const callback = async (interaction: UserContextMenuCommandInteraction) => {
-    console.log("callback");
     const guild = interaction.guild!;
     let member = interaction.targetMember;
     if (!member) member = await guild.members.fetch(interaction.targetId);
@@ -12,7 +11,6 @@
 };
 
 const check = async (_interaction: UserContextMenuCommandInteraction) => {
-    console.log("check");
     return true;
 };
 
diff --git a/src/reflex/scanners.ts b/src/reflex/scanners.ts
index 1b9d740..6d3fc71 100644
--- a/src/reflex/scanners.ts
+++ b/src/reflex/scanners.ts
@@ -52,7 +52,6 @@
 
     const predictions = (await nsfw_model.classify(img, 1))[0]!;
     img.dispose();
-    console.log(2, predictions);
 
     const nsfw = predictions.className === "Hentai" || predictions.className === "Porn";
     await client.database.scanCache.write(hash, "nsfw", nsfw);
@@ -204,7 +203,6 @@
         oem: 1,
         psm: 3
     });
-    console.log(text);
     return text;
 }
 
diff --git a/src/utils/database.ts b/src/utils/database.ts
index 5386f7f..3121d06 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -268,7 +268,6 @@
             .replace(/=/g, "")
             .replace(/\//g, "_")
             .replace(/\+/g, "-");
-        console.log(iv);
         for (const message of transcript.messages) {
             if (message.content) {
                 const encCipher = crypto.createCipheriv("AES-256-CBC", key, iv);
@@ -337,10 +336,8 @@
     }
 
     async read(code: string, key: string, iv: string) {
-        console.log("Transcript read");
         let doc: TranscriptSchema | null = await this.transcripts.findOne({ code: code });
         let findDoc: findDocSchema | null = null;
-        console.log(doc);
         if (!doc) findDoc = await this.messageToTranscript.findOne({ transcript: code });
         if (findDoc) {
             const message = await (
@@ -366,7 +363,6 @@
             if (!data) return null;
             doc = JSON.parse(Buffer.from(data).toString()) as TranscriptSchema;
         }
-        console.log(doc);
         if (!doc) return null;
         for (const message of doc.messages) {
             if (message.content) {
diff --git a/src/utils/log.ts b/src/utils/log.ts
index 8c8c0c9..3b6048a 100644
--- a/src/utils/log.ts
+++ b/src/utils/log.ts
@@ -99,9 +99,7 @@
     },
     async log(log: LoggerOptions): Promise<void> {
         if (!(await isLogging(log.hidden.guild, log.meta.calculateType))) return;
-        console.log(log.hidden.guild);
         const config = await client.database.guilds.read(log.hidden.guild);
-        console.log(config.logging.logs.channel);
 
         if (config.logging.logs.channel) {
             const channel = (await client.channels.fetch(config.logging.logs.channel)) as Discord.TextChannel | null;
