Creating a Discord bot that executes HolyC code

I want to build a Discord bot that can run HolyC programming language commands. The bot should be able to handle both regular text output and graphics rendering. I’m looking for guidance on how to set this up properly. What libraries or frameworks would work best for this? Has anyone successfully implemented something similar before? I need the bot to execute HolyC code snippets that users send in chat and then display the results back in the Discord channel. Both console output and any graphical elements should be captured and shown to users.

this would be a nightmare to implement. HolyC is so tied to TempleOS that you’d need to run a whole VM just for code execution. why not create a HolyC-inspired language instead? much easier to parse and execute safely without the VM overhead and security issues.

I’ve built something similar and ran into some nasty technical roadblocks. The biggest problem? HolyC only works properly on TempleOS - there aren’t any decent standalone interpreters for modern systems. You’ll either need to spin up a full TempleOS VM for every execution or hunt down alternative HolyC implementations (spoiler: there aren’t many good ones). For Discord, I’d go with discord.js if you know Node.js - it’s got solid API coverage. The graphics part gets messy fast. You’ll need screen capture from the VM, then convert everything to images Discord can actually show. Fair warning: performance will suck since firing up VMs for each code run eats resources like crazy.

You can absolutely create a Discord bot that executes HolyC code, but there are important considerations to keep in mind. In my experience, utilizing isolated environments, such as Docker containers, is crucial for managing execution safely. HolyC, being originally designed for TempleOS, needs either a virtual machine or alternatives like TinkerOS to run effectively. I found leveraging libraries like discord.py works well, along with subprocesses to trigger the HolyC interpreter. Handling graphics is particularly challenging; I used a virtual framebuffer solution to manage visual output. Lastly, be proactive about security, setting strict limits on execution time and resources to prevent potential exploits.