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",
|
"Ticket",
|
||||||
`${interaction.channel.name} (${interaction.channel.id})`
|
`${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("Closed By", interaction.user.tag)
|
||||||
.addField("Reason", reason);
|
.addField("Reason", reason);
|
||||||
const logEmbed = new Discord.MessageEmbed()
|
const logEmbed = new Discord.MessageEmbed()
|
||||||
@@ -121,7 +126,9 @@ module.exports = new Command({
|
|||||||
)
|
)
|
||||||
.addField(
|
.addField(
|
||||||
"User",
|
"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("Closed By", interaction.user.tag)
|
||||||
.addField("Reason", reason);
|
.addField("Reason", reason);
|
||||||
@@ -156,7 +163,7 @@ module.exports = new Command({
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
await tUser
|
await tUser
|
||||||
.send({ embeds: [transcriptEmbed], files: [file] })
|
?.send({ embeds: [transcriptEmbed], files: [file] })
|
||||||
.catch(async (err) => {
|
.catch(async (err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
@@ -164,7 +171,7 @@ module.exports = new Command({
|
|||||||
ticket.subUsers.forEach(async (subUser) => {
|
ticket.subUsers.forEach(async (subUser) => {
|
||||||
await interaction.client.users.cache
|
await interaction.client.users.cache
|
||||||
.get(subUser)
|
.get(subUser)
|
||||||
.send({ embeds: [transcriptEmbed], files: [file] });
|
?.send({ embeds: [transcriptEmbed], files: [file] });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
await interaction.channel.delete().catch(async (error) => {
|
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.",
|
"Some roles seem to be missing!\nPlease check for errors when starting the bot.",
|
||||||
ephemeral: true,
|
ephemeral: true,
|
||||||
});
|
});
|
||||||
const Author = interaction.user;
|
|
||||||
let TicketCategory = await getCategory(
|
let TicketCategory = await getCategory(
|
||||||
supportbot.Departments[department].category || supportbot.TicketCategory,
|
supportbot.Departments[department].category || supportbot.TicketCategory,
|
||||||
interaction.guild
|
interaction.guild
|
||||||
@@ -117,7 +116,7 @@ module.exports = new Command({
|
|||||||
allow: [Permissions.FLAGS.VIEW_CHANNEL],
|
allow: [Permissions.FLAGS.VIEW_CHANNEL],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: Author.id,
|
id: interaction.user.id,
|
||||||
allow: [Permissions.FLAGS.VIEW_CHANNEL],
|
allow: [Permissions.FLAGS.VIEW_CHANNEL],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -140,7 +139,7 @@ module.exports = new Command({
|
|||||||
await TicketData.tickets.push({
|
await TicketData.tickets.push({
|
||||||
id: ticketChannel.id,
|
id: ticketChannel.id,
|
||||||
name: ticketChannel.name,
|
name: ticketChannel.name,
|
||||||
user: Author.id,
|
user: interaction.user.id,
|
||||||
number: ticketNumberID,
|
number: ticketNumberID,
|
||||||
reason: TicketSubject,
|
reason: TicketSubject,
|
||||||
open: true,
|
open: true,
|
||||||
@@ -271,7 +270,7 @@ module.exports = new Command({
|
|||||||
await ticketChannel.permissionOverwrites.edit(role.id, {
|
await ticketChannel.permissionOverwrites.edit(role.id, {
|
||||||
VIEW_CHANNEL: true,
|
VIEW_CHANNEL: true,
|
||||||
});
|
});
|
||||||
await ticketChannel.permissionOverwrites.edit(Author.id, {
|
await ticketChannel.permissionOverwrites.edit(interaction.user.id, {
|
||||||
SEND_MESSAGES: true,
|
SEND_MESSAGES: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user