-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor changes (see changelog for 1.0.6)
- Loading branch information
1 parent
1c1a111
commit 119412a
Showing
11 changed files
with
36 additions
and
72 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ const getStegCloak: Promise<StegCloakImport> = import( | |
"https://unpkg.com/[email protected]/index.js" | ||
); | ||
|
||
// TYPES | ||
|
||
type Constructor<StegCloak> = new (encrypt: boolean, useHmac: boolean) => Promise<StegCloak>; | ||
|
||
interface StegCloak { | ||
|
@@ -24,6 +26,23 @@ interface StegCloakImport { | |
default: Constructor<StegCloak>; | ||
} | ||
|
||
interface DiscordEmbed { | ||
title: string; | ||
type: string; | ||
description: string; | ||
url?: string; | ||
timestamp?: EpochTimeStamp; | ||
color?: number; | ||
footer?: object; | ||
image?: object; | ||
thumbnail?: object; | ||
video?: object; | ||
provider?: object; | ||
author?: object; | ||
} | ||
|
||
// CONSTANTS | ||
|
||
const EMBED_URL = "https://embed.sammcheese.net"; | ||
const INV_DETECTION = new RegExp(/( \u200c|\u200d |[\u2060-\u2064])[^\u200b]/); | ||
const URL_DETECTION = new RegExp( | ||
|
@@ -52,8 +71,6 @@ export async function start(): Promise<void> { | |
chatbarLock, | ||
Indicator, | ||
}; | ||
|
||
console.log("%c [Invisible Chat] Started!", "color: aquamarine"); | ||
} | ||
|
||
// Grab the data from the above Plantext Patches | ||
|
@@ -62,7 +79,8 @@ function receiver(message: unknown): void { | |
} | ||
|
||
// Gets the Embed of a Link | ||
async function getEmbed(url: URL): Promise<JSON> { | ||
async function getEmbed(url: URL): Promise<DiscordEmbed> { | ||
// Timeout after 5 seconds | ||
const controller = new AbortController(); | ||
const _timeout = setTimeout(() => controller.abort(), 5000); | ||
|
||
|
@@ -84,7 +102,7 @@ async function getEmbed(url: URL): Promise<JSON> { | |
export async function buildEmbed(message: unknown, revealed: string): Promise<void> { | ||
const urlCheck = revealed.match(URL_DETECTION) || []; | ||
|
||
let attachment; | ||
let attachment: DiscordEmbed; | ||
if (urlCheck[0]) attachment = await getEmbed(new URL(urlCheck[0])); | ||
|
||
let embed = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters