You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
455 B

7 years ago
  1. package main
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "io/ioutil"
  6. )
  7. //Config stores the data from json twitterConfig.json file
  8. type Config struct {
  9. TelegramBotToken string `json:"telegramBotToken"`
  10. }
  11. var config Config
  12. func readConfig() {
  13. file, e := ioutil.ReadFile("config.json")
  14. if e != nil {
  15. fmt.Println("error:", e)
  16. }
  17. content := string(file)
  18. json.Unmarshal([]byte(content), &config)
  19. fmt.Println("config.json read comlete, Telegram bot ready")
  20. }