energieprijzen

module
v1.0.40 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2024 License: MIT

README

energieprijzen-bot Go Report Card

Run with:

go run ./cmd/bot

Run tests with:

go test ./...

To release a new version, run ./script/release.

Running the bot on a schedule

Tested on a clean install of Ubuntu Server 22.04.3 LTS with a user named julia with the repo cloned to /home/julia/energieprijzen.

sudo apt update
sudo apt install git vim
git clone https://github.com/heyajulia/energieprijzen.git
cd energieprijzen/

Then, either download a pre-built binary, or build it yourself:

VERSION=v1.0.30
wget https://github.com/heyajulia/energieprijzen/releases/download/$VERSION/energieprijzen
chmod +x energieprijzen

or:

cd $(mktemp -d)
wget https://go.dev/dl/go1.21.5.linux-arm64.tar.gz
sudo tar -C /usr/local -xzf go1.21.5.linux-arm64.tar.gz
export PATH=$PATH:/usr/local/go/bin
cd -
go build -o energieprijzen ./cmd/bot

Then, copy the systemd files and edit the token file:

sudo cp init/energieprijzen.* /etc/systemd/system
vim token.txt

The token.txt file should have contents similar to:

{
  "telegram": "foo",
  "cronitor_url": "bar"
}

Where telegram is the Telegram bot token, and cronitor_url is your Cronitor Telemetry URL.

Then, enable and start the timer:

sudo systemctl daemon-reload
sudo systemctl enable --now energieprijzen.timer

Check that it worked using:

systemctl status energieprijzen.{service,timer}

[!TIP]

You can run the bot at any time with sudo systemctl start energieprijzen.service.

Directories

Path Synopsis
cmd
bot
templ: version: v0.2.707
templ: version: v0.2.707
fp

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL