mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 16:50:01 +00:00
20 lines
313 B
Go
20 lines
313 B
Go
package main
|
|
|
|
type badgeCollection map[string]*int
|
|
|
|
func (b badgeCollection) Add(badge string, level int) {
|
|
b[badge] = &level
|
|
}
|
|
|
|
func (b badgeCollection) Get(badge string) int {
|
|
l, ok := b[badge]
|
|
if !ok {
|
|
return 0
|
|
}
|
|
|
|
return *l
|
|
}
|
|
|
|
func (b badgeCollection) Has(badge string) bool {
|
|
return b[badge] != nil
|
|
}
|