- Go 87.1%
- Jinja 11.8%
- Dockerfile 0.8%
- Shell 0.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| cmd/pokebot | ||
| k8s | ||
| pkg | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| README.md | ||
| run_tests.sh | ||
Pokemon Bot
PokeBot is a pokemon discord bot that posts a pokemon in a specified channel
2 times a day. To catch the pokemon that has been posted, users can type
!catch before pokebot posts the next pokemon. Users can type !list to see
all pokemon they have caught so far. Posted pokemon are either the beginning
of an evolution line or have no known evolutions. To evolve a pokemon, first
select the pokemon by typing !choose <pokemon name or id> where the ID is
number of the pokemon in the national pokedex. Next, typing messages in any
channel in the server that's not the bot channel evolves the pokemon. You
cannot DM pokebot to add to the message evolution counter.
Running Pokebot in Your Server
I currently don't have any plans to allow this bot to run in any server other than my own. If you want to use pokebot in your server, raise an issue on this Gitlab project to start the conversation with me.
Otherwise, if you want to generate your own discord bot token, you can add pokebot to your own server and run it yourself.
The Platform
Pokebot runs in a kubernetes environment because it relies on kubernetes
configmaps to store user data. You can spin up your own kubernetes cluster
across nodes you own on prem or in a cloud, but the easiest way to get
started and test pokebot is by using a single node kubernetes platform
like microk8s or minikube.
Build the Docker Image
Use docker or your desired container runtime to build pokebot and publish
it to a docker repository that you own. If you don't want to publish pokebot,
you can use mine at docker.io/highsaltlevels/pokebot:latest.
docker build -t <image name> .
Running Pokebot
Required Environment Variables
- Create a discord bot and generate an OAUTH2 token for it.
- Get the channel ID of the discord channel you want pokebot to post in.
- Right click on the desired channel in discord and click
Copy Link. - Paste the link somewhere. The last string of numbers in the URL is the channel ID.
- Right click on the desired channel in discord and click
Running Pokebot for Development
If you're running microk8s or minikube, ensure you have a valid kubeconfig
at ${HOME}/.kube/config, export the bot token and channel ID as environment
variables, and run pokebot directly using go.
export BOT_TOKEN=<YOUR BOT TOKEN>
export CHANNEL_ID=<YOUR DESIRED CHANNEL ID>
go run pokebot.go
Deploying Pokebot to Kubernetes
Inspect the kubernetes manifests in the k8s directory of this project. Replace
the bot token and channel id placeholders with your bot token and channel id.
If you published your own docker image, replace the image stanza in the deployment
spec with your image.
sed -i 's/__BOT_TOKEN_PLACEHOLDER__/<YOUR BOT TOKEN>/g' k8s/pokebot.yaml
sed -i 's/__CHANNEL_ID_PLACEHOLDER__/<YOUR DESIRED CHANNEL_ID>/g' k8s/pokebot.yaml
kubectl create ns pokebot
kubectl -n pokebot apply -f k8s/pokebot.yaml