Skip to content

Commit

Permalink
Improve function godocs
Browse files Browse the repository at this point in the history
  • Loading branch information
ryukinix committed Jul 24, 2020
1 parent 2c092c2 commit f1478b0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions troll_shield.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ const logfile = "troll-shield.log"

var log = logger.New(os.Stderr, "", logger.LstdFlags)

// findTrollHouse return the troll house group name if is well-known
// otherwise, returns a empty string
// findTrollHouses return a string with groups separeted by comma,
// that groups are well-known to being troll houses.
// otherwise, if nothing is found returns a empty string
func findTrollHouses(bot *tgbotapi.BotAPI, userID int) string {
ch := make(chan string, len(trollGroups))
var wait sync.WaitGroup
Expand Down Expand Up @@ -98,6 +99,10 @@ func setupLogging() {
}
}

// getUserName: return the most meaningful name available from a telegram user
// if it has a @username, return it
// if not, try to return FirstName + LastName
// otherwise, only return the FirstName
func getUserName(user tgbotapi.User) string {
username := user.FirstName
if user.UserName != "" {
Expand Down

0 comments on commit f1478b0

Please sign in to comment.