-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
cane
authored
Sep 29, 2023
1 parent
4d0bbb2
commit 2570fd3
Showing
22 changed files
with
297 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package discord | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/disgoorg/snowflake/v2" | ||
) | ||
|
||
type Entitlement struct { | ||
ID snowflake.ID `json:"id"` | ||
SkuID snowflake.ID `json:"sku_id"` | ||
UserID *snowflake.ID `json:"user_id"` | ||
GuildID *snowflake.ID `json:"guild_id"` | ||
ApplicationID snowflake.ID `json:"application_id"` | ||
Type EntitlementType `json:"type"` | ||
Consumed bool `json:"consumed"` | ||
StartsAt *time.Time `json:"starts_at"` | ||
EndsAt *time.Time `json:"ends_at"` | ||
PromotionID *snowflake.ID `json:"promotion_id"` | ||
Deleted bool `json:"deleted"` | ||
GiftCodeFlags int `json:"gift_code_flags"` | ||
SubscriptionID *snowflake.ID `json:"subscription_id"` | ||
} | ||
|
||
type EntitlementType int | ||
|
||
const ( | ||
EntitlementTypeApplicationSubscription EntitlementType = 8 | ||
) | ||
|
||
type TestEntitlementCreate struct { | ||
SkuID snowflake.ID `json:"sku_id"` | ||
OwnerID snowflake.ID `json:"owner_id"` | ||
OwnerType EntitlementOwnerType `json:"owner_type"` | ||
} | ||
|
||
type EntitlementOwnerType int | ||
|
||
const ( | ||
EntitlementOwnerTypeGuild EntitlementOwnerType = iota + 1 | ||
EntitlementOwnerTypeUser | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package discord | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/disgoorg/snowflake/v2" | ||
) | ||
|
||
type SKU struct { | ||
ID snowflake.ID `json:"id"` | ||
Type SKUType `json:"type"` | ||
ApplicationID snowflake.ID `json:"application_id"` | ||
Name string `json:"name"` | ||
Slug string `json:"slug"` | ||
DependentSkuID *snowflake.ID `json:"dependent_sku_id"` | ||
AccessType int `json:"access_type"` | ||
Features []string `json:"features"` | ||
ReleaseDate *time.Time `json:"release_date"` | ||
Premium bool `json:"premium"` | ||
Flags SKUFlags `json:"flags"` | ||
ShowAgeGate bool `json:"show_age_gate"` | ||
} | ||
|
||
type SKUType int | ||
|
||
const ( | ||
SKUTypeSubscription SKUType = iota + 5 | ||
SKUTypeSubscriptionGroup | ||
) | ||
|
||
type SKUFlags int | ||
|
||
const ( | ||
SKUFlagGuildSubscription SKUFlags = 1 << (iota + 7) | ||
SKUFlagUserSubscription | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package events | ||
|
||
import "github.com/disgoorg/disgo/discord" | ||
|
||
type GenericEntitlementEvent struct { | ||
*GenericEvent | ||
discord.Entitlement | ||
} | ||
|
||
type EntitlementCreate struct { | ||
*GenericEntitlementEvent | ||
} | ||
|
||
type EntitlementUpdate struct { | ||
*GenericEntitlementEvent | ||
} | ||
|
||
type EntitlementDelete struct { | ||
*GenericEntitlementEvent | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package handlers | ||
|
||
import ( | ||
"github.com/disgoorg/disgo/bot" | ||
"github.com/disgoorg/disgo/events" | ||
"github.com/disgoorg/disgo/gateway" | ||
) | ||
|
||
func gatewayHandlerEntitlementCreate(client bot.Client, sequenceNumber int, shardID int, event gateway.EventEntitlementCreate) { | ||
client.EventManager().DispatchEvent(&events.EntitlementCreate{ | ||
GenericEntitlementEvent: &events.GenericEntitlementEvent{ | ||
GenericEvent: events.NewGenericEvent(client, sequenceNumber, shardID), | ||
Entitlement: event.Entitlement, | ||
}, | ||
}) | ||
} | ||
|
||
func gatewayHandlerEntitlementUpdate(client bot.Client, sequenceNumber int, shardID int, event gateway.EventEntitlementUpdate) { | ||
client.EventManager().DispatchEvent(&events.EntitlementUpdate{ | ||
GenericEntitlementEvent: &events.GenericEntitlementEvent{ | ||
GenericEvent: events.NewGenericEvent(client, sequenceNumber, shardID), | ||
Entitlement: event.Entitlement, | ||
}, | ||
}) | ||
} | ||
|
||
func gatewayHandlerEntitlementDelete(client bot.Client, sequenceNumber int, shardID int, event gateway.EventEntitlementDelete) { | ||
client.EventManager().DispatchEvent(&events.EntitlementDelete{ | ||
GenericEntitlementEvent: &events.GenericEntitlementEvent{ | ||
GenericEvent: events.NewGenericEvent(client, sequenceNumber, shardID), | ||
Entitlement: event.Entitlement, | ||
}, | ||
}) | ||
} |
Oops, something went wrong.