let admins reset default emojis
This commit is contained in:
parent
5bfc5e3e40
commit
32bd1a5e28
|
@ -66,6 +66,7 @@ func init() {
|
||||||
var emojis map[string]string
|
var emojis map[string]string
|
||||||
|
|
||||||
type emojiHolder struct {
|
type emojiHolder struct {
|
||||||
|
NoDefault bool `json:"no_defaults"`
|
||||||
Emojis []map[string]string `json:"emojis"`
|
Emojis []map[string]string `json:"emojis"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,17 +78,22 @@ func InitEmoji() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
emojis = make(map[string]string, len(emoji.Emojis))
|
emojis = make(map[string]string, len(emoji.Emojis))
|
||||||
|
if !emoji.NoDefault {
|
||||||
for _, item := range emoji.Emojis {
|
for _, item := range emoji.Emojis {
|
||||||
for ikey, ival := range item {
|
for ikey, ival := range item {
|
||||||
emojis[ikey] = ival
|
emojis[ikey] = ival
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
emoji = emojiHolder{}
|
emoji = emojiHolder{}
|
||||||
err = unmarshalJsonFileIgnore404("./config/emoji.json", &emoji)
|
err = unmarshalJsonFileIgnore404("./config/emoji.json", &emoji)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if emoji.NoDefault {
|
||||||
|
emojis = make(map[string]string)
|
||||||
|
}
|
||||||
|
|
||||||
for _, item := range emoji.Emojis {
|
for _, item := range emoji.Emojis {
|
||||||
for ikey, ival := range item {
|
for ikey, ival := range item {
|
||||||
|
|
Loading…
Reference in New Issue