changes
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index 854f38f..ef0a7db 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -91,7 +91,7 @@
], ephemeral: true, fetchReply: true})
let component;
try {
- component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 2.5 * 60 * 1000});
+ component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
} catch { return }
component.deferUpdate();
if (component.customId == "cancel") return interaction.editReply({embeds: [new generateEmojiEmbed()
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index 8e6762e..c6a44b3 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -99,7 +99,7 @@
})
let component;
try {
- component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 2.5 * 60 * 1000});
+ component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
} catch (e) { break; }
component.deferUpdate();
if (component.customId === "done") break;
@@ -177,7 +177,7 @@
])]})
let component;
try {
- component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 2.5 * 60 * 1000});
+ component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
} catch {}
if (component && component.customId === "download") {
interaction.editReply({embeds: [new generateEmojiEmbed()
@@ -276,7 +276,7 @@
])]})
let component;
try {
- component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 2.5 * 60 * 1000});
+ component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
} catch {}
if (component && component.customId === "download") {
interaction.editReply({embeds: [new generateEmojiEmbed()
diff --git a/src/commands/mod/unban.ts b/src/commands/mod/unban.ts
index f201142..f7bf74f 100644
--- a/src/commands/mod/unban.ts
+++ b/src/commands/mod/unban.ts
@@ -11,7 +11,7 @@
.setDescription("Unbans a user")
.addStringOption(option => option.setName("user").setDescription("The user to unban (Username or ID)").setRequired(true))
-const callback = async (interaction: CommandInteraction) => { // TODO: User search UI
+const callback = async (interaction: CommandInteraction) => {
let bans = await interaction.guild.bans.fetch()
let user = interaction.options.getString("user")
let resolved = bans.find(ban => ban.user.id == user)
diff --git a/src/commands/mod/viewas.ts b/src/commands/mod/viewas.ts
index 5f7c7de..705c04a 100644
--- a/src/commands/mod/viewas.ts
+++ b/src/commands/mod/viewas.ts
@@ -1,6 +1,8 @@
-import { CategoryChannel, CommandInteraction } from "discord.js";
+import Discord, { CategoryChannel, CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
import { WrappedCheck } from "jshaiku";
+import getEmojiByName from "../../utils/getEmojiByName.js";
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
@@ -8,11 +10,47 @@
.setDescription("View the server as a specific member")
.addUserOption(option => option.setName("member").setDescription("The member to view as").setRequired(true))
-const callback = (interaction: CommandInteraction) => {
- let channels = interaction.guild.channels.cache
+const callback = async (interaction: CommandInteraction) => {
+ let channels = []
+ interaction.guild.channels.cache.forEach(channel => {
+ if (!channel.parent && channel.type !== "GUILD_CATEGORY") channels.push(channel)
+ })
+ channels = [channels]
+ channels = channels.concat(interaction.guild.channels.cache
.filter(c => c.type === "GUILD_CATEGORY")
.map(c => (c as CategoryChannel).children.map(c => c))
- console.log(channels)
+ )
+ 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
+ return a.position - b.position
+ }))
+ let member = interaction.options.getMember("member") as Discord.GuildMember
+ await interaction.reply({embeds: [new generateEmojiEmbed()
+ .setEmoji("MEMBER.JOIN")
+ .setTitle("Viewing as " + member.displayName)
+ .setStatus("Success")
+ ], ephemeral: true})
+ let page = 0;
+ while (true) {
+ await interaction.editReply({embeds: [new generateEmojiEmbed()
+ .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].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("")
+ )
+ ]})
+ break
+ }
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 46e2871..bd4bcff 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -109,7 +109,7 @@
})
let component;
try {
- component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 2.5 * 60 * 1000});
+ component = await (m as Discord.Message).awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
} catch (e) {
return await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji(`PUNISH.WARN.GREEN`)