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`)
diff --git a/src/commands/settings/logs/channel.ts b/src/commands/settings/logs/channel.ts
index 18ed8d9..448f26a 100644
--- a/src/commands/settings/logs/channel.ts
+++ b/src/commands/settings/logs/channel.ts
@@ -89,7 +89,7 @@
])]});
let i;
try {
- i = await m.awaitMessageComponent({time: 600000});
+ i = await m.awaitMessageComponent({time: 300000});
} catch(e) { break }
i.deferUpdate()
if (i.component.customId == "clear") {
diff --git a/src/commands/settings/staff/channel.ts b/src/commands/settings/staff/channel.ts
index 69ace92..354d7f1 100644
--- a/src/commands/settings/staff/channel.ts
+++ b/src/commands/settings/staff/channel.ts
@@ -91,7 +91,7 @@
])]});
let i;
try {
- i = await m.awaitMessageComponent({time: 600000});
+ i = await m.awaitMessageComponent({time: 300000});
} catch(e) { break }
i.deferUpdate()
if (i.component.customId == "clear") {
diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts
index aac271e..895d7d7 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -200,7 +200,7 @@
});
let i;
try {
- i = await m.awaitMessageComponent({ time: 600000 });
+ i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { break }
i.deferUpdate()
if (i.component.customId == "clearCategory") {
@@ -237,7 +237,7 @@
while (true) {
if (data.useCustom) {
let customTypes = data.customTypes;
- interaction.editReply({
+ await interaction.editReply({
embeds: [new generateEmojiEmbed()
.setTitle("Tickets > Types")
.setDescription(
@@ -298,7 +298,7 @@
.setMinValues(1)
.setPlaceholder("Select types to use")
])
- interaction.editReply({
+ await interaction.editReply({
embeds: [new generateEmojiEmbed()
.setTitle("Tickets > Types")
.setDescription(
@@ -326,7 +326,7 @@
}
let i;
try {
- i = await m.awaitMessageComponent({ time: 600000 });
+ i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { break }
if (i.component.customId == "types") {
i.deferUpdate()
diff --git a/src/commands/settings/verify/role.ts b/src/commands/settings/verify/role.ts
index dc1d4d9..68b4bf9 100644
--- a/src/commands/settings/verify/role.ts
+++ b/src/commands/settings/verify/role.ts
@@ -86,7 +86,7 @@
])]});
let i;
try {
- i = await m.awaitMessageComponent({time: 600000});
+ i = await m.awaitMessageComponent({time: 300000});
} catch(e) { break }
i.deferUpdate()
if (i.component.customId == "clear") {
diff --git a/src/commands/tag.ts b/src/commands/tag.ts
index 8d6d8c9..c9739c2 100644
--- a/src/commands/tag.ts
+++ b/src/commands/tag.ts
@@ -8,7 +8,7 @@
.setDescription("Get and manage the servers tags")
const callback = (interaction: CommandInteraction) => {
- try { statsChannelAdd(interaction.client, interaction.member); } catch {} // TODO: REMOVE THIS FOR PRODUCTION
+ // try { statsChannelAdd(interaction.client, interaction.member); } catch {} // TODO: REMOVE THIS FOR PRODUCTION
interaction.reply("This command is not yet finished [tag]");
}
@@ -18,4 +18,4 @@
export { command };
export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/tags/list.ts b/src/commands/tags/list.ts
index bf234d5..5052a6b 100644
--- a/src/commands/tags/list.ts
+++ b/src/commands/tags/list.ts
@@ -100,7 +100,7 @@
});
let i
try {
- i = await m.awaitMessageComponent({time: 600000 });
+ i = await m.awaitMessageComponent({time: 300000 });
} catch (e) { break }
i.deferUpdate()
if (i.component.customId == "left") {
diff --git a/src/commands/user/about.ts b/src/commands/user/about.ts
index bdd73c4..b497359 100644
--- a/src/commands/user/about.ts
+++ b/src/commands/user/about.ts
@@ -209,7 +209,7 @@
})
let i
try {
- i = await m.awaitMessageComponent({time: 600000});
+ i = await m.awaitMessageComponent({time: 300000});
} catch { breakReason = "Message timed out"; break }
i.deferUpdate()
if (i.component.customId == "left") {
diff --git a/src/commands/user/track.ts b/src/commands/user/track.ts
index f96f718..eea0b7b 100644
--- a/src/commands/user/track.ts
+++ b/src/commands/user/track.ts
@@ -125,7 +125,7 @@
])})
let component;
try {
- component = await (m as Message).awaitMessageComponent({time: 2.5 * 60 * 1000});
+ component = await (m as Message).awaitMessageComponent({time: 300000});
} catch (e) {
return
}
@@ -177,4 +177,5 @@
export { command };
export { callback };
-export { check };
\ No newline at end of file
+export { check };
+