Compare commits
2 commits
0936ce6937
...
932d24d6a4
Author | SHA1 | Date | |
---|---|---|---|
932d24d6a4 | |||
e212bade7b |
2 changed files with 13 additions and 12 deletions
|
@ -68,9 +68,14 @@ async function updateNowPlaying() {
|
||||||
} else if (playing.startsWith("Coming up")) {
|
} else if (playing.startsWith("Coming up")) {
|
||||||
title = playing;
|
title = playing;
|
||||||
} else {
|
} else {
|
||||||
const [_, current, peakDay, peakMonth, dj, metadata] = playing.match(
|
const metadataLine = playing.match(
|
||||||
/\[(\d+)\/(\d+)\/(\d+)\] \((.+?)\): (.+)/
|
/\[(\d+)\/(\d+)\/(\d+)\] \((.+?)\): (.+)/
|
||||||
);
|
);
|
||||||
|
const current = metadataLine?.[1] ?? "??";
|
||||||
|
const peakDay = metadataLine?.[2] ?? "??";
|
||||||
|
const peakMonth = metadataLine?.[3] ?? "??";
|
||||||
|
const dj = metadataLine?.[4] ?? "unknown";
|
||||||
|
const metadata = metadataLine?.[5] ?? "unknown";
|
||||||
|
|
||||||
if (
|
if (
|
||||||
metadata == "https://archives.anonradio.net" ||
|
metadata == "https://archives.anonradio.net" ||
|
||||||
|
|
|
@ -36,6 +36,8 @@ async function processFile(link) {
|
||||||
? ""
|
? ""
|
||||||
: fileName.substring(fileName.lastIndexOf(".") + 1);
|
: fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||||
|
|
||||||
|
if (fileType == "md") return "";
|
||||||
|
|
||||||
const lineStr = link.match(/#L\d+(-L?\d+)?/)?.[0];
|
const lineStr = link.match(/#L\d+(-L?\d+)?/)?.[0];
|
||||||
let startLine, endLine;
|
let startLine, endLine;
|
||||||
let entireFile = false;
|
let entireFile = false;
|
||||||
|
@ -60,21 +62,15 @@ async function processFile(link) {
|
||||||
? "Line " + startLine
|
? "Line " + startLine
|
||||||
: "Lines " + startLine + "-" + endLine;
|
: "Lines " + startLine + "-" + endLine;
|
||||||
|
|
||||||
|
if (entireFile && lines.length > 20) return "";
|
||||||
|
|
||||||
const targetLines = (
|
const targetLines = (
|
||||||
entireFile
|
entireFile ? lines : lines.slice(startLine - 1, endLine)
|
||||||
? lines.length > 30
|
|
||||||
? lines.slice(0, 30)
|
|
||||||
: lines
|
|
||||||
: lines.slice(startLine - 1, endLine)
|
|
||||||
).join("\n");
|
).join("\n");
|
||||||
|
|
||||||
return `**${fileName}: **${whichLines}\n\`\`\`${fileType}\n${unindent(
|
return `**${fileName}: **${whichLines}\n\`\`\`${fileType}\n${unindent(
|
||||||
targetLines
|
targetLines
|
||||||
)}${
|
)}\n\`\`\``;
|
||||||
entireFile && lines.length > 30
|
|
||||||
? `\n... (${lines.length - 30} lines left)`
|
|
||||||
: ""
|
|
||||||
}\n\`\`\``;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
events.add("messageCreate", "codePreviews", async function (msg) {
|
events.add("messageCreate", "codePreviews", async function (msg) {
|
||||||
|
@ -168,7 +164,7 @@ events.add(
|
||||||
const ref = await channel.getMessage(msg.messageReference.messageID);
|
const ref = await channel.getMessage(msg.messageReference.messageID);
|
||||||
if (!ref) return;
|
if (!ref) return;
|
||||||
if (
|
if (
|
||||||
ref.author.id != reactor.id ||
|
ref.author.id != reactor.id &&
|
||||||
!channel.permissionsOf(reactor.id).has("manageMessages")
|
!channel.permissionsOf(reactor.id).has("manageMessages")
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue