fix
This commit is contained in:
@@ -16,8 +16,6 @@ const {
|
||||
stripEmailQuotes,
|
||||
stripMobileFooter,
|
||||
detectGame,
|
||||
getFormattedDate,
|
||||
truncateEmbedField,
|
||||
enforceEmbedLimit
|
||||
} = require('./utils');
|
||||
const { getGmailClient } = require('./services/gmail');
|
||||
@@ -107,9 +105,11 @@ async function poll(client) {
|
||||
?.replace(/"/g, '')
|
||||
.trim() || 'Unknown';
|
||||
|
||||
const hasReplyHeaderFrom =
|
||||
/(?:\n{2,}|(?:^|\n)--\s*\n)[^\S\r\n]*From:\s.*<.*@.*>/i.test(rawBody);
|
||||
const looksLikeReply =
|
||||
/\nOn .+wrote:/i.test(rawBody) ||
|
||||
/\nFrom:\s.*<.*@.*>/i.test(rawBody);
|
||||
hasReplyHeaderFrom;
|
||||
|
||||
let firstBodyText = rawBody.replace(/\r\n/g, '\n');
|
||||
if (looksLikeReply) {
|
||||
@@ -120,7 +120,6 @@ async function poll(client) {
|
||||
firstBodyText = firstBodyText.replace(/\n{3,}/g, '\n\n');
|
||||
firstBodyText = firstBodyText
|
||||
.replace(/Get Outlook for [^\n]+/gi, '')
|
||||
.replace(/https?:\/\/\S+/gi, '')
|
||||
.replace(/<\s*$/gm, '')
|
||||
.trim();
|
||||
const firstBody = firstBodyText;
|
||||
@@ -135,7 +134,6 @@ async function poll(client) {
|
||||
followupBody = stripMobileFooter(followupBody);
|
||||
followupBody = followupBody
|
||||
.replace(/Get Outlook for [^\n]+/gi, '')
|
||||
.replace(/https?:\/\/\S+/gi, '')
|
||||
.replace(/<\s*$/gm, '')
|
||||
.trim();
|
||||
|
||||
@@ -239,25 +237,19 @@ async function poll(client) {
|
||||
.setStyle(ButtonStyle.Secondary)
|
||||
);
|
||||
|
||||
const welcomeEmbed = new EmbedBuilder()
|
||||
.setDescription(CONFIG.TICKET_WELCOME_MESSAGE)
|
||||
.setColor(CONFIG.EMBED_COLOR_INFO);
|
||||
const ticketInfoEmbed = new EmbedBuilder()
|
||||
.setColor(CONFIG.EMBED_COLOR_INFO)
|
||||
.addFields({
|
||||
name: 'Ticket Info',
|
||||
value: truncateEmbedField(
|
||||
`**Name:** ${sName}\n` +
|
||||
`**Email:** ${sEmail}\n` +
|
||||
`**Date:** ${getFormattedDate()}\n` +
|
||||
`**Game:** ${detectedGame}\n` +
|
||||
`**Subject:** ${subject || 'No subject'}`)
|
||||
});
|
||||
.addFields(
|
||||
{ name: 'Name', value: `\`${sName}\``, inline: false },
|
||||
{ name: 'Email', value: `\`${sEmail}\``, inline: false },
|
||||
{ name: 'Game', value: `\`${detectedGame}\``, inline: false },
|
||||
{ name: 'Subject', value: `\`${subject || 'No subject'}\``, inline: false }
|
||||
);
|
||||
|
||||
enforceEmbedLimit([welcomeEmbed, ticketInfoEmbed]);
|
||||
enforceEmbedLimit([ticketInfoEmbed]);
|
||||
const welcomeMsg = await ticketChan.send({
|
||||
content: `<@&${CONFIG.ROLE_ID_TO_PING}>`,
|
||||
embeds: [welcomeEmbed, ticketInfoEmbed],
|
||||
embeds: [ticketInfoEmbed],
|
||||
components: [buttons]
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user