Clyde is a simple programming language that allows anyone, with no experience, to build a Discord bot. It is crafted to create a simple experience for those using it.
This was originally a replit language jam submission (https://repl.it/@discordbotlang/clyde).
Join our discord server to test out a demo bot built using Clyde.
Note: this language is pretty simple and barebones for now. (WIP)
To setup the discord bot,
- Open the discord developer portal.
- Create a new application.
- Add a bot to your discord application.
- Create a .env file.
- Copy the Bot's token, and paste into the .env file in the following format:
TOKEN=<Your token goes here>
To invite the bot to your server,
- Go to the OAuth2 tab
- Check the box labeled bot under scopes
- Under bot permissions, check all the boxes you need
- At the bottom of scopes, there will be a text box with a link
- Copy and paste the link into you browser to invite the bot
Delete the contents of main.clyde
, and write the following:
on "hello bot":
say "hello world"
Then run poetry run python clyde/main.py
or, if debugging, run poetry run python clyde/debug.py
Your bot should be online, and if you say "hello bot", it will respond with "hello world"
Writing code for your bot using Clyde is super simple.
Clyde programs are made up of multiple listeners.
They start with on
followed by a message surrounded in quotes, then a colon, and then a list of instructions.
Listeners listen for messages sent by a user of your bot, and will run their instructions if they hear the correct message.
Example:
on "ping":
say "pong"
You can have multiple listeners,
on "ping":
say "pong"
on "What's up?":
say "Hey!"
Sometimes, you want to say many things, in many commands,
on "Hello":
say "hi"
say "hello"
Or many things, in one command,
on "Hello":
say "hi", "greetings", "good morning"
And sometimes, you just want one line,
on "Hello": say "hi", "greetings", "good morning"
If you want to print a message to the console, instead of sending it to your server,
on "log something":
log "something logged!"
You can also store messages in variables, for later use,
on "Hello":
name = "Bob"
say name
You can store booleans (true or false) in variables too,
on "turn light on":
light = true
on "turn light off":
light = false
And then run commands if a boolean is true,
on "turn light on":
light = true
on "turn light off":
light = false
on "light on?":
if light say "light is on"
Join our discord server to test out a demo bot built using Clyde.