mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
styling: Enforced styling across all files (#55)
This commit is contained in:
165 files changed
+1879
-1725
No files matched your search
+24
-17
@@ -1,27 +1,31 @@
|
||||
import axios from 'axios';
|
||||
import axios from "axios";
|
||||
|
||||
import { Tweet, Profile } from '../../phone/src/common/typings/twitter';
|
||||
import { IMAGE_DELIMITER } from '../../phone/src/apps/twitter/utils/images';
|
||||
import { Tweet, Profile } from "../../phone/src/common/typings/twitter";
|
||||
import { IMAGE_DELIMITER } from "../../phone/src/apps/twitter/utils/images";
|
||||
|
||||
const DISCORD_TOKEN_ENV_VAR = 'discord_bot_token';
|
||||
const DISCORD_TOKEN_ENV_VAR = "discord_bot_token";
|
||||
const DISCORD_TOKEN = GetConvar(DISCORD_TOKEN_ENV_VAR, "");
|
||||
const DISCORD_CHANNEL_ENV_VAR = 'discord_channel_id';
|
||||
const DISCORD_CHANNEL_ENV_VAR = "discord_channel_id";
|
||||
const DISCORD_CHANNEL_ID = GetConvar(DISCORD_CHANNEL_ENV_VAR, "");
|
||||
const DISCORD_HEADERS = { authorization: `Bot ${DISCORD_TOKEN}` };
|
||||
|
||||
const BASE_URL = 'https://discord.com/api';
|
||||
const BASE_URL = "https://discord.com/api";
|
||||
const POST_CHANNEL_URL = `${BASE_URL}/channels/${DISCORD_CHANNEL_ID}/messages`;
|
||||
|
||||
|
||||
export async function reportTweetToDiscord(tweet: Tweet, reportingProfile: Profile ): Promise<any> {
|
||||
if (!DISCORD_TOKEN || !DISCORD_CHANNEL_ID) {
|
||||
console.warn(`Got a request to report a tweet but discord is not
|
||||
export async function reportTweetToDiscord(
|
||||
tweet: Tweet,
|
||||
reportingProfile: Profile
|
||||
): Promise<any> {
|
||||
if (!DISCORD_TOKEN || !DISCORD_CHANNEL_ID) {
|
||||
console.warn(`Got a request to report a tweet but discord is not
|
||||
configured. See README on how to configure discord endpoints.`);
|
||||
return;
|
||||
}
|
||||
const content = `**REPORTED TWEET**
|
||||
return;
|
||||
}
|
||||
const content = `**REPORTED TWEET**
|
||||
----------------------------------------------------------------------
|
||||
**Reporting User**: ${reportingProfile.profile_name} (${reportingProfile.id})
|
||||
**Reporting User**: ${reportingProfile.profile_name} (${
|
||||
reportingProfile.id
|
||||
})
|
||||
**Reported User**: ${tweet.profile_name} (${tweet.profile_id})
|
||||
**Reported Tweet timestamp**: ${tweet.createdAt}
|
||||
----------------------------------------------------------------------
|
||||
@@ -30,9 +34,12 @@ export async function reportTweetToDiscord(tweet: Tweet, reportingProfile: Profi
|
||||
${tweet.message}
|
||||
|
||||
**Reported Images**:
|
||||
${tweet.images.split(IMAGE_DELIMITER).join('\n')}
|
||||
${tweet.images.split(IMAGE_DELIMITER).join("\n")}
|
||||
`;
|
||||
|
||||
return await axios.post(POST_CHANNEL_URL, { content }, { headers: DISCORD_HEADERS });
|
||||
return await axios.post(
|
||||
POST_CHANNEL_URL,
|
||||
{ content },
|
||||
{ headers: DISCORD_HEADERS }
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user