codePreviews: null check
This commit is contained in:
parent
98a3dfe26c
commit
e0d67ff501
1 changed files with 53 additions and 51 deletions
|
@ -28,6 +28,7 @@ events.add("messageCreate", "codePreviews", async function (msg) {
|
|||
const gitlabLinks = msg.content.match(REGEX_GITLAB);
|
||||
const giteaLinks = msg.content.match(REGEX_GITEA);
|
||||
|
||||
if (githubLinks?.length) {
|
||||
for (const link of githubLinks) {
|
||||
const rawLink = link.replace("/blob/", "/raw/");
|
||||
const file = await fetch(rawLink).then((res) => res.text());
|
||||
|
@ -86,6 +87,7 @@ events.add("messageCreate", "codePreviews", async function (msg) {
|
|||
unindent(targetLines) +
|
||||
"\n```\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (out !== "")
|
||||
msg.channel.createMessage({
|
||||
|
|
Loading…
Reference in a new issue