Tweak/marketplace additions (#137)

Checks for being the OP of the listing. Calling, Message, Delete and Report. 

Updates to Locale is needed.
This commit is contained in:
Christopher Gjelten authored and GitHub committed 2021-03-07 16:30:58 +01:00
1 parent 0203ebbe51
commit 6b6080c4b2
13 files changed
+277 -47

No files matched your search

+26
View File
@@ -3,6 +3,7 @@ import axios from 'axios';
import { Tweet, Profile } from '../../phone/src/common/typings/twitter';
import { IMAGE_DELIMITER } from '../../phone/src/apps/twitter/utils/images';
import { mainLogger } from './sv_logger';
import { MarketplaceListing } from '../../phone/src/common/typings/marketplace';
const discordLogger = mainLogger.child({ module: 'discord' });
@@ -37,3 +38,28 @@ export async function reportTweetToDiscord(tweet: Tweet, reportingProfile: Profi
return await axios.post(POST_CHANNEL_URL, { content }, { headers: DISCORD_HEADERS });
}
export async function reportListingToDiscord(
listing: MarketplaceListing,
reportingProfile: string,
): Promise<any> {
if (!DISCORD_TOKEN || !DISCORD_CHANNEL_ID) {
discordLogger.warn(
'Got a request to report a listing but discord is not configures. See README o how to configure discord endpoints.',
);
return;
}
const content = `**REPORTED LISTING**
-------------------------------------------------
**Reporting User**: ${reportingProfile}
**Reported User** ${listing.name} (${listing.username})
-------------------------------------------------
**Reported Listing**
${listing.title}
----
${listing.description}
`;
return await axios.post(POST_CHANNEL_URL, { content }, { headers: DISCORD_HEADERS });
}