Added module configuration params: -params=<key>:<val>(!<key>:<val>])*

This commit is contained in:
Andreas Neue
2016-02-16 07:57:14 +01:00
parent 5f2dd41d55
commit 44ee1cf628
10 changed files with 67 additions and 55 deletions
+24 -24
View File
@@ -47,7 +47,7 @@ var (
)
func init() {
msgHandlers["sc"] = scHandleMessage
MsgHandlers["sc"] = scHandleMessage
log.Println("Initializing sc module")
go scScrapeLoop()
}
@@ -111,13 +111,13 @@ func scScraper() {
nextFunds := ((funds / FUNDS_INT) * FUNDS_INT) + FUNDS_INT
if curFans >= nextFans {
sayCh <- "*\n[SC] Star Citizens: " + util.NumberToString(curFans, '.')
SayCh <- "*\n[SC] Star Citizens: " + util.NumberToString(curFans, '.')
}
if curFleet >= nextFleet {
sayCh <- "*\n[SC] The UEE Fleet: " + util.NumberToString(curFleet, '.')
SayCh <- "*\n[SC] The UEE Fleet: " + util.NumberToString(curFleet, '.')
}
if curFunds >= nextFunds {
sayCh <- "*\n[SC] Funds raised: " + util.NumberToString(curFunds, '.')
SayCh <- "*\n[SC] Funds raised: " + util.NumberToString(curFunds, '.')
}
fans = curFans
@@ -126,10 +126,10 @@ func scScraper() {
}
func showScStats() {
sayCh <- "*\n*** SC User and Funding Stats ***"
sayCh <- fmt.Sprintf("*\nFans: %s", util.NumberToString(fans, '.'))
sayCh <- fmt.Sprintf("*\nFleet: %s", util.NumberToString(fleet, '.'))
sayCh <- fmt.Sprintf("*\nFunds: $ %s", util.NumberToString(funds, '.'))
SayCh <- "*\n*** SC User and Funding Stats ***"
SayCh <- fmt.Sprintf("*\nFans: %s", util.NumberToString(fans, '.'))
SayCh <- fmt.Sprintf("*\nFleet: %s", util.NumberToString(fleet, '.'))
SayCh <- fmt.Sprintf("*\nFunds: $ %s", util.NumberToString(funds, '.'))
}
func showCitizen(handle string) {
@@ -157,18 +157,18 @@ func showCitizen(handle string) {
sid := reSid.FindStringSubmatch(string(body))
rank := reRank.FindStringSubmatch(string(body))
if len(name) > 1 {
sayCh <- "*\n*** Citizen Info ***"
sayCh <- "*\n" + "Name: " + html.UnescapeString(string(name[1])) + " [" + string(handle_[1]) + "]"
sayCh <- "*\n" + "URL: " + QUERY_CIT_URL + string(handle_[1])
sayCh <- "*\n" + "UEE #: " + string(record[1])
SayCh <- "*\n*** Citizen Info ***"
SayCh <- "*\n" + "Name: " + html.UnescapeString(string(name[1])) + " [" + string(handle_[1]) + "]"
SayCh <- "*\n" + "URL: " + QUERY_CIT_URL + string(handle_[1])
SayCh <- "*\n" + "UEE #: " + string(record[1])
if len(org) > 1 {
sayCh <- "*\n" + "Organization: " + html.UnescapeString(string(org[1])) + " [" + string(sid[1]) + "]"
sayCh <- "*\n" + "Rank: " + html.UnescapeString(string(rank[1]))
SayCh <- "*\n" + "Organization: " + html.UnescapeString(string(org[1])) + " [" + string(sid[1]) + "]"
SayCh <- "*\n" + "Rank: " + html.UnescapeString(string(rank[1]))
} else {
sayCh <- "*\n" + "Organization: <none>"
SayCh <- "*\n" + "Organization: <none>"
}
} else {
sayCh <- "*\n" + "*** No Such Citizen ***"
SayCh <- "*\n" + "*** No Such Citizen ***"
}
}
@@ -195,14 +195,14 @@ func showOrganization(handle string) {
focus := reFocus.FindStringSubmatch(string(body))
comm := reComm.FindStringSubmatch(string(body))
if len(name) > 1 {
sayCh <- "*\n*** Organization Info ***"
sayCh <- "*\nName: " + string(name[1]) + " [" + strings.ToUpper(handle) + "]"
sayCh <- "*\nURL: " + QUERY_ORG_URL + strings.ToUpper(handle)
sayCh <- "*\nMembers: " + string(count[1])
sayCh <- "*\nModel: " + string(model[1])
sayCh <- "*\nCommitment: " + string(comm[1])
sayCh <- "*\nFocus: " + string(focus[1]) + ", " + string(focus[2])
SayCh <- "*\n*** Organization Info ***"
SayCh <- "*\nName: " + string(name[1]) + " [" + strings.ToUpper(handle) + "]"
SayCh <- "*\nURL: " + QUERY_ORG_URL + strings.ToUpper(handle)
SayCh <- "*\nMembers: " + string(count[1])
SayCh <- "*\nModel: " + string(model[1])
SayCh <- "*\nCommitment: " + string(comm[1])
SayCh <- "*\nFocus: " + string(focus[1]) + ", " + string(focus[2])
} else {
sayCh <- "*\n*** No Such Organization ***"
SayCh <- "*\n*** No Such Organization ***"
}
}