Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Commit

Permalink
🎨prettier formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfhound905 committed Aug 27, 2023
1 parent c6c9ed5 commit fa88fb7
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,20 @@ const logger = Logger.plugin("PluginTemplate");
const { toast } = common;

async function fetchQuickVidsLink(content: string): Promise<string> {
const response = await fetch(
"https://api.quickvids.win/v1/shorturl/create",
{
method: "POST",
headers: { "Content-Type": "application/json" },
// eslint-disable-next-line @typescript-eslint/naming-convention
body: JSON.stringify({ input_text: content }),
},
);
const response = await fetch("https://api.quickvids.win/v1/shorturl/create", {
method: "POST",
headers: { "Content-Type": "application/json" },
// eslint-disable-next-line @typescript-eslint/naming-convention
body: JSON.stringify({ input_text: content }),
});
const data = await response.json();
if (data.quickvids_url) {
return data.quickvids_url;
}
toast.toast(
"Failed to convert a TikTok link(s) to QuickVids link(s).",
toast.Kind.FAILURE,
{ duration: 2000, position: toast.Position.BOTTOM },
);
toast.toast("Failed to convert a TikTok link(s) to QuickVids link(s).", toast.Kind.FAILURE, {
duration: 2000,
position: toast.Position.BOTTOM,
});
return content;
}

Expand Down Expand Up @@ -65,19 +61,17 @@ async function replaceLinks(content: string): Promise<string> {
content = content.replace(link, quickvidsLink);
} catch (error) {
logger.error(error);
toast.toast(
"Failed to convert a TikTok link(s) to QuickVids link(s).",
toast.Kind.FAILURE,
{ duration: 2000, position: toast.Position.BOTTOM },
);
toast.toast("Failed to convert a TikTok link(s) to QuickVids link(s).", toast.Kind.FAILURE, {
duration: 2000,
position: toast.Position.BOTTOM,
});
}
}
if (content !== originalContent) {
toast.toast(
"Successfully converted TikTok link(s) to QuickVids link(s).",
toast.Kind.SUCCESS,
{ duration: 2000, position: toast.Position.BOTTOM },
);
toast.toast("Successfully converted TikTok link(s) to QuickVids link(s).", toast.Kind.SUCCESS, {
duration: 2000,
position: toast.Position.BOTTOM,
});
}
return content;
}
Expand Down

0 comments on commit fa88fb7

Please sign in to comment.