Skip to content

Commit 35cad72

Browse files
committed
Update
* move logs on CreateMessage to debug level, so they won't spam logs * remove Heimdall http client in favor of standard one Signed-off-by: Keith Russo <[email protected]>
1 parent 1217267 commit 35cad72

File tree

5 files changed

+6
-49
lines changed

5 files changed

+6
-49
lines changed

api/channel_endpoints.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ func (c *Channel) CreateMessage(payload CreateMessageJSON) (*Message, error) {
284284
var message *Message
285285
responseBytes, err := firePostRequest(u, payload, nil)
286286
if err != nil {
287-
log.Errorln(log.Discord, log.FuncName(), err)
287+
log.Debugln(log.Discord, log.FuncName(), err)
288288
return nil, err
289289
}
290290

api/permissions.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ func CanManageWebhooks(member *GuildMember, channel *Channel) bool {
565565
return false
566566
}
567567

568-
// CanManageEmojisAndStickers - Allows management and editing of emojis and stickers
568+
// CanManageGuildExpressions - Allows management and editing of emojis and stickers
569569
//
570570
//goland:noinspection GoUnusedExportedFunction
571571
func CanManageGuildExpressions(member *GuildMember, channel *Channel) bool {

api/rest.go

+4-10
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,9 @@ import (
2626
"strings"
2727
"time"
2828

29-
"github.com/gojek/heimdall/v7/httpclient"
3029
log "github.com/veteran-software/nowlive-logging"
3130
)
3231

33-
//goland:noinspection SpellCheckingInspection
34-
var (
35-
timeout = 2000 * time.Millisecond
36-
37-
httpClient = httpclient.NewClient(httpclient.WithHTTPTimeout(timeout))
38-
)
39-
4032
var (
4133
// Rest - Holds the rate limit buckets
4234
Rest *RateLimiter
@@ -111,7 +103,8 @@ func (r *RateLimiter) lockedRequest(method, route, contentType string,
111103

112104
req.Header.Set("User-Agent", UserAgent)
113105

114-
resp, err := httpClient.Do(req)
106+
client := http.Client{}
107+
resp, err := client.Do(req)
115108

116109
if err != nil {
117110
_ = bucket.release(nil)
@@ -175,7 +168,8 @@ func fireGetRequest(u *url.URL, data any, reason *string) ([]byte, error) {
175168
func firePostRequest(u *url.URL, data any, reason *string) ([]byte, error) {
176169
resp, err := Rest.Request(http.MethodPost, u.String(), data, reason)
177170
if err != nil {
178-
log.Errorln(log.FuncName(), err)
171+
// Allow this log to bubble up to the method call
172+
log.Debugln(log.Discord, log.FuncName(), err)
179173
return nil, err
180174
}
181175
defer func(Body io.ReadCloser) {

go.mod

-7
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,14 @@ module github.com/veteran-software/discord-api-wrapper/v10
33
go 1.20
44

55
require (
6-
github.com/gojek/heimdall/v7 v7.0.2
76
github.com/sirupsen/logrus v1.9.0
87
github.com/veteran-software/nowlive-logging v1.0.6
98
github.com/vincent-petithory/dataurl v1.0.0
109
golang.org/x/net v0.9.0
1110
)
1211

1312
require (
14-
github.com/davecgh/go-spew v1.1.1 // indirect
15-
github.com/gojek/valkyrie v0.0.0-20190210220504-8f62c1e7ba45 // indirect
16-
github.com/pkg/errors v0.9.1 // indirect
17-
github.com/pmezard/go-difflib v1.0.0 // indirect
18-
github.com/stretchr/objx v0.5.0 // indirect
1913
github.com/stretchr/testify v1.8.2 // indirect
2014
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 // indirect
2115
golang.org/x/sys v0.7.0 // indirect
22-
gopkg.in/yaml.v3 v3.0.1 // indirect
2316
)

go.sum

-30
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,34 @@
1-
github.com/DataDog/datadog-go v3.7.1+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
2-
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
3-
github.com/cactus/go-statsd-client/statsd v0.0.0-20200423205355-cb0885a1018c/go.mod h1:l/bIBLeOl9eX+wxJAzxS4TveKRtAqlyDpHjhkfO0MEI=
41
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
52
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
63
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7-
github.com/gojek/heimdall/v7 v7.0.2 h1:+YutGXZ8oEWbCJIwjRnkKmoTl+Oxt1Urs3hc/FR0sxU=
8-
github.com/gojek/heimdall/v7 v7.0.2/go.mod h1:Z43HtMid7ysSjmsedPTXAki6jcdcNVnjn5pmsTyiMic=
9-
github.com/gojek/valkyrie v0.0.0-20180215180059-6aee720afcdf/go.mod h1:QzhUKaYKJmcbTnCYCAVQrroCOY7vOOI8cSQ4NbuhYf0=
10-
github.com/gojek/valkyrie v0.0.0-20190210220504-8f62c1e7ba45 h1:jrnJW3T+GsaQCD26fe6ERlNpgLB5HlekzBU4lOscr80=
11-
github.com/gojek/valkyrie v0.0.0-20190210220504-8f62c1e7ba45/go.mod h1:QzhUKaYKJmcbTnCYCAVQrroCOY7vOOI8cSQ4NbuhYf0=
12-
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
13-
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
144
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
15-
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
16-
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
175
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
186
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
19-
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
207
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
218
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
229
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
23-
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
24-
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
2510
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
2611
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
27-
github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
2812
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
29-
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
3013
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
3114
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
32-
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
3315
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
3416
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
3517
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
3618
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
3719
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
3820
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 h1:J6v8awz+me+xeb/cUTotKgceAYouhIB3pjzgRd6IlGk=
3921
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816/go.mod h1:tzym/CEb5jnFI+Q0k4Qq3+LvRF4gO3E2pxS8fHP8jcA=
40-
github.com/veteran-software/nowlive-logging v1.0.4 h1:RlsmGraZDQqffQLH8w/h3ZdP48WRed+bW5tnFb61kfI=
41-
github.com/veteran-software/nowlive-logging v1.0.4/go.mod h1:H6psieU82PyObRKV1cHmcq3xFFtE5XlP7O+I1HanjLI=
4222
github.com/veteran-software/nowlive-logging v1.0.6 h1:CvbjSNNLaTemD6t/MBvrJwVbH9JvjJ7Uh3183iZsD+o=
4323
github.com/veteran-software/nowlive-logging v1.0.6/go.mod h1:H6psieU82PyObRKV1cHmcq3xFFtE5XlP7O+I1HanjLI=
4424
github.com/vincent-petithory/dataurl v1.0.0 h1:cXw+kPto8NLuJtlMsI152irrVw9fRDX8AbShPRpg2CI=
4525
github.com/vincent-petithory/dataurl v1.0.0/go.mod h1:FHafX5vmDzyP+1CQATJn7WFKc9CvnvxyvZy6I1MrG/U=
46-
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
47-
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
48-
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
49-
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
5026
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
5127
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
52-
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
5328
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
5429
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
55-
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
56-
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5730
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
5831
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
59-
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
60-
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
61-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
6232
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
6333
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
6434
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

0 commit comments

Comments
 (0)