Run setup
This commit is contained in:
parent
7e68c8d665
commit
28219d663a
4 changed files with 37 additions and 5 deletions
20
README.md
Normal file
20
README.md
Normal file
|
@ -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`
|
10
main.go
10
main.go
|
@ -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))
|
||||
log.Fatal(api.HandleWebhook(bind, os.Getenv("CLESSY_PATH"), func(update tg.APIUpdate) {
|
||||
for _, mod := range toActivate {
|
||||
mod.OnUpdate(update)
|
||||
}
|
||||
|
||||
func webhook(update tg.APIUpdate) {
|
||||
|
||||
}))
|
||||
}
|
||||
|
|
5
run.ps1
Normal file
5
run.ps1
Normal file
|
@ -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 .
|
5
run.sh
Normal file
5
run.sh
Normal file
|
@ -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…
Reference in a new issue