diff --git a/src/commands/settings/logs/channel.ts b/src/commands/settings/logs/channel.ts
index 448f26a..19a389b 100644
--- a/src/commands/settings/logs/channel.ts
+++ b/src/commands/settings/logs/channel.ts
@@ -1,6 +1,6 @@
 import { ChannelType } from 'discord-api-types';
 import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
-import generateEmojiEmbed from "../../../utils/generateEmojiEmbed.js";
+import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
 import confirmationMessage from "../../../utils/confirmationMessage.js";
 import getEmojiByName from "../../../utils/getEmojiByName.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
@@ -17,7 +17,7 @@
 
 const callback = async (interaction: CommandInteraction): Promise<any> => {
     let m;
-    m = await interaction.reply({embeds: [new generateEmojiEmbed()
+    m = await interaction.reply({embeds: [new EmojiEmbed()
         .setTitle("Loading")
         .setStatus("Danger")
         .setEmoji("NUCLEUS.LOADING")
@@ -27,7 +27,7 @@
         try {
             channel = interaction.options.getChannel("channel")
         } catch {
-            return await interaction.editReply({embeds: [new generateEmojiEmbed()
+            return await interaction.editReply({embeds: [new EmojiEmbed()
                 .setEmoji("CHANNEL.TEXT.DELETE")
                 .setTitle("Log Channel")
                 .setDescription("The channel you provided is not a valid channel")
@@ -36,7 +36,7 @@
         }
         channel = channel as Discord.TextChannel
         if (channel.guild.id != interaction.guild.id) {
-            return interaction.editReply({embeds: [new generateEmojiEmbed()
+            return interaction.editReply({embeds: [new EmojiEmbed()
                 .setTitle("Log Channel")
                 .setDescription(`You must choose a channel in this server`)
                 .setStatus("Danger")
@@ -52,10 +52,10 @@
         .send(true)
         if (confirmation.success) {
             try {
-                await client.database.write(interaction.guild.id, {"logging.logs.channel": channel.id})
+                await client.database.guilds.write(interaction.guild.id, {"logging.logs.channel": channel.id})
             } catch (e) {
                 console.log(e)
-                return interaction.editReply({embeds: [new generateEmojiEmbed()
+                return interaction.editReply({embeds: [new EmojiEmbed()
                     .setTitle("Log Channel")
                     .setDescription(`Something went wrong and the log channel could not be set`)
                     .setStatus("Danger")
@@ -63,7 +63,7 @@
                 ], components: []});
             }
         } else {
-            return interaction.editReply({embeds: [new generateEmojiEmbed()
+            return interaction.editReply({embeds: [new EmojiEmbed()
                 .setTitle("Log Channel")
                 .setDescription(`No changes were made`)
                 .setStatus("Success")
@@ -72,10 +72,10 @@
         }
     }
     let clicks = 0;
-    let data = await client.database.read(interaction.guild.id);
+    let data = await client.database.guilds.read(interaction.guild.id);
     let channel = data.logging.logs.channel;
     while (true) {
-        await interaction.editReply({embeds: [new generateEmojiEmbed()
+        await interaction.editReply({embeds: [new EmojiEmbed()
             .setTitle("Log channel")
             .setDescription(channel ? `Your log channel is currently set to <#${channel}>` : "This server does not have a log channel")
             .setStatus("Success")
@@ -96,14 +96,14 @@
             clicks += 1;
             if (clicks == 2) {
                 clicks = 0;
-                await client.database.write(interaction.guild.id, {}, ["logging.logs.channel"])
+                await client.database.guilds.write(interaction.guild.id, {}, ["logging.logs.channel"])
                 channel = undefined;
             }
         } else {
             break
         }
     }
-    await interaction.editReply({embeds: [new generateEmojiEmbed()
+    await interaction.editReply({embeds: [new EmojiEmbed()
         .setTitle("Log channel")
         .setDescription(channel ? `Your log channel is currently set to <#${channel}>` : "This server does not have a log channel")
         .setStatus("Success")
