File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,10 +30,9 @@ func (p *Plugin) BotInit() {
3030
3131 pubsub .AddHandler ("update_automod_legacy_rules" , HandleUpdateAutomodRules , nil )
3232 confCache = ccache .New (ccache .Configure ().MaxSize (1000 ))
33- // invitesCacheDuration is the period between ticks for the invitesCache gc in minutes
34- const invitesCacheDuration = 60
33+
3534 invitesCache = cachedGuildInvites {guilds : make (map [int64 ]GuildInvites )}
36- go invitesCache .gc (invitesCacheDuration * time .Minute )
35+ go invitesCache .gc (60 * time .Minute )
3736}
3837
3938// Invalidate the cache when the rules have changed
Original file line number Diff line number Diff line change @@ -206,6 +206,7 @@ type cachedGuildInvites struct {
206206}
207207
208208func (c * cachedGuildInvites ) gc (d time.Duration ) {
209+ logger .Info ("Init worker for invite cache GC" )
209210 ticker := time .NewTicker (d )
210211 for range ticker .C {
211212 c .tick (d )
Original file line number Diff line number Diff line change @@ -1477,6 +1477,33 @@ type WebhookParams struct {
14771477 AllowedMentions * AllowedMentions `json:"allowed_mentions,omitempty"`
14781478}
14791479
1480+ func (m * WebhookParams ) MarshalJSON () ([]byte , error ) {
1481+ type WebhookParamsAlias WebhookParams
1482+ temp := struct {
1483+ * WebhookParamsAlias
1484+ Content string `json:"content,omitempty"`
1485+ Components * []TopLevelComponent `json:"components,omitempty"`
1486+ Embeds * []* MessageEmbed `json:"embeds,omitempty"`
1487+ AllowedMentions * AllowedMentions `json:"allowed_mentions,omitempty"`
1488+ Flags * MessageFlags `json:"flags,omitempty"`
1489+ }{
1490+ WebhookParamsAlias : (* WebhookParamsAlias )(m ),
1491+ Content : m .Content ,
1492+ AllowedMentions : m .AllowedMentions ,
1493+ Flags : & m .Flags ,
1494+ }
1495+
1496+ if m .Components != nil {
1497+ temp .Components = & m .Components
1498+ }
1499+
1500+ if m .Embeds != nil {
1501+ temp .Embeds = & m .Embeds
1502+ }
1503+
1504+ return json .Marshal (temp )
1505+ }
1506+
14801507// MessageReaction stores the data for a message reaction.
14811508type MessageReaction struct {
14821509 UserID int64 `json:"user_id,string"`
You can’t perform that action at this time.
0 commit comments