Skip to content

Commit

Permalink
move private pkgs to internal pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
andersfylling committed Oct 6, 2019
1 parent e1e489c commit f6973fc
Show file tree
Hide file tree
Showing 110 changed files with 248 additions and 248 deletions.
8 changes: 4 additions & 4 deletions auditlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package disgord
import (
"net/http"

"github.com/andersfylling/disgord/constant"
"github.com/andersfylling/disgord/endpoint"
"github.com/andersfylling/disgord/httd"
"github.com/andersfylling/disgord/ratelimit"
"github.com/andersfylling/disgord/internal/constant"
"github.com/andersfylling/disgord/internal/endpoint"
"github.com/andersfylling/disgord/internal/httd"
"github.com/andersfylling/disgord/internal/ratelimit"
)

type AuditLogEvt uint
Expand Down
6 changes: 3 additions & 3 deletions auditlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"net/http"
"testing"

"github.com/andersfylling/disgord/endpoint"
"github.com/andersfylling/disgord/httd"
"github.com/andersfylling/disgord/ratelimit"
"github.com/andersfylling/disgord/internal/endpoint"
"github.com/andersfylling/disgord/internal/httd"
"github.com/andersfylling/disgord/internal/ratelimit"
)

func TestAuditLogConvertAuditLogParamsToStr(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"errors"
"time"

"github.com/andersfylling/disgord/crs"
"github.com/andersfylling/disgord/internal/crs"

"github.com/andersfylling/disgord/httd"
"github.com/andersfylling/disgord/internal/httd"
)

type cacheRegistry uint
Expand Down
6 changes: 3 additions & 3 deletions channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"net/http"
"strings"

"github.com/andersfylling/disgord/endpoint"
"github.com/andersfylling/disgord/httd"
"github.com/andersfylling/disgord/internal/endpoint"
"github.com/andersfylling/disgord/internal/httd"

"github.com/andersfylling/disgord/constant"
"github.com/andersfylling/disgord/internal/constant"
)

// Channel types
Expand Down
2 changes: 1 addition & 1 deletion channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"io/ioutil"
"testing"

"github.com/andersfylling/disgord/httd"
"github.com/andersfylling/disgord/internal/httd"
)

func TestChannel_DeepCopy(t *testing.T) {
Expand Down
10 changes: 5 additions & 5 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (
"syscall"
"time"

"github.com/andersfylling/disgord/logger"
"github.com/andersfylling/disgord/websocket"
"github.com/andersfylling/disgord/internal/logger"
"github.com/andersfylling/disgord/internal/websocket"

"github.com/andersfylling/disgord/constant"
"github.com/andersfylling/disgord/internal/constant"
"golang.org/x/net/proxy"

"github.com/andersfylling/disgord/event"
"github.com/andersfylling/disgord/httd"
"github.com/andersfylling/disgord/internal/event"
"github.com/andersfylling/disgord/internal/httd"
)

// NewRESTClient creates a Client for sending and handling Discord protocols such as rate limiting
Expand Down
2 changes: 1 addition & 1 deletion client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"testing"
"time"

"github.com/andersfylling/disgord/websocket"
"github.com/andersfylling/disgord/internal/websocket"
)

//////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion cmd/bot-REST-tester/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/andersfylling/disgord/constant"
"github.com/andersfylling/disgord/internal/constant"

"github.com/andersfylling/disgord"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/bots/middleware/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"

"github.com/andersfylling/disgord"
"github.com/andersfylling/disgord/event"
"github.com/andersfylling/disgord/internal/event"
)

func filterTestPrefix(evt interface{}) (ret interface{}) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/bots/reaction-ratelimit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"

"github.com/andersfylling/disgord"
"github.com/andersfylling/disgord/constant"
"github.com/andersfylling/disgord/internal/constant"
)

type keys struct {
Expand Down
4 changes: 2 additions & 2 deletions disgord.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ package disgord
import (
"fmt"

"github.com/andersfylling/disgord/depalias"
"github.com/andersfylling/disgord/internal/depalias"

"github.com/andersfylling/disgord/constant"
"github.com/andersfylling/disgord/internal/constant"
)

// LibraryInfo returns name + version
Expand Down
2 changes: 1 addition & 1 deletion disgord_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

"github.com/andersfylling/disgord/websocket"
"github.com/andersfylling/disgord/internal/websocket"
)

func injectRandomEvents(t *testing.T, callback func(name string, evt interface{}) error) {
Expand Down
2 changes: 1 addition & 1 deletion embed.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package disgord

import (
"github.com/andersfylling/disgord/constant"
"github.com/andersfylling/disgord/internal/constant"
)

// limitations: https://discordapp.com/developers/docs/resources/channel#embed-limits
Expand Down
8 changes: 4 additions & 4 deletions emoji.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"net/http"
"strings"

"github.com/andersfylling/disgord/constant"
"github.com/andersfylling/disgord/endpoint"
"github.com/andersfylling/disgord/httd"
"github.com/andersfylling/disgord/ratelimit"
"github.com/andersfylling/disgord/internal/constant"
"github.com/andersfylling/disgord/internal/endpoint"
"github.com/andersfylling/disgord/internal/httd"
"github.com/andersfylling/disgord/internal/ratelimit"
)

func validEmojiName(name string) bool {
Expand Down
2 changes: 1 addition & 1 deletion events.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"encoding/json"
"sync"

"github.com/andersfylling/disgord/httd"
"github.com/andersfylling/disgord/internal/httd"
)

// Resource represents a discord event.
Expand Down
2 changes: 1 addition & 1 deletion events_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions gateway_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"errors"
"sync"

"github.com/andersfylling/disgord/websocket"
"github.com/andersfylling/disgord/internal/websocket"

"github.com/andersfylling/disgord/websocket/cmd"
"github.com/andersfylling/disgord/internal/websocket/cmd"
)

// gatewayCmdName is the gateway command name for the payload to be sent to Discord over a websocket connection.
Expand Down
2 changes: 1 addition & 1 deletion generate/discorddocs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"sync"
"time"

"github.com/andersfylling/disgord/constant"
"github.com/andersfylling/disgord/internal/constant"

"github.com/gocolly/colly"
)
Expand Down
6 changes: 3 additions & 3 deletions guild.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"sort"
"strconv"

"github.com/andersfylling/disgord/endpoint"
"github.com/andersfylling/disgord/httd"
"github.com/andersfylling/disgord/internal/endpoint"
"github.com/andersfylling/disgord/internal/httd"

"github.com/andersfylling/disgord/constant"
"github.com/andersfylling/disgord/internal/constant"
)

// NOTE! Credit for defining the Permission consts in a clean way goes to DiscordGo.
Expand Down
2 changes: 1 addition & 1 deletion guild_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io/ioutil"
"testing"

"github.com/andersfylling/disgord/httd"
"github.com/andersfylling/disgord/internal/httd"
)

func TestGuildMarshal(t *testing.T) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion crs/crs.go → internal/crs/crs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

package crs

import "github.com/andersfylling/disgord/depalias"
import "github.com/andersfylling/disgord/internal/depalias"

type Snowflake = depalias.Snowflake
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion logger/zapwrap.go → internal/logger/zapwrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package logger
import (
"fmt"

"github.com/andersfylling/disgord/constant"
"github.com/andersfylling/disgord/internal/constant"
"go.uber.org/zap"
)

Expand Down
4 changes: 2 additions & 2 deletions ratelimit/ratelimits.go → internal/ratelimit/ratelimits.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package ratelimit

import (
"github.com/andersfylling/disgord/depalias"
depalias2 "github.com/andersfylling/disgord/internal/depalias"
)

type Snowflake = depalias.Snowflake
type Snowflake = depalias2.Snowflake

func GetB() *b {
return &b{}
Expand Down
12 changes: 6 additions & 6 deletions websocket/client.go → internal/websocket/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (
"sync"
"time"

"go.uber.org/atomic"
httd2 "github.com/andersfylling/disgord/internal/httd"
opcode2 "github.com/andersfylling/disgord/internal/websocket/opcode"

"github.com/andersfylling/disgord/httd"
"go.uber.org/atomic"

"github.com/andersfylling/disgord/logger"
"github.com/andersfylling/disgord/internal/logger"

"github.com/andersfylling/disgord/websocket/opcode"
"golang.org/x/net/proxy"
)

Expand Down Expand Up @@ -405,7 +405,7 @@ func (c *client) queueRequest(command string, data CmdPayload) (err error) {
}

op := CmdNameToOpCode(command, c.clientType)
if op == opcode.None {
if op == opcode2.None {
return errors.New("unsupported command: " + command)
}

Expand Down Expand Up @@ -583,7 +583,7 @@ func (c *client) receiver(ctx context.Context) {
evt := c.poolDiscordPkt.Get().(*DiscordPacket)
evt.reset()
//err = evt.UnmarshalJSON(packet) // custom unmarshal
if err = httd.Unmarshal(packet, evt); err != nil {
if err = httd2.Unmarshal(packet, evt); err != nil {
c.log.Error(c.getLogPrefix(), err, "ERRONEOUS PACKET CONTENT:", string(packet))
cancel() // sometimes a CDN or some VPN might send a HTML string..
continue
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit f6973fc

Please sign in to comment.