Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Github CI versions #1381

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 16 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
on:
push:
branches:
- master
pull_request:

name: CI
Expand All @@ -8,53 +10,45 @@ jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.18
- name: Code
uses: actions/checkout@v3
go-version: "1.22"
- name: Check diff between gofmt and code
run: diff <(gofmt -d .) <(echo -n)

test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.13, 1.14, 1.15, 1.16, 1.17, 1.18]
go-version: ["1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.21", "1.22"]
steps:
- name: Code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Code
uses: actions/checkout@v3
- run: go test -v -race ./...

lint:
runs-on: ubuntu-latest
steps:
- name: Code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.18
- name: Code
uses: actions/checkout@v3
go-version: "1.22"
- name: Go vet
run: go vet -x ./...

- name: GolangCI-Lint
uses: golangci/golangci-lint-action@v3
if: github.event.name == 'pull_request'
with:
only-new-issues: true
skip-pkg-cache: true
skip-build-cache: true

- name: GolangCI-Lint
if: github.event.name != 'pull_request' # See https://github.com/golangci/golangci-lint-action/issues/362
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2

$(go env GOPATH)/bin/golangci-lint run

version: v1.54
args: --out-format colored-line-number
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

7 changes: 5 additions & 2 deletions discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ const VERSION = "0.27.1"

// New creates a new Discord session with provided token.
// If the token is for a bot, it must be prefixed with "Bot "
// e.g. "Bot ..."
//
// e.g. "Bot ..."
//
// Or if it is an OAuth2 token, it must be prefixed with "Bearer "
// e.g. "Bearer ..."
//
// e.g. "Bearer ..."
func New(token string) (s *Session, err error) {

// Create an empty Session interface.
Expand Down
4 changes: 2 additions & 2 deletions discord_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"time"
)

//////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////// VARS NEEDED FOR TESTING
// ////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////// VARS NEEDED FOR TESTING
var (
dg *Session // Stores a global discordgo user session
dgBot *Session // Stores a global discordgo bot session
Expand Down
10 changes: 6 additions & 4 deletions event.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,14 @@ func (s *Session) addEventHandlerOnce(eventHandler EventHandler) func() {
// to a struct corresponding to the event for which you want to listen.
//
// eg:
// Session.AddHandler(func(s *discordgo.Session, m *discordgo.MessageCreate) {
// })
//
// Session.AddHandler(func(s *discordgo.Session, m *discordgo.MessageCreate) {
// })
//
// or:
// Session.AddHandler(func(s *discordgo.Session, m *discordgo.PresenceUpdate) {
// })
//
// Session.AddHandler(func(s *discordgo.Session, m *discordgo.PresenceUpdate) {
// })
//
// List of events can be found at this page, with corresponding names in the
// library for each event: https://discord.com/developers/docs/topics/gateway#event-names
Expand Down
9 changes: 5 additions & 4 deletions logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ var Logger func(msgL, caller int, format string, a ...interface{})

// msglog provides package wide logging consistency for discordgo
// the format, a... portion this command follows that of fmt.Printf
// msgL : LogLevel of the message
// caller : 1 + the number of callers away from the message source
// format : Printf style message format
// a ... : comma separated list of values to pass
//
// msgL : LogLevel of the message
// caller : 1 + the number of callers away from the message source
// format : Printf style message format
// a ... : comma separated list of values to pass
func msglog(msgL, caller int, format string, a ...interface{}) {

if Logger != nil {
Expand Down
16 changes: 10 additions & 6 deletions oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ type Team struct {
}

// Application returns an Application structure of a specific Application
// appID : The ID of an Application
//
// appID : The ID of an Application
func (s *Session) Application(appID string) (st *Application, err error) {

body, err := s.RequestWithBucketID("GET", EndpointOAuth2Application(appID), nil, EndpointOAuth2Application(""))
Expand All @@ -66,8 +67,9 @@ func (s *Session) Applications() (st []*Application, err error) {
}

// ApplicationCreate creates a new Application
// name : Name of Application / Bot
// uris : Redirect URIs (Not required)
//
// name : Name of Application / Bot
// uris : Redirect URIs (Not required)
func (s *Session) ApplicationCreate(ap *Application) (st *Application, err error) {

data := struct {
Expand All @@ -85,7 +87,8 @@ func (s *Session) ApplicationCreate(ap *Application) (st *Application, err error
}

// ApplicationUpdate updates an existing Application
// var : desc
//
// var : desc
func (s *Session) ApplicationUpdate(appID string, ap *Application) (st *Application, err error) {

data := struct {
Expand All @@ -103,7 +106,8 @@ func (s *Session) ApplicationUpdate(appID string, ap *Application) (st *Applicat
}

// ApplicationDelete deletes an existing Application
// appID : The ID of an Application
//
// appID : The ID of an Application
func (s *Session) ApplicationDelete(appID string) (err error) {

_, err = s.RequestWithBucketID("DELETE", EndpointOAuth2Application(appID), nil, EndpointOAuth2Application(""))
Expand Down Expand Up @@ -139,7 +143,7 @@ func (s *Session) ApplicationAssets(appID string) (ass []*Asset, err error) {

// ApplicationBotCreate creates an Application Bot Account
//
// appID : The ID of an Application
// appID : The ID of an Application
//
// NOTE: func name may change, if I can think up something better.
func (s *Session) ApplicationBotCreate(appID string) (st *User, err error) {
Expand Down
5 changes: 3 additions & 2 deletions state.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ func (s *State) GuildRemove(guild *Guild) error {

// Guild gets a guild by ID.
// Useful for querying if @me is in a guild:
// _, err := discordgo.Session.State.Guild(guildID)
// isInGuild := err == nil
//
// _, err := discordgo.Session.State.Guild(guildID)
// isInGuild := err == nil
func (s *State) Guild(guildID string) (*Guild, error) {
if s == nil {
return nil, ErrNilState
Expand Down
16 changes: 8 additions & 8 deletions wsapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,10 +682,10 @@ type voiceChannelJoinOp struct {

// ChannelVoiceJoin joins the session user to a voice channel.
//
// gID : Guild ID of the channel to join.
// cID : Channel ID of the channel to join.
// mute : If true, you will be set to muted upon joining.
// deaf : If true, you will be set to deafened upon joining.
// gID : Guild ID of the channel to join.
// cID : Channel ID of the channel to join.
// mute : If true, you will be set to muted upon joining.
// deaf : If true, you will be set to deafened upon joining.
func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (voice *VoiceConnection, err error) {

s.log(LogInformational, "called")
Expand Down Expand Up @@ -729,10 +729,10 @@ func (s *Session) ChannelVoiceJoin(gID, cID string, mute, deaf bool) (voice *Voi
//
// This should only be used when the VoiceServerUpdate will be intercepted and used elsewhere.
//
// gID : Guild ID of the channel to join.
// cID : Channel ID of the channel to join, leave empty to disconnect.
// mute : If true, you will be set to muted upon joining.
// deaf : If true, you will be set to deafened upon joining.
// gID : Guild ID of the channel to join.
// cID : Channel ID of the channel to join, leave empty to disconnect.
// mute : If true, you will be set to muted upon joining.
// deaf : If true, you will be set to deafened upon joining.
func (s *Session) ChannelVoiceJoinManual(gID, cID string, mute, deaf bool) (err error) {

s.log(LogInformational, "called")
Expand Down
Loading