Skip to content

Commit

Permalink
fix(Server/misc): adjust marketplace webhook
Browse files Browse the repository at this point in the history
Use same formatting as twitter. Probs should refactor `Promise<any>`

Webhook error still exist though. Not sure why.
`script:npwd] [NPWD] [discord] [error]: Discord Error: 204 Error - No Content`
  • Loading branch information
RockySouthpaw authored Dec 30, 2021
1 parent 2bab130 commit 94c8757
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions resources/server/misc/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,33 +93,35 @@ export async function reportTweetToDiscord(tweet: Tweet, reportingProfile: Profi
}
}

export async function reportListingToDiscord(
listing: MarketplaceListing,
reportingProfile: string,
): Promise<void> {
const embedObj = createDiscordMsgObj('MARKETPLACE', 'Received a report for a listing', [
export async function reportListingToDiscord(listing: MarketplaceListing, reportingProfile: string): Promise<any> {
const guaranteedFields = [
{
name: 'Reported By',
value: reportingProfile,
inline: true,
value: `\`\`\`Profile Name: ${reportingProfile}\`\`\``,
},
{
name: 'Reported User',
value: `${listing.name} - (${listing.username})`,
inline: true,
name: 'Reported User Data',
value: `\`\`\`Profile Name: ${listing.username}\nProfile ID: ${listing.id}\nUser Identifier: ${listing.identifier}\`\`\``,
},
{
name: 'Reported Listing Title',
value: listing.title,
value: `\`\`\`Title: ${listing.name}\`\`\``,
},
{
name: 'Reported Listing Desc.',
value: listing.description,
value: `\`\`\`Description: ${listing.description}\`\`\``,
},
]);

];

const finalFields = listing.url ? guaranteedFields.concat(
{
name: 'Reported Image:',
value: listing.url.split(IMAGE_DELIMITER).join('\n'),
}) : guaranteedFields

const msgObj = createDiscordMsgObj('MARKETPLACE', `Received a report for a listing`, finalFields);
try {
await postToWebhook(embedObj);
await postToWebhook(msgObj);
} catch (e) {
discordLogger.error(e.message);
}
Expand Down

0 comments on commit 94c8757

Please sign in to comment.