MCPcopy Create free account
hub / github.com/MMadmer/EpicAssetsNotifyBot / NormalizeChannels

Method NormalizeChannels

internal/model/normalize.go:22–57  ·  view source on GitHub ↗
(payload any)

Source from the content-addressed store, hash-verified

20}
21
22func (n Normalizer) NormalizeChannels(payload any) []ChannelSubscription {
23 items, ok := payload.([]any)
24 if !ok {
25 return nil
26 }
27
28 seen := make(map[int64]ChannelSubscription)
29 for _, item := range items {
30 m, ok := item.(map[string]any)
31 if !ok {
32 continue
33 }
34
35 id, ok := asInt64(m["id"])
36 if !ok {
37 continue
38 }
39
40 locale := n.normalizeLocaleFromAny(m["locale"])
41 if locale == "" {
42 locale = n.baseLocale
43 }
44
45 seen[id] = ChannelSubscription{
46 ID: id,
47 ShownAssets: asBool(m["shown_assets"]),
48 Locale: locale,
49 }
50 }
51
52 out := make([]ChannelSubscription, 0, len(seen))
53 for _, v := range seen {
54 out = append(out, v)
55 }
56 return out
57}
58
59func (n Normalizer) NormalizeGuildConfigs(payload any) []GuildConfig {
60 items, ok := payload.([]any)

Callers 1

LoadLegacySnapshotFunction · 0.80

Calls 3

asInt64Function · 0.85
asBoolFunction · 0.85

Tested by

no test coverage detected