Skip to content

Commit

Permalink
Merge for Publish (#13)
Browse files Browse the repository at this point in the history
* Logging (#11)

* add FuncName() to all errors for better debugging issues

Signed-off-by: Keith Russo <keith.russo@veteransoftware.us>

Signed-off-by: Keith Russo <keith.russo@veteransoftware.us>

* Bugfix (#12)

* Develop Version

* changes removing references to v10 during development and testing

Signed-off-by: Keith Russo <keith.russo@veteransoftware.us>

* Logging

* add FuncName() to all errors for better debugging issues

Signed-off-by: Keith Russo <keith.russo@veteransoftware.us>

* Update for New Endpoints

Signed-off-by: Keith Russo <keith.russo@veteransoftware.us>

* Bugfix

* fix incorrect http method when adding a guild member role

Signed-off-by: Keith Russo <keith.russo@veteransoftware.us>

* Updates

* update go version to 1.20
* update go.mod deps

Signed-off-by: Keith Russo <keith.russo@veteransoftware.us>

* Logging fix from merge conflict resolution

Signed-off-by: Keith Russo <keith.russo@veteransoftware.us>

---------

Signed-off-by: Keith Russo <keith.russo@veteransoftware.us>

---------

Signed-off-by: Keith Russo <keith.russo@veteransoftware.us>
  • Loading branch information
VetSoftKeith authored Mar 4, 2023
1 parent 265ed4d commit c052cd4
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 43 deletions.
2 changes: 1 addition & 1 deletion api/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package api

import "github.com/veteran-software/discord-api-wrapper/v10/oauth2"
import "github.com/veteran-software/discord-api-wrapper/oauth2"

// Application - an application which operates on Discord, commonly referred to as bots
//
Expand Down
62 changes: 34 additions & 28 deletions api/guild.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022. Veteran Software
* Copyright (c) 2022-2023. Veteran Software
*
* Discord API Wrapper - A custom wrapper for the Discord REST API developed for a proprietary project.
*
Expand Down Expand Up @@ -148,40 +148,46 @@ type SystemChannelFlags int

//goland:noinspection GoUnusedConst
const (
SuppressJoinNotifications SystemChannelFlags = 1 << 0 // Suppress member join notifications
SuppressPremiumSubscriptions SystemChannelFlags = 1 << 1 // Suppress server boost notifications
SuppressGuildReminderNotifications SystemChannelFlags = 1 << 2 // Suppress server setup tips
SuppressJoinNotificationReplies SystemChannelFlags = 1 << 3 // Hide member join sticker reply buttons
SuppressJoinNotifications SystemChannelFlags = 1 << 0 // Suppress member join notifications
SuppressPremiumSubscriptions SystemChannelFlags = 1 << 1 // Suppress server boost notifications
SuppressGuildReminderNotifications SystemChannelFlags = 1 << 2 // Suppress server setup tips
SuppressJoinNotificationReplies SystemChannelFlags = 1 << 3 // Hide member join sticker reply buttons
SuppressRoleSubscriptionPurchaseNotifications SystemChannelFlags = 1 << 4 // Suppress role subscription purchase and renewal notifications
SuppresssRoleSubscriptionPurchaseNotificationReplies SystemChannelFlags = 1 << 5 // Hide role subscription sticker reply buttons
)

// GuildFeatures - enabled guild features
type GuildFeatures string

//goland:noinspection SpellCheckingInspection,GrazieInspection,GoUnusedConst
const (
AnimatedBanner GuildFeatures = "ANIMATED_BANNER" // guild has access to set an animated guild banner image
AnimatedIcon GuildFeatures = "ANIMATED_ICON" // guild has access to set an animated guild icon
ApplicationCommandPermissionsV2 GuildFeatures = "APPLICATION_COMMAND_PERMISSIONS_V2" // guild is using the old permissions configuration behavior
AutoModeration GuildFeatures = "AUTO_MODERATION" // guild has set up auto moderation rules
Banner GuildFeatures = "BANNER" // guild has access to set a guild banner image
Community GuildFeatures = "COMMUNITY" // guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates
DeveloperSupportServer GuildFeatures = "DEVELOPER_SUPPORT_SERVER" // guild has been set as a support server on the App Directory
Discoverable GuildFeatures = "DISCOVERABLE" // guild is able to be discovered in the directory
Featurable GuildFeatures = "FEATURABLE" // guild is able to be featured in the directory
InvitesDisabled GuildFeatures = "INVITES_DISABLED" // Mutable; Pauses all invites/access to the server
InviteSplash GuildFeatures = "INVITE_SPLASH" // guild has access to set an invite splash background
MemberVerificationGateEnabled GuildFeatures = "MEMBER_VERIFICATION_GATE_ENABLED" // guild has enabled Membership Screening
MonetizationEnabled GuildFeatures = "MONETIZATION_ENABLED" // guild has enabled monetization
MoreStickers GuildFeatures = "MORE_STICKERS" // guild has increased custom sticker slots
News GuildFeatures = "NEWS" // guild has access to create news channels
Partnered GuildFeatures = "PARTNERED" // guild is partnered
PreviewEnabled GuildFeatures = "PREVIEW_ENABLED" // guild can be previewed before joining via Membership Screening or the directory
RoleIcons GuildFeatures = "ROLE_ICONS" // guild is able to set role icons
TicketedEventsEnabled GuildFeatures = "TICKETED_EVENTS_ENABLED" // guild has enabled ticketed events
VanityURL GuildFeatures = "VANITY_URL" // guild has access to set a vanity URL
Verified GuildFeatures = "VERIFIED" // guild is verified
VipRegions GuildFeatures = "VIP_REGIONS" // guild has access to set 384kbps bitrate in voice (previously VIP voice servers)
WelcomeScreenEnabled GuildFeatures = "WELCOME_SCREEN_ENABLED" // guild has enabled the welcome screen
AnimatedBanner GuildFeatures = "ANIMATED_BANNER" // guild has access to set an animated guild banner image
AnimatedIcon GuildFeatures = "ANIMATED_ICON" // guild has access to set an animated guild icon
ApplicationCommandPermissionsV2 GuildFeatures = "APPLICATION_COMMAND_PERMISSIONS_V2" // guild is using the old permissions configuration behavior
AutoModeration GuildFeatures = "AUTO_MODERATION" // guild has set up auto moderation rules
Banner GuildFeatures = "BANNER" // guild has access to set a guild banner image
Community GuildFeatures = "COMMUNITY" // Mutable; guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates
CreatorMonetizableProvisional GuildFeatures = "CREATOR_MONETIZABLE_PROVISIONAL" // guild has enabled monetization
CreatorStorePage GuildFeatures = "CREATOR_STORE_PAGE" // guild has enabled the role subscription promo page
DeveloperSupportServer GuildFeatures = "DEVELOPER_SUPPORT_SERVER" // guild has been set as a support server on the App Directory
Discoverable GuildFeatures = "DISCOVERABLE" // Mutable; guild is able to be discovered in the directory
Featurable GuildFeatures = "FEATURABLE" // guild is able to be featured in the directory
InvitesDisabled GuildFeatures = "INVITES_DISABLED" // Mutable; Pauses all invites/access to the server
InviteSplash GuildFeatures = "INVITE_SPLASH" // guild has access to set an invite splash background
MemberVerificationGateEnabled GuildFeatures = "MEMBER_VERIFICATION_GATE_ENABLED" // guild has enabled Membership Screening
MonetizationEnabled GuildFeatures = "MONETIZATION_ENABLED" // guild has enabled monetization
MoreStickers GuildFeatures = "MORE_STICKERS" // guild has increased custom sticker slots
News GuildFeatures = "NEWS" // guild has access to create news channels
Partnered GuildFeatures = "PARTNERED" // guild is partnered
PreviewEnabled GuildFeatures = "PREVIEW_ENABLED" // guild can be previewed before joining via Membership Screening or the directory
RoleIcons GuildFeatures = "ROLE_ICONS" // guild is able to set role icons
RoleSubscriptionsAvailableForPurchase GuildFeatures = "ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE" // guild has role subscriptions that can be purchased
RoleSubscriptionsEnabled GuildFeatures = "ROLE_SUBSCRIPTIONS_ENABLED" // guild has enabled role subscriptions
TicketedEventsEnabled GuildFeatures = "TICKETED_EVENTS_ENABLED" // guild has enabled ticketed events
VanityURL GuildFeatures = "VANITY_URL" // guild has access to set a vanity URL
Verified GuildFeatures = "VERIFIED" // guild is verified
VipRegions GuildFeatures = "VIP_REGIONS" // guild has access to set 384kbps bitrate in voice (previously VIP voice servers)
WelcomeScreenEnabled GuildFeatures = "WELCOME_SCREEN_ENABLED" // guild has enabled the welcome screen
)

// UnavailableGuild - A partial guild object.
Expand Down
4 changes: 2 additions & 2 deletions api/guild_endpoints.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022. Veteran Software
* Copyright (c) 2022-2023. Veteran Software
*
* Discord API Wrapper - A custom wrapper for the Discord REST API developed for a proprietary project.
*
Expand Down Expand Up @@ -368,7 +368,7 @@ type ModifyCurrentMemberJSON struct {
func (g *Guild) AddGuildMemberRole(user *User, role *Snowflake, reason *string) {
u := parseRoute(fmt.Sprintf(addGuildMemberRole, api, g.ID.String(), user.ID.String(), role.String()))

_ = firePatchRequest(u, nil, reason)
_ = firePutRequest(u, nil, reason)
}

// RemoveGuildMemberRole - Removes a role from a guild member.
Expand Down
5 changes: 3 additions & 2 deletions api/user.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022. Veteran Software
* Copyright (c) 2022-2023. Veteran Software
*
* Discord API Wrapper - A custom wrapper for the Discord REST API developed for a proprietary project.
*
Expand Down Expand Up @@ -118,9 +118,10 @@ const (
Spotify Service = "spotify"
Skype Service = "skype"
Steam Service = "steam"
TikTok Service = "tiktok"
Twitch Service = "twitch"
Twitter Service = "twitter"
XBox Service = "xbox"
Xbox Service = "xbox"
YouTube Service = "youtube"
)

Expand Down
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
module github.com/veteran-software/discord-api-wrapper/v10
module github.com/veteran-software/discord-api-wrapper

go 1.19
go 1.20

require (
github.com/gojek/heimdall/v7 v7.0.2
github.com/sirupsen/logrus v1.9.0
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816
github.com/veteran-software/discord-api-wrapper/v10 v10.0.16-REST
github.com/vincent-petithory/dataurl v1.0.0
)

Expand All @@ -15,7 +16,7 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/stretchr/testify v1.8.1 // indirect
golang.org/x/sys v0.2.0 // indirect
github.com/stretchr/testify v1.8.2 // indirect
golang.org/x/sys v0.5.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,21 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 h1:J6v8awz+me+xeb/cUTotKgceAYouhIB3pjzgRd6IlGk=
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816/go.mod h1:tzym/CEb5jnFI+Q0k4Qq3+LvRF4gO3E2pxS8fHP8jcA=
github.com/veteran-software/discord-api-wrapper/v10 v10.0.16-REST h1:wJHyqRncmMeL08Bw/hA4ieiGwLkA68ML23LS6RelPDo=
github.com/veteran-software/discord-api-wrapper/v10 v10.0.16-REST/go.mod h1:9lyDX9eMRRbOi44rUfFRr4c7HkPxSpFUoxDSEhgBfpI=
github.com/vincent-petithory/dataurl v1.0.0 h1:cXw+kPto8NLuJtlMsI152irrVw9fRDX8AbShPRpg2CI=
github.com/vincent-petithory/dataurl v1.0.0/go.mod h1:FHafX5vmDzyP+1CQATJn7WFKc9CvnvxyvZy6I1MrG/U=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package main

import (
_ "github.com/veteran-software/discord-api-wrapper/v10/api"
_ "github.com/veteran-software/discord-api-wrapper/v10/logging"
_ "github.com/veteran-software/discord-api-wrapper/api"
_ "github.com/veteran-software/discord-api-wrapper/logging"
)

func main() {
Expand Down

0 comments on commit c052cd4

Please sign in to comment.