Skip to content

Instantly share code, notes, and snippets.

@jakeayy
Created October 26, 2025 21:00
Show Gist options
  • Select an option

  • Save jakeayy/d053508c94b7af804c314e9eebc9aaab to your computer and use it in GitHub Desktop.

Select an option

Save jakeayy/d053508c94b7af804c314e9eebc9aaab to your computer and use it in GitHub Desktop.

Revisions

  1. jakeayy created this gist Oct 26, 2025.
    26 changes: 26 additions & 0 deletions prepare_messages.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    import { readdirSync, readFileSync, writeFileSync } from "fs"

    const channelIds = (() => {
    const files = readdirSync("Messages", { withFileTypes: true })
    .filter(x => x.isDirectory() && x.name.startsWith("c"))

    return files.map(x => x.name.slice(1))
    })()

    const messages = channelIds.reduce((acc, id) => {
    const str = readFileSync(`Messages/c${id}/messages.json`, "utf-8")
    const json = JSON.parse(str)

    acc[id] = json.map(({ ID }) => ID)

    return acc
    }, {})

    writeFileSync(
    "messages.txt",
    Object.entries(messages)
    .flatMap(([channelId, messageIds]) =>
    messageIds.map(messageId => `${channelId}/${messageId}`)
    )
    .join("\n")
    )