Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

Commit

Permalink
trying to fix botway init --docker command, bump to 0.1.0-beta.52
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed May 14, 2022
1 parent d949449 commit 3b9a4f1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 25 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.18
require (
github.com/AlecAivazis/survey/v2 v2.3.4
github.com/MakeNowJust/heredoc v1.0.0
github.com/abdfnx/gosh v0.3.9
github.com/abdfnx/looker v0.1.0
github.com/abdfnx/resto v0.1.6
github.com/abdfnx/tran v0.1.31
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ
github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/abdfnx/gosh v0.3.9 h1:/jZXpHeQkfGScfaLrag/cr5RwG3/kU5GQKqsBBykpQ8=
github.com/abdfnx/gosh v0.3.9/go.mod h1:bho3zdOB7bNUOZDeI5+CSjoiF+MHmzHWqHHDAQiCq1c=
github.com/abdfnx/looker v0.1.0 h1:tMN7E0wKIgbydAPPQ1RkppJ1bGHn+B+y9PZy7mwa+3U=
github.com/abdfnx/looker v0.1.0/go.mod h1:QVfPHnredPBUg4R+MtEkZbMBbqrgtoaj0JHO3KYkvyE=
github.com/abdfnx/resto v0.1.6 h1:yOM9O9bpMP4lb2ox0U7/gcFXO78P5eUZBxWuKrfdrFA=
Expand Down
29 changes: 8 additions & 21 deletions internal/pipes/initx/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"strings"

"github.com/abdfnx/botway/constants"
"github.com/abdfnx/gosh"
"github.com/abdfnx/tran/dfs"
"github.com/gookit/config/v2"
"github.com/gookit/config/v2/yaml"
Expand Down Expand Up @@ -62,24 +61,15 @@ func DockerInit() {
bot_token = "TELEGRAM_TOKEN"
}

err, out, errOut := gosh.RunOutput("botway vars get " + bot_token)
out = out[:len(out)-1]
vos := viper.New()

if err != nil {
panic(errOut)
}

appErr, appOut, appErrOut := gosh.RunOutput("botway vars get " + app_token)
appOut = appOut[:len(appOut)-1]

if appErr != nil {
panic(appErrOut)
}
vos.BindEnv(bot_token)
vos.BindEnv(app_token)

viper.SetDefault("botway.bots." + GetBotName() + ".bot_token", out)
viper.SetDefault("botway.bots." + GetBotName() + ".bot_token", vos.Get(bot_token))

if t != "telegram" {
viper.SetDefault("botway.bots." + GetBotName() + "." + cid, appOut)
viper.SetDefault("botway.bots." + GetBotName() + "." + cid, vos.Get(app_token))
}

if t == "discord" {
Expand All @@ -91,14 +81,11 @@ func DockerInit() {
for x := 0; x < int(guilds.Int()); x++ {
server := gjson.Get(string(constants.Guilds), "guilds." + fmt.Sprint(x)).String()

err, out, errOut := gosh.RunOutput("botway vars get " + strings.ToUpper(server + "_GUILD_ID"))
out = out[:len(out)-1]
env := strings.ToUpper(server) + "_GUILD_ID"

if err != nil {
panic(errOut)
}
vos.BindEnv(env)

viper.Set("botway.bots." + GetBotName() + ".guilds." + server + ".server_id", out)
viper.Set("botway.bots." + GetBotName() + ".guilds." + server + ".server_id", env)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "botway",
"version": "0.1.0-beta.52",
"version": "0.1.0-beta.521",
"description": "🤖 Generate, build, handle and deploy your own bot with your favorite language, for Discord, or Telegram, or Slack.",
"type": "module",
"author": "abdfnx",
Expand Down

0 comments on commit 3b9a4f1

Please sign in to comment.