discord.bat
created 2017/09/09 modified 2025/06/29 category software views 14
a working[^1] discord bot framework[^2] in windows batch script i wrote when i was eleven years old?????
[^1]: relies on Discord.Net 1.0.2.0, idk what discord api version it uses but it's almost certainly outdated now. you probably couldn't port it to the latest version of discord.net easily without refactoring literally everything
[^2]: it's a binding to Discord.Net
documentation
unfortunately all of the documentation is lost since it used to be on a github wiki i didn't archive before deleting my repositories off of github. there was this walkthrough of how it worked in the README that i rephrased
the way it works is you write event handlers and configuration in batch scripts, which are called by an instance of discord.net listening for events. `run.bat` starts `Runtime/discord.bat.exe` which when handling an event calls `Runtime/eventManager.bat` with 2 arguments; the type of event, and info about the event. for the sake of example: `eventManager.bat message ""`
the message event checks for the presence of the configured prefix, if found the prefix is stripped, and `Config/commands.bat` is called. `commands.bat message ping` just calls the event handler blindly like `call:ping` which (if defined) handles the ping command
in command handlers you call `s.bat` to perform actions, so `call s.bat sendMessage "Pong!"` sends a message saying "Pong!"
`s.bat sendMessage x` writes "sendx" to an `update.dat` file. the runtime checks if the file exists every 100ms. if the file contains "sendPong!" it will strip "send" and send "Pong!" in the same channel as the original message
examples
Config/config.bat
:: Bot Config set bot.token=token_here set bot.id=123456789012345678 set bot.prefix=$ set bot.playing=Hello World! :: Event Config set events.message.notification=1
Currently `bot.playing` and `bot.id` aren't used for anything, however, they are considered global variables.
Config/commands.bat
if %1 neq "" call:%~1 goto exit :help call s.bat dmAuthor "Commands: , , " goto:eof :ping call s.bat sendMessage "Pong" goto:eof :info call s.bat sendMessage "Made using `discord.bat` (Yes, it's real)" goto:eof :exit
Do **NOT** modify the first 2 or last line.