Scan or click the QR code above to add Poimandres to your own Discord server.

The Poimandres Discord Bot was the first JavaScript project I really sunk my teeth into. Largely thanks to the discord.js module, which has an amazing guide that enabled me to get the bot online in no-time.

In reflection, I don’t know why I chose JavaScript over the Python option. I wasn’t experienced in either language at the time; and I knew that I was going to want to get a taste of both eventually. Many of the other bots that I had looked at were written in Python. If you’re reading this and looking to build your own Discord Bot but don’t know which language to pick? Honestly, just flip a coin and go for it is my advice.

Poima-What?

The Poimandres Discord Bot is named for a figure described in some scriptures as the ‘mind of god’.

Throughout history the name has been translated and mis-translated across many different texts. The theorised etymologies for Poimandres nowadays range from “Shepard of Man” to “Understanding of Re”.

I pronounce it as “Poy-Man-Drays”- though I am at a disadvantage for trying to use 21st century English; I’m also using Australian English, so how accurate could I possibly be with my pronunciation?

The Poimandres Discord Bot is open-source and can be found on github here.

The idea for a bot that could quote public-domain versions of the Corpus Hermeticum had been floated in the Hermetic House of Life (HHoL) Discord server, largely inspired by already extant bots which could quote texts like the Bible or Qur’an.

In practice, what goes on behind the curtains is quite simple. With some cunning regex, I converted the Corpus Hermeticum (CH) into .json key/data pairs…

{
"bookTitle": "The Corpus Hermeticum",
"translator": "G.R.S. Mead",
"1.1": "It chanced once on a time my mind was meditating on the things that are, my thought was raised to a great height, the senses of my body being held back - just as men who are weighed down with sleep after a fill of food, or from fatigue of body.\nMethought a Being more than vast, in size beyond all bounds, called out my name and saith: What wouldst thou hear and see, and what hast thou in mind to learn and know?"
"1.2": "And I do say: Who art thou?\nHe saith: I am Man-Shepherd (Poemandres), Mind of all-masterhood; I know what thou desirest and I'm with thee everywhere."
...and so forth...
  1. The Poimandres Discord Bot registers a user interaction through a valid slash command (how to set up slash commands is covered in the Discord.js guide). For example, let’s say someone uses the command “/ch 1.1” in Discord.
  2. The bot has a corresponding JSON file for each command. In our example, /ch 1.1 would call ch.json
  3. It compares the user-input against the ‘keys’ in that JSON file. In this case- It is searching ch.json for data stored under the “1.1” key. There are considerations for books that have different ways of indexing their content (eg. The Bible has <book>,<chapter>,<verse> keys). It also converts colons to periods, so “1:1” and “1.1” are read the same.
  4. If it finds the requested key, it formats a message ’embed’ (it looks prettier than just replying with normal text) containing the data stored under that key, and replies to the user with it. See below:

Once I had the full Corpus Hermeticum in there, figuring out how to regex my way through other holy-books became a somewhat bizarrely-fun exercise for me. Over the coming month, I’d convert several other texts into JSON and add them to the bot’s available ‘library’. The scope extended beyond the classical Hermetic writings to other philosophical and religious texts:

Hermetic Texts:

The Corpus Hermeticum

Asclepius

Emerald Tablet

Definitions of Hermes to Asclepius

Oxford Fragments

Other:

Bible

Qur’an

Book of the Law (Liber AL vel Legis)

Epictetus’ Enchiridion

Marcus Aurelius’ Meditations

Proclus’ Elements of Metaphysics

Sepher Yetzirah

Tarot Pulls

poimandres-bot

I knocked up this profile picture using Adobe Illustrator in about ten minutes. It was meant to be a ‘this will do for now’ temporary job… but when reduced to tiny Discord thumbnail size it turned out to be perfect.

The bot’s most popular feature is the Tarot card-pulls. There are a few tarot-focused Discord bots out there, but Poimandres offers a simple no-frills approach that I feel the others miss. Using “/tarot” pulls one random tarot card from the classic Rider-Waite-Smith deck, and displays its artwork. No additional info is given. 

I noticed all the other tarot-bots suggest meanings or correspondences for each card you ‘pull’. For the Poimandres Discord bot, I deliberately wanted to avoid presenting the user with meanings for each card. Good tarot should be a reader’s interpretation of the cards; not a bot-developer pre-loading the meaning into the cards; otherwise the tarot-deck is turned into a sort of magic 8-ball with extra options.

Hosting Poimandres

For those who are curious what it looks like to run a Discord bot- I execute my  JavaScript code in a command window (pictured above), the code connects to Discord, and the bot goes online. If I close that command window (or it crashes, or my computer gets switched off, etc) the bot goes offline. If someone interacts with the bot on Discord- the command window on my computer will log the time, the command used, and if it worked or not.

Hosting the bot reliably meant finding some kind of internet-connected computer that could stay on all the time. I could run my code on that and the Bot would be online indefinitely. Nowadays, I use an Amazon Lightsail server kindly provided by one of the other members of the HHoL Discord. That’s right- Poimandres is on the cloud. This solution has a fast response-time, and it’s impressively reliable: At time of writing, it has run continuously without incident ever since the day I switched it on.

Before the Amazon cloud-hosting, I purchased a Raspberry Pi 4b+ and hosted the bot on that. This was a low-power, cost-efficient option; but not one without hurdles to overcome. One day I might write up a full ‘how-to’, but if you’ve found yourself reading this because you are  planning on attempting the same thing- here’s my quick-tips:

  • Use Raspberry Pi OS. At first I tried with Ubuntu, but for the minuscule computing task of running a basic node.js script- there’s no reason not to use the OS best optimised for the hardware. It’ll save you later annoyances.
  • Use nvm to install Node. Discord.js only supports Node v16.9.0 or higher, and running the Node install command directly (without nvm) in the Pi OS shell installs an older, unsupported version.
  • While hosting a bot is a valid use of a Raspberry Pi you already have laying around… Its not the best option for the bot, and its not the best use of a Raspberry Pi either.

While testing and developing the bot, having it right-there on the Pi, or on any spare computer that can be left running for weeks at a time- is a handy option. In my case, the Raspberry Pi is such a neat little device that I started dreaming up more interesting uses for it; and once the bot’s user-base grew beyond what I had anticipated, I sought out a different ‘set-and-forget’ option for hosting it.

I give thanks to Poimandres. Word of sovereignty, mind of the supreme…

My goals with the Poimandres Discord Bot were to learn JavaScript for myself, and serve the niche request of one Discord server. I was pleasantly surprised when; after just a few months of hosting; I had reached the 100-server-cap and needed to go over my credentials with Discord HQ (ie. get the little “verified ✔️” added to the bot’s name) to continue. By the way, brief aside- Discord’s verification process was not what I was expecting. I had to screen-record a video of myself using the bot as-well as submit screenshots of my source-code. Is anybody at Discord actually watching these videos or looking through all this code? I’d love to submit something cheeky and absurd to see if it makes it through. Maybe a project for another time.

Overall, I am satisfied with the quality of the bot and am happy to call it complete. It continues to service over 100 Discord servers, with a collective user-base of over 200,000 at time of writing.