Archived
d3 module: hero icons with genders
This commit is contained in:
+15
-8
@@ -80,7 +80,7 @@ func handleD3Request(payload *WebhookPayload, isCommand bool) string {
|
|||||||
paragonSeasonHardcore := util.NumberToString(profile.ParagonLevelSeasonHardcore, '.')
|
paragonSeasonHardcore := util.NumberToString(profile.ParagonLevelSeasonHardcore, '.')
|
||||||
var allHeroes string
|
var allHeroes string
|
||||||
for i, hero := range profile.Heroes {
|
for i, hero := range profile.Heroes {
|
||||||
allHeroes += classToIcon(hero.Class) + "" + heroTypeToIconString(hero.Seasonal, hero.Hardcore) + " " + hero.Name + " " + strconv.Itoa(hero.Level)
|
allHeroes += classToIcon(hero.Class, hero.Gender) + "" + heroTypeToIconString(hero.Seasonal, hero.Hardcore) + " " + hero.Name + " " + strconv.Itoa(hero.Level)
|
||||||
if i+1 != len(profile.Heroes) {
|
if i+1 != len(profile.Heroes) {
|
||||||
allHeroes += ", "
|
allHeroes += ", "
|
||||||
}
|
}
|
||||||
@@ -125,20 +125,27 @@ func handleD3Request(payload *WebhookPayload, isCommand bool) string {
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
func classToIcon(class string) string {
|
func classToIcon(class string, gender int) string {
|
||||||
|
genderstring := ""
|
||||||
|
if gender == 0 {
|
||||||
|
genderstring = "m"
|
||||||
|
}
|
||||||
|
if gender == 1 {
|
||||||
|
genderstring = "f"
|
||||||
|
}
|
||||||
switch class {
|
switch class {
|
||||||
case "witch-doctor":
|
case "witch-doctor":
|
||||||
return ":d3witchdoctor:"
|
return ":d3witchdoctor" + genderstring + ":"
|
||||||
case "barbarian":
|
case "barbarian":
|
||||||
return ":d3barbarian:"
|
return ":d3barbarian" + genderstring + ":"
|
||||||
case "crusader":
|
case "crusader":
|
||||||
return ":d3crusader:"
|
return ":d3crusader" + genderstring + ":"
|
||||||
case "demon-hunter":
|
case "demon-hunter":
|
||||||
return ":d3demonhunter:"
|
return ":d3demonhunter" + genderstring + ":"
|
||||||
case "wizard":
|
case "wizard":
|
||||||
return ":d3wizard:"
|
return ":d3wizard" + genderstring + ":"
|
||||||
case "monk":
|
case "monk":
|
||||||
return ":d3monk:"
|
return ":d3monk" + genderstring + ":"
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user