pull/6/head
pineafan 4 years ago
parent 6702cefc37
commit c6158abfcb
No known key found for this signature in database
GPG Key ID: 0BC8D3DCC20E96FE

@ -181,7 +181,7 @@ export default async (guild, interaction?) => {
}
let i
try {
i = await m.awaitMessageComponent({filter: interaction ? () => { return true } : f, time: 600000});
i = await m.awaitMessageComponent({filter: interaction ? () => { return true } : f, time: 300000});
} catch(e) { break }
i.deferUpdate()
if (i.component.customId == "left") {

@ -67,7 +67,7 @@ export async function callback(interaction) {
})
}
let component;
try { component = await (m as Message).awaitMessageComponent({time: 2.5 * 60 * 1000});
try { component = await (m as Message).awaitMessageComponent({time: 300000});
} catch (e) { return }
component.deferUpdate()
let rolesToAdd = []
@ -107,7 +107,7 @@ export async function callback(interaction) {
});
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
}

@ -74,7 +74,7 @@ export default async function (interaction) {
], ephemeral: true, fetchReply: true, components: splitFormattedTicketTypes});
let component;
try {
component = await (m as Discord.Message).awaitMessageComponent({time: 2.5 * 60 * 1000});
component = await (m as Discord.Message).awaitMessageComponent({time: 300000});
} catch (e) {
return;
}

@ -91,7 +91,7 @@ const callback = async (interaction: CommandInteraction): Promise<any> => {
], 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()

@ -99,7 +99,7 @@ const callback = async (interaction: CommandInteraction): Promise<any> => {
})
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 @@ const callback = async (interaction: CommandInteraction): Promise<any> => {
])]})
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 @@ const callback = async (interaction: CommandInteraction): Promise<any> => {
])]})
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()

@ -11,7 +11,7 @@ const command = (builder: SlashCommandSubcommandBuilder) =>
.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)

@ -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 @@ const command = (builder: SlashCommandSubcommandBuilder) =>
.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) => {

@ -109,7 +109,7 @@ const callback = async (interaction: CommandInteraction): Promise<any> => {
})
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`)

@ -89,7 +89,7 @@ const callback = async (interaction: CommandInteraction): Promise<any> => {
])]});
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") {

@ -91,7 +91,7 @@ const callback = async (interaction: CommandInteraction): Promise<any> => {
])]});
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") {

@ -200,7 +200,7 @@ const callback = async (interaction: CommandInteraction): Promise<any> => {
});
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 @@ async function manageTypes(interaction, data, m) {
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 @@ async function manageTypes(interaction, data, m) {
.setMinValues(1)
.setPlaceholder("Select types to use")
])
interaction.editReply({
await interaction.editReply({
embeds: [new generateEmojiEmbed()
.setTitle("Tickets > Types")
.setDescription(
@ -326,7 +326,7 @@ async function manageTypes(interaction, data, m) {
}
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()

@ -86,7 +86,7 @@ const callback = async (interaction: CommandInteraction): Promise<any> => {
])]});
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") {

@ -8,7 +8,7 @@ const command = new SlashCommandBuilder()
.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]");
}

@ -100,7 +100,7 @@ const callback = async (interaction: CommandInteraction) => {
});
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") {

@ -209,7 +209,7 @@ const callback = async (interaction: CommandInteraction) => {
})
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") {

@ -125,7 +125,7 @@ const callback = async (interaction: CommandInteraction) => {
])})
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
}
@ -178,3 +178,4 @@ const check = async (interaction: CommandInteraction, defaultCheck: WrappedCheck
export { command };
export { callback };
export { check };

@ -22,11 +22,11 @@
"REMOVE": "837355918420869162"
},
"CHANNEL": {
"TEXT": "752971441351426089",
"VOICE": "752971441586307091",
"STORE": "853668786925469706",
"ANNOUNCEMENT": "853668786493063169",
"STAGE": "853668786842763294"
"GUILD_TEXT": "752971441351426089",
"GUILD_VOICE": "752971441586307091",
"GUILD_STORE": "853668786925469706",
"GUILD_NEWS": "853668786493063169",
"GUILD_STAGE": "853668786842763294"
}
},
"CONTROL": {

@ -6,8 +6,6 @@ const logs = [
"guildUpdate",
"guildMemberUpdate",
"guildMemberPunish",
"guildEventUpdate", // TODO
"guildEventMemberUpdate", // TODO
"guildRoleUpdate",
"guildInviteUpdate",
"messageUpdate",
@ -17,10 +15,12 @@ const logs = [
"messagePing",
"messageMassPing",
"messageAnnounce", // TODO
"stageUpdate",
"threadUpdate",
"voiceStateUpdate", // TODO
"webhookUpdate" // TODO
"webhookUpdate", // TODO
"guildMemberVerify", // TODO
"autoModeratorDeleted", // TODO
"nucleusSettingsUpdated", // TODO
""
]
const tickets = [

@ -99,7 +99,7 @@ class confirmationMessage {
}
let component;
try {
component = await (m as Message).awaitMessageComponent({filter: (m) => m.user.id === this.interaction.user.id, time: 2.5 * 60 * 1000});
component = await (m as Message).awaitMessageComponent({filter: (m) => m.user.id === this.interaction.user.id, time: 300000});
} catch (e) {
return {
success: false,

@ -7,9 +7,9 @@ export default async function (m, interactionFilter, messageFilter) {
try {
out = await new Promise((resolve, reject) => {
let mes, int;
mes = m.createMessageComponentCollector({filter: (m) => interactionFilter(m), time: 600000})
mes = m.createMessageComponentCollector({filter: (m) => interactionFilter(m), time: 300000})
.on("collect", (m) => { resolve(m); })
int = m.channel.createMessageCollector({filter: (m) => messageFilter(m), time: 600000})
int = m.channel.createMessageCollector({filter: (m) => messageFilter(m), time: 300000})
.then("collect", (m) => { try {m.delete();} catch {}; resolve(m); })
mes.on("end", () => { int.stop(); })
int.on("end", () => { mes.stop(); })
@ -27,12 +27,12 @@ export async function modalInteractionCollector(m, modalFilter, interactionFilte
try {
out = await new Promise((resolve, reject) => {
let mod, int;
int = m.createMessageComponentCollector({filter: (m) => interactionFilter(m), time: 600000})
int = m.createMessageComponentCollector({filter: (m) => interactionFilter(m), time: 300000})
.on("collect", (m) => { resolve(m); })
mod = new Discord.InteractionCollector(
client, {
filter: (m) => modalFilter(m),
time: 600000
time: 300000
})
.on("collect", async (m) => {
int.stop();

Loading…
Cancel
Save