Run setup

master
Hamcha 1 year ago
parent 7e68c8d665
commit 28219d663a
Signed by: Hamcha
GPG Key ID: 1669C533B8CF6D89

@ -0,0 +1,20 @@
# Maudbot rewrite
## Development setup
You will need:
- A healthy fear of the end
- ngrok
Run `ngrok http 8080` to get an HTTP address for port 8080.
Then, run `run.sh` or `run.ps1` specifying the bot token and ngrok base HTTPS address, eg.
```sh
./run.sh 12345:AEEA311_EU https://abcd-12-23-43-112.ngrok.io
```
## Deployment
Build and deploy the docker container using the provided `Dockerfile`

@ -47,6 +47,8 @@ func main() {
for _, modname := range strings.Split(*enable, ",") {
toActivate[modname] = mods[modname]
}
} else {
toActivate = mods
}
for modname, mod := range toActivate {
@ -56,9 +58,9 @@ func main() {
}
api.SetWebhook(os.Getenv("CLESSY_WEBHOOK"))
log.Fatal(api.HandleWebhook(bind, os.Getenv("CLESSY_PATH"), webhook))
}
func webhook(update tg.APIUpdate) {
log.Fatal(api.HandleWebhook(bind, os.Getenv("CLESSY_PATH"), func(update tg.APIUpdate) {
for _, mod := range toActivate {
mod.OnUpdate(update)
}
}))
}

@ -0,0 +1,5 @@
# Usage: setenv.ps1 <bot-token> <ngrok url>
$env:CLESSY_TOKEN = $args[0]
$env:CLESSY_WEBHOOK = $args[1] + "/test"
$env:CLESSY_PATH = "/test"
go run .

@ -0,0 +1,5 @@
# Usage: setenv.sh <bot-token> <ngrok url>
export CLESSY_TOKEN=$1
export CLESSY_WEBHOOK=$2/test
export CLESSY_PATH=/test
go run .
Loading…
Cancel
Save