Skip to content

Commit

Permalink
fix: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy committed Dec 19, 2023
1 parent 7a97189 commit f84e22c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions discord/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ func (b *Bot) messageHandler(s *discordgo.Session, m *discordgo.MessageCreate) {
if strings.ToLower(m.Content) == "balance" {
balance := b.faucetWallet.GetBalance()
v, d := b.store.GetDistribution()
msg := p.Sprintf("Available faucet balance is %.4f test tPAC's🪙\n", balance.Available)
msg += p.Sprintf("A total of %.4f test tPAC's has been distributed to %d validators.\n", d, v)
msg := p.Sprintf("Available faucet balance is %.4f tPAC's🪙\n", balance.Available)
msg += p.Sprintf("A total of %.4f tPAC's has been distributed to %d validators.\n", d, v)
_, _ = s.ChannelMessageSendReply(m.ChannelID, msg, m.Reference())
return
}
Expand Down
42 changes: 21 additions & 21 deletions discord/referral.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,29 +95,29 @@ func (rs *ReferralStore) GetAllReferrals() []*Referral {

// AddPoint add one point for a referral.
func (rs *ReferralStore) AddPoint(code string) bool {
entry, found := rs.syncMap.Load(code)
if !found {
return false
}
entry, found := rs.syncMap.Load(code)
if !found {
return false
}

// updating record
referral := entry.(*Referral)
referral.Points++
rs.syncMap.Store(referral.ReferralCode, referral)

// saving record
data, err := marshaReferralJSON(rs.syncMap)
if err != nil {
log.Printf("error marshalling referral data file: %v", err)
return false
}

if err := os.WriteFile(rs.cfg.ReferralDataPath, data, 0o600); err != nil {
log.Printf("failed to write to %s: %v", rs.cfg.ReferralDataPath, err)
return false
}

return true
referral := entry.(*Referral)
referral.Points++
rs.syncMap.Store(referral.ReferralCode, referral)

// saving record
data, err := marshaReferralJSON(rs.syncMap)
if err != nil {
log.Printf("error marshalling referral data file: %v", err)
return false
}

if err := os.WriteFile(rs.cfg.ReferralDataPath, data, 0o600); err != nil {
log.Printf("failed to write to %s: %v", rs.cfg.ReferralDataPath, err)
return false
}

return true
}

func marshaReferralJSON(m *sync.Map) ([]byte, error) {
Expand Down

0 comments on commit f84e22c

Please sign in to comment.