Skip to content

Commit

Permalink
fix: coing to satoshi
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy committed Jan 6, 2024
1 parent 837bd99 commit e7127ff
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
4 changes: 2 additions & 2 deletions discord/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ func (b *Bot) messageHandler(s *discordgo.Session, m *discordgo.MessageCreate) {
msg += p.Sprintf("--------------------Validator Info----------------\n")
msg += p.Sprintf("Number: %v\n", val.Validator.Number)
msg += p.Sprintf("Last bonding height: %v\n", val.Validator.LastBondingHeight)
msg += p.Sprintf("Last sortition height: %v\n", val.Validator.LastSortitionHeight)
msg += p.Sprintf("Stake amount: %v\n", val.Validator.Stake)
msg += p.Sprintf("Last sortition height: %v tPAC's\n", val.Validator.LastSortitionHeight)
msg += p.Sprintf("Stake amount: %v\n", util.ChangeToCoin(val.Validator.Stake))
_, _ = s.ChannelMessageSendReply(m.ChannelID, msg, m.Reference())
return
}
Expand Down
14 changes: 1 addition & 13 deletions discord/ip.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package discord

import (
"context"
"encoding/json"
"io"
"net/http"
"time"
)

type GeoIP struct {
Expand All @@ -18,21 +16,11 @@ type GeoIP struct {

func getGeoIP(ip string) *GeoIP {
geo := &GeoIP{}
req, err := http.NewRequest("GET", "http://ip-api.com/json/"+ip, nil)
res, err := http.Get("http://ip-api.com/json/" + ip)
if err != nil {
return geo
}

ctx, cancel := context.WithTimeout(req.Context(), 1*time.Millisecond)
defer cancel()

req = req.WithContext(ctx)

client := http.DefaultClient
res, err := client.Do(req)
if err != nil {
return geo
}
// response.Body() is a reader type. We have
// to use ioutil.ReadAll() to read the data
// in to a byte slice(string)
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/kehiy/RoboPac

go 1.21

toolchain go1.21.1
go 1.21.1

require (
github.com/bwmarrin/discordgo v0.27.1
Expand Down

0 comments on commit e7127ff

Please sign in to comment.