Skip to content

Commit

Permalink
Remove empty descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
chiliec committed Jul 10, 2020
1 parent ad281cd commit 23e203e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"regexp"
"strconv"
"strings"
"time"

"github.com/VIZ-Blockchain/viz-go-lib"
Expand Down Expand Up @@ -107,7 +108,11 @@ func saveChannel(db *leveldb.DB, bot *tgbotapi.BotAPI, channel string) error {
return err
}

text := randomEmoji() + " Новый #канал с ботом: \n\n" + c.Title + " — @" + c.UserName + "\n\n *** \n\n" + c.Description + "\n\n ***"
var description = ""
if strings.TrimSpace(c.Description) != "" {
description = "\n\n *** \n\n" + c.Description + "\n\n ***"
}
text := randomEmoji() + " Новый #канал с ботом: \n\n" + c.Title + " — @" + c.UserName + description
msg := tgbotapi.NewMessageToChannel(os.Getenv("TELEGRAM_CHANNEL"), text)
_, err = bot.Send(msg)
return err
Expand Down

0 comments on commit 23e203e

Please sign in to comment.