Skip to content

Commit

Permalink
Merge pull request #28 from kounoike:improvement/smart-category-chann…
Browse files Browse the repository at this point in the history
…el-cache

cacheのupdateにdiscordに問い合わせに行くのをやめて自分で追加する
  • Loading branch information
kounoike authored Mar 26, 2023
2 parents 2f329ac + 7b7837f commit a3cde88
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions discord/discord_client/discordclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (d *DiscordClient) GetCachedChannel(origCategory string, origChannelName st
if err != nil {
return nil, err
}
d.UpdateChannelsCache()
d.channelsCache = append(d.channelsCache, categoryChannel)
data := discordgo.GuildChannelCreateData{
Name: channel,
Type: discordgo.ChannelTypeGuildText,
Expand All @@ -115,7 +115,7 @@ func (d *DiscordClient) GetCachedChannel(origCategory string, origChannelName st
if err != nil {
return nil, err
}
d.UpdateChannelsCache()
d.channelsCache = append(d.channelsCache, createdChannel)
d.logger.Debug("GuildChannelCreateComplex OK", zap.String("name", channel), zap.String("cacheKey", cacheKey), zap.String("created ch.Name", createdChannel.Name))
d.channelIDCache[cacheKey] = createdChannel
return createdChannel, nil
Expand All @@ -135,7 +135,7 @@ func (d *DiscordClient) GetCachedChannel(origCategory string, origChannelName st
if err != nil {
return nil, err
}
d.UpdateChannelsCache()
d.channelsCache = append(d.channelsCache, ch)
d.logger.Debug("GuildChannelCreateComplex OK", zap.String("origChannelName", origChannelName), zap.String("cacheKey", cacheKey), zap.String("created ch.Name", ch.Name))
d.channelIDCache[cacheKey] = ch
return ch, nil
Expand Down

0 comments on commit a3cde88

Please sign in to comment.