This bot connects to Discord and generates HTML transcripts for the #help channel.
- Generates HTML transcripts using the
discord-html-transcripts
package - Saves transcripts to a specified output directory
discord-token
: The authentication token of the Discord bot.guild-id
: The guild ID. You can find this by right-clicking on the server icon and selecting "Copy ID".transcript-directory
: The directory where the transcripts are/will be saved.
If an existing directory is specified, then the action will only fetch threads that have been modified or don't exist yet.
env:
# Don't forget to put the guild ID in quotes.
GUILD_ID: '123456789012345678'
---
- name: 'Run the transcript action'
uses: toitlang/[email protected]
with:
discord-token: ${{ secrets.DISCORD_TOKEN }}
guild-id: { { env.GUILD_ID } }
transcript-directory: transcripts
Typically, this step is followed by a step that commits the output, and one that uploads the transcript to the gh-pages branch of the repository.
- name: 'Commit the transcripts'
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add transcripts
git commit -m "Update transcripts"
git push
- name: 'Upload to gh-pages'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: transcripts
cname: 'example.com'
The transcript directory contains an HMTL file for each thread in the #help forum.
In addition, the output directory contains a index.html
file that links to all
the transcripts.
Finally, it also produces an index.json
file that contains the metadata for
each transcript. This can be used to generate a more complex index page.
If the transcript directory already exists and contains the index.json file, then the action will only fetch threads that have been modified or don't exist yet.
You can also just run the transcript generation locally.
Make sure to run with Node 20. Use, for example, nvm
to install it. The
repository contains a .nvmrc
file that specifies the node version that works.
It also contains a .node-version
file that is used by GitHub to fetch the
correct version.
If you have nvm installed, but not automatically activated in your .bashrc, you will need to do
source /usr/share/nvm/init-nvm.sh
Then run nvm install
to install the correct version of node.
Install the dependencies.
npm install
Save the Discord credentials and your input parameters to a .env
file. Use the
.env.example as a starting point.
INPUT_discord-token=YOUR_DISCORD_TOKEN
INPUT_guild-id=YOUR_GUILD_ID
INPUT_transcript-directory=transcripts
Run the script.
npm run local-action
This repository is based on the TypeScript Action template.