Fix missing user or subuser
This commit is contained in:
1 parent
3aa373c33c
commit
8b3f2bc61a
2 files changed
+14
-8
No files matched your search
+11
-4
@@ -108,7 +108,12 @@ module.exports = new Command({
|
||||
"Ticket",
|
||||
`${interaction.channel.name} (${interaction.channel.id})`
|
||||
)
|
||||
.addField("User", `${tUser}#${tUser.discriminator} (${tUser.id})`)
|
||||
.addField(
|
||||
"User",
|
||||
`${tUser?.username || "N/A"}#${tUser?.discriminator || "N/A"} (${
|
||||
tUser?.id || ticket.user
|
||||
})`
|
||||
)
|
||||
.addField("Closed By", interaction.user.tag)
|
||||
.addField("Reason", reason);
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
@@ -121,7 +126,9 @@ module.exports = new Command({
|
||||
)
|
||||
.addField(
|
||||
"User",
|
||||
`${tUser.username}#${tUser.discriminator} (${tUser.id})`
|
||||
`${tUser?.username || "N/A"}#${tUser?.discriminator || "N/A"} (${
|
||||
tUser?.id || ticket.user
|
||||
})`
|
||||
)
|
||||
.addField("Closed By", interaction.user.tag)
|
||||
.addField("Reason", reason);
|
||||
@@ -156,7 +163,7 @@ module.exports = new Command({
|
||||
console.error(err);
|
||||
});
|
||||
await tUser
|
||||
.send({ embeds: [transcriptEmbed], files: [file] })
|
||||
?.send({ embeds: [transcriptEmbed], files: [file] })
|
||||
.catch(async (err) => {
|
||||
console.error(err);
|
||||
});
|
||||
@@ -164,7 +171,7 @@ module.exports = new Command({
|
||||
ticket.subUsers.forEach(async (subUser) => {
|
||||
await interaction.client.users.cache
|
||||
.get(subUser)
|
||||
.send({ embeds: [transcriptEmbed], files: [file] });
|
||||
?.send({ embeds: [transcriptEmbed], files: [file] });
|
||||
});
|
||||
}
|
||||
await interaction.channel.delete().catch(async (error) => {
|
||||
|
||||
+3
-4
@@ -101,7 +101,6 @@ module.exports = new Command({
|
||||
"Some roles seem to be missing!\nPlease check for errors when starting the bot.",
|
||||
ephemeral: true,
|
||||
});
|
||||
const Author = interaction.user;
|
||||
let TicketCategory = await getCategory(
|
||||
supportbot.Departments[department].category || supportbot.TicketCategory,
|
||||
interaction.guild
|
||||
@@ -117,7 +116,7 @@ module.exports = new Command({
|
||||
allow: [Permissions.FLAGS.VIEW_CHANNEL],
|
||||
},
|
||||
{
|
||||
id: Author.id,
|
||||
id: interaction.user.id,
|
||||
allow: [Permissions.FLAGS.VIEW_CHANNEL],
|
||||
},
|
||||
{
|
||||
@@ -140,7 +139,7 @@ module.exports = new Command({
|
||||
await TicketData.tickets.push({
|
||||
id: ticketChannel.id,
|
||||
name: ticketChannel.name,
|
||||
user: Author.id,
|
||||
user: interaction.user.id,
|
||||
number: ticketNumberID,
|
||||
reason: TicketSubject,
|
||||
open: true,
|
||||
@@ -271,7 +270,7 @@ module.exports = new Command({
|
||||
await ticketChannel.permissionOverwrites.edit(role.id, {
|
||||
VIEW_CHANNEL: true,
|
||||
});
|
||||
await ticketChannel.permissionOverwrites.edit(Author.id, {
|
||||
await ticketChannel.permissionOverwrites.edit(interaction.user.id, {
|
||||
SEND_MESSAGES: true,
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user