diff --git a/aleesa-misc-lib.go b/aleesa-misc-lib.go index ede59ca..63d8672 100644 --- a/aleesa-misc-lib.go +++ b/aleesa-misc-lib.go @@ -95,7 +95,7 @@ func msgParser(ctx context.Context, msg string) { for _, command := range cmds { if cmd == command { - sendTo = "phrases" + sendTo = config.ForwardChannels.Phrases // Костыль для кармы if cmd == "karma" || cmd == "карма" { @@ -116,7 +116,20 @@ func msgParser(ctx context.Context, msg string) { for _, command := range cmds { if cmd == command { - sendTo = "webapp" + sendTo = config.ForwardChannels.Webapp + done = true + break + } + } + } + + // Не угадали? акей, как насчёт модуля webapp-go? + if !done { + cmds = []string{"cat", "кис"} + + for _, command := range cmds { + if cmd == command { + sendTo = config.ForwardChannels.WebappGo done = true break } @@ -129,7 +142,7 @@ func msgParser(ctx context.Context, msg string) { for _, command := range cmds { if cmd == command { - sendTo = "games" + sendTo = config.ForwardChannels.Games done = true break } @@ -144,7 +157,7 @@ func msgParser(ctx context.Context, msg string) { for _, command := range cmds { if cmdLen > len(command) && cmd[0:len(command)] == command { - sendTo = "webapp" + sendTo = config.ForwardChannels.Webapp done = true break } @@ -160,7 +173,7 @@ func msgParser(ctx context.Context, msg string) { for _, command := range cmds { if cmdLen > len(command) && cmd[0:len(command)] == command { - sendTo = "phrases" + sendTo = config.ForwardChannels.Phrases if command == "karma " || command == "карма " { // Костыль для кармы @@ -180,7 +193,7 @@ func msgParser(ctx context.Context, msg string) { if j.Message[msgLen-len("--"):msgLen] == "--" || j.Message[msgLen-len("++"):msgLen] == "++" { // Предполагается, что менять карму мы будем для одной фразы, то есть для 1 строки if len(strings.Split(j.Message, "\n")) == 1 { - sendTo = "phrases" + sendTo = config.ForwardChannels.Phrases // Костыль для кармы j.Misc.Answer = 1 @@ -319,6 +332,10 @@ func readConfig() { sampleConfig.ForwardChannels.Webapp = "webapp" } + if sampleConfig.ForwardChannels.WebappGo == "" { + sampleConfig.ForwardChannels.WebappGo = "webapp-go" + } + if sampleConfig.ForwardChannels.Craniac == "" { sampleConfig.ForwardChannels.Craniac = "craniac" } diff --git a/data/config_sample.json b/data/config_sample.json index 382f9b0..2c8fdb9 100644 --- a/data/config_sample.json +++ b/data/config_sample.json @@ -25,6 +25,9 @@ # webapp if not set "webapp" : "webapp", + # webapp-go if not set + "webapp-go" : "webapp-go", + # craniac if not set "craniac" : "craniac" }, diff --git a/types.go b/types.go index 0edeced..14401e2 100644 --- a/types.go +++ b/types.go @@ -8,10 +8,11 @@ type myConfig struct { Log string `json:"log,omitempty"` Channel string `json:"channel,omitempty"` ForwardChannels struct { - Games string `json:"games,omitempty"` - Phrases string `json:"phrases,omitempty"` - Webapp string `json:"webapp,omitempty"` - Craniac string `json:"craniac,omitempty"` + Games string `json:"games,omitempty"` + Phrases string `json:"phrases,omitempty"` + Webapp string `json:"webapp,omitempty"` + WebappGo string `json:"webapp-go,omitempty"` + Craniac string `json:"craniac,omitempty"` } `json:"forward_channels"` Csign string `json:"csign,omitempty"` ForwardsMax int64 `json:"forwards_max,omitempty"`