personal queue
This commit is contained in:
@@ -6,6 +6,8 @@ const { CONFIG } = require('../config');
|
||||
const { extractRawEmail } = require('../utils');
|
||||
const { getGmailClient, sendGmailReply } = require('../services/gmail');
|
||||
const { updateTicketActivity } = require('../services/tickets');
|
||||
const { getNotifyDm } = require('../services/staffSettings');
|
||||
const { pingStaffChannel } = require('../services/staffChannel');
|
||||
|
||||
const Ticket = mongoose.model('Ticket');
|
||||
|
||||
@@ -18,6 +20,29 @@ async function handleDiscordReply(m) {
|
||||
const ticket = await Ticket.findOne({ discordThreadId: m.channel.id }).lean();
|
||||
if (!ticket) return;
|
||||
|
||||
if (ticket.claimerId && m.author.id !== ticket.claimerId && ticket.staffChannelId) {
|
||||
try {
|
||||
const staffChan = await m.guild.channels.fetch(ticket.staffChannelId).catch(() => null);
|
||||
if (staffChan) {
|
||||
await pingStaffChannel(staffChan, ticket.claimerId, m);
|
||||
}
|
||||
const dmEnabled = await getNotifyDm(ticket.claimerId);
|
||||
if (dmEnabled) {
|
||||
const staffMember = await m.guild.members.fetch(ticket.claimerId).catch(() => null);
|
||||
if (staffMember) {
|
||||
const jumpLink = `https://discord.com/channels/${m.guild.id}/${m.channel.id}/${m.id}`;
|
||||
await staffMember
|
||||
.send(
|
||||
`New customer reply in **${m.channel.name}**:\n> ${m.content.slice(0, 300)}\n[Jump to message](${jumpLink})`
|
||||
)
|
||||
.catch(() => {});
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Staff ping error:', e);
|
||||
}
|
||||
}
|
||||
|
||||
const discordUser = m.member?.displayName || m.author.username;
|
||||
|
||||
if (ticket.gmailThreadId.startsWith('discord-')) {
|
||||
|
||||
Reference in New Issue
Block a user