diff --git a/flake.nix b/flake.nix index d8ae0d3..6212dc1 100644 --- a/flake.nix +++ b/flake.nix @@ -23,7 +23,7 @@ { mcchunkie = pkgs.buildGoModule rec { pname = "mcchunkie"; - version = "v1.0.15"; + version = "v1.0.16"; src = ./.; vendorHash = "sha256-LMWaHqmvxG17Z0zh0vmTAYDsc9UkztSCM1+jl2iXSds="; diff --git a/plugins/beer.go b/plugins/beer.go index b942670..f6c2bdf 100644 --- a/plugins/beer.go +++ b/plugins/beer.go @@ -95,7 +95,6 @@ func (h *Beer) pretty(b BeerResp, random bool) string { idx := 0 if random { - rand.Seed(time.Now().Unix()) idx = rand.Intn(len(b.Records)) } diff --git a/plugins/botsnack.go b/plugins/botsnack.go index bcaa7c5..4e0f592 100644 --- a/plugins/botsnack.go +++ b/plugins/botsnack.go @@ -3,7 +3,6 @@ package plugins import ( "math/rand" "regexp" - "time" "github.com/matrix-org/gomatrix" ) @@ -40,7 +39,6 @@ func (h *BotSnack) Process(from, msg string) string { "=.=", } - rand.Seed(time.Now().Unix()) return a[rand.Intn(len(a))] } diff --git a/plugins/groan.go b/plugins/groan.go index 7bcf6e1..546cd91 100644 --- a/plugins/groan.go +++ b/plugins/groan.go @@ -3,7 +3,6 @@ package plugins import ( "math/rand" "regexp" - "time" "github.com/matrix-org/gomatrix" ) @@ -41,9 +40,7 @@ func (h *Groan) Process(_, _ string) string { "........", } - rand.Seed(time.Now().Unix()) return a[rand.Intn(len(a))] - } // RespondText to groan events diff --git a/plugins/homestead.go b/plugins/homestead.go index 7507b65..c54a810 100644 --- a/plugins/homestead.go +++ b/plugins/homestead.go @@ -3,7 +3,7 @@ package plugins import ( "encoding/json" "fmt" - "io/ioutil" + "io" "log" "net/http" "regexp" @@ -48,7 +48,7 @@ func (h *Homestead) get(loc string) (*HomesteadResp, error) { defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, err } diff --git a/plugins/love.go b/plugins/love.go index c7a8243..05003c0 100644 --- a/plugins/love.go +++ b/plugins/love.go @@ -3,7 +3,6 @@ package plugins import ( "math/rand" "regexp" - "time" "github.com/matrix-org/gomatrix" ) @@ -38,9 +37,7 @@ func (h *LoveYou) Process(from, post string) string { "hawkard!", } - rand.Seed(time.Now().Unix()) return a[rand.Intn(len(a))] - } // SetStore we don't need a store, so just return diff --git a/plugins/thanks.go b/plugins/thanks.go index ccc6c2e..fc2cada 100644 --- a/plugins/thanks.go +++ b/plugins/thanks.go @@ -4,7 +4,6 @@ import ( "fmt" "math/rand" "regexp" - "time" "github.com/matrix-org/gomatrix" ) @@ -43,8 +42,6 @@ func (h *Thanks) Process(from, post string) string { fmt.Sprintf("you're welcome, %s", s), } - rand.Seed(time.Now().Unix()) - return a[rand.Intn(len(a))] } diff --git a/plugins/weather.go b/plugins/weather.go index 70cd628..22749f7 100644 --- a/plugins/weather.go +++ b/plugins/weather.go @@ -3,7 +3,7 @@ package plugins import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/url" "regexp" @@ -127,7 +127,7 @@ func (h *Weather) get(loc string) (*WeatherResp, error) { defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, err } diff --git a/store.go b/store.go index 1e7ba43..b363fc1 100644 --- a/store.go +++ b/store.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/gob" "fmt" - "io/ioutil" "log" "os" "path" @@ -53,7 +52,7 @@ func (s *FStore) decodeRoom(room []byte) (*gomatrix.Room, error) { // Set dumps value into a file named key func (s FStore) Set(key string, value string) { - err := ioutil.WriteFile(path.Join(string(s), key), []byte(value), 0600) + err := os.WriteFile(path.Join(string(s), key), []byte(value), 0600) if err != nil { log.Println(err) } @@ -61,7 +60,7 @@ func (s FStore) Set(key string, value string) { // Get pulls value from a file named key func (s FStore) Get(key string) (string, error) { - data, err := ioutil.ReadFile(path.Join(string(s), key)) + data, err := os.ReadFile(path.Join(string(s), key)) if err != nil { return "", nil }