huge changes once again
diff --git a/src/commands/mod/viewas.ts b/src/commands/mod/viewas.ts
index 705c04a..b3875a7 100644
--- a/src/commands/mod/viewas.ts
+++ b/src/commands/mod/viewas.ts
@@ -1,8 +1,9 @@
-import Discord, { CategoryChannel, CommandInteraction } from "discord.js";
+import Discord, { CategoryChannel, CommandInteraction, GuildMember, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
+import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import { WrappedCheck } from "jshaiku";
 import getEmojiByName from "../../utils/getEmojiByName.js";
+import pageIndicator from "../../utils/createPageIndicator.js";
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
     builder
@@ -10,8 +11,9 @@
     .setDescription("View the server as a specific member")
     .addUserOption(option => option.setName("member").setDescription("The member to view as").setRequired(true))
 
-const callback = async (interaction: CommandInteraction) => {
-    let channels = []
+const callback = async (interaction: CommandInteraction): Promise<any> => {
+    let channels = [];
+    let m;
     interaction.guild.channels.cache.forEach(channel => {
         if (!channel.parent && channel.type !== "GUILD_CATEGORY") channels.push(channel)
     })
@@ -22,39 +24,83 @@
     )
     let autoSortBelow = ["GUILD_VOICE", "GUILD_STAGE_VOICE"]
     channels = channels.map(c => c.sort((a, b) => {
-        if (autoSortBelow.includes(a.type) && autoSortBelow.includes(b.type)) return a.name.localeCompare(b.name)
-        if (autoSortBelow.includes(a.type)) return -1
-        if (autoSortBelow.includes(b.type)) return 1
+        if (autoSortBelow.includes(a.type) && autoSortBelow.includes(b.type)) return a.position - b.position
+        if (autoSortBelow.includes(a.type)) return 1
+        if (autoSortBelow.includes(b.type)) return -1
         return a.position - b.position
     }))
+    // Sort all arrays by the position of the first channels parent position
+    channels = channels.sort((a, b) => {
+        if (!a[0].parent) return -1
+        if (!b[0].parent) return 1
+        return a[0].parent.position - b[0].parent.position
+    })
     let member = interaction.options.getMember("member") as Discord.GuildMember
-    await interaction.reply({embeds: [new generateEmojiEmbed()
+    m = await interaction.reply({embeds: [new EmojiEmbed()
         .setEmoji("MEMBER.JOIN")
         .setTitle("Viewing as " + member.displayName)
         .setStatus("Success")
-    ], ephemeral: true})
+    ], ephemeral: true, fetchReply: true})
     let page = 0;
     while (true) {
-        await interaction.editReply({embeds: [new generateEmojiEmbed()
+        m = await interaction.editReply({embeds: [new EmojiEmbed()
             .setEmoji("MEMBER.JOIN")
             .setTitle("Viewing as " + member.displayName)
             .setStatus("Success")
             .setDescription(
-                `${channels[page][0].parent ? channels[page][0].parent.name  : "Uncategorised"}` +
-                "Visible:\n" +
+                `**${channels[page][0].parent ? channels[page][0].parent.name  : "Uncategorised"}**` + "\n" +
                 channels[page].map(c => {
-                    console.log(c)
-                    return (channels[page] as Discord.GuildChannel).permissionsFor(member).has("VIEW_CHANNEL") ?
-                        `${getEmojiByName("ICONS.CHANNEL." + c.type)} ${c.name}\n` : ""
-                }).join("")
+                    let channelType = c.type
+                    if (interaction.guild.rulesChannelId == c.id) channelType = "RULES"
+                    else if ("nsfw" in c && c.nsfw) channelType += "_NSFW"
+                    return c.permissionsFor(member).has("VIEW_CHANNEL") ? (
+                        `${getEmojiByName("ICONS.CHANNEL." + channelType)} ${c.name}\n` + (() => {
+                            if ("threads" in c && c.threads.cache.size > 0) {
+                                return c.threads.cache.map(t => ` ${
+                                    getEmojiByName("ICONS.CHANNEL.THREAD_PIPE") + " " +
+                                    getEmojiByName("ICONS.CHANNEL.THREAD_CHANNEL")} ${t.name}`).join("\n") + "\n"
+                            }return ""
+                        })()) : ""
+                }).join("") + "\n" + pageIndicator(channels.length, page)
             )
+        ], components: [
+            new MessageActionRow().addComponents([new MessageSelectMenu().setOptions(channels.map((c, index) => ({
+                label: c[0].parent ? c[0].parent.name : "Uncategorised",
+                value: index.toString(),
+                default: page === index
+            }))).setCustomId("select").setMaxValues(1).setMinValues(1).setPlaceholder("Select a category")]),
+            new MessageActionRow().addComponents([
+                new MessageButton()
+                    .setLabel(page === 0 ? "" : (channels[page - 1][0].parent ? channels[page - 1][0].parent.name : "Uncategorised"))
+                    .setDisabled(page === 0)
+                    .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                    .setStyle("PRIMARY")
+                    .setCustomId("previous"),
+                new MessageButton()
+                    .setLabel(page === channels.length - 1 ? "" : (channels[page + 1][0].parent ? channels[page + 1][0].parent.name : "Uncategorised"))
+                    .setDisabled(page === channels.length - 1)
+                    .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+                    .setStyle("PRIMARY")
+                    .setCustomId("next")
+            ])
         ]})
-        break
+        let i;
+        try {
+            i = await m.awaitMessageComponent({ time: 300000 });
+        } catch (e) { return }
+        i.deferUpdate()
+        if (i.customId === "next") { page++; }
+        else if (i.customId === "previous") { page--; }
+        else if (i.customId === "select") { page = parseInt(i.values[0]); }
     }
 }
 
+
 const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
-    return true;
+    return true // FIXME FOR RELEASE
+    let member = (interaction.member as GuildMember)
+    if (! member.permissions.has("MANAGE_ROLES")) throw "You do not have the Manage roles permission";
+    return true
 }
 
 export { command, callback, check };
\ No newline at end of file