add config

This commit is contained in:
Andrey Belvedersky
2021-06-06 03:46:11 +03:00
parent 0aa4922105
commit f3175b8ce9
10 changed files with 97 additions and 433 deletions

View File

@ -17,10 +17,8 @@ import (
// Чатбот
func JiraBot() {
func JiraBot(cfg *config.Config) {
cfg, _ := config.GetConfig()
redis := utils.Redis(cfg.Redis)
ctx := context.Background()
pnsq := utils.GetProducer()
@ -47,10 +45,9 @@ func JiraBot() {
b.Handle("/exit", scenes.Exit(b, redis, ctx))
b.Handle("/hello", func(m *telegram.Message) {
b.Send(m.Sender, "Hello World!")
b.Send(m.Sender, "Hello World from chatbot")
messageBody := []byte("hello")
topicName := "error"
topicName := "jira"
// Synchronously publish a single message to the specified topic.
// Messages can also be sent asynchronously and/or in batches.
err = pnsq.Publish(topicName, messageBody)
@ -58,7 +55,6 @@ func JiraBot() {
log.Fatal(err)
}
})
fmt.Println(templates.Title(b.Me, cfg.BotVersion, jiraClient.GetBaseURL().Host))
b.Start()
}