This is a Discord Chuck Norris bot that returns you a Chuck Norris joke when asked for. Integrate it with your Discord server in under five minutes.
- hasura CLI tool
- A Discord server
$ hasura quickstart rishi/discord-golang-bot
-
Go to your Discord server.
-
Click on the down arrow next to your server name and click on
Server Settings
. -
Select the
Webhooks
section from the left pannel. Create a webhook. -
Copy the Webhook URL and add it to project secrets since it contains a secret token that you do not want to explicitly mention in the code.
$ hasura secret update discord.webhook <webhook_url>
-
Now, in your application home page, scroll down to
Bots
and create a bot. -
Make the bot public.
-
Make sure that the
Require OAuth2 Code Grant
checkbox is not checked. -
Add the bot to your server by clicking on
Generate OAuth URL
and navigating to the generated URL from the browser. -
Copy the bot token and add it to the project secrets.
$ hasura secret update discord.bot.token <bot_token>
$ git add .
$ git commit -m "First commit"
$ git push hasura master
Type !joke
in the server chat and see the magic :)
This project can also be used as a starter for building more complex Discord bots. The source code for the bot lies in the microservices/bot/app/src/
directory.
You might also want to look at the Dockerfile
and the k8s.yaml
at microservices/bot/
if you are to add some extra packages or environment variables.
- Special thanks to "bwmarrin" for the discord bindings for golang.
- Built on top of Hasura boilerplate hello-golang-raw.