Documentation ¶
Index ¶
- Variables
- func DiscordPremiumDisabled(err error, reason string)
- func HandleEntitlementCreate(evt *eventsystem.EventData)
- func HandleEntitlementDelete(evt *eventsystem.EventData)
- func HandleEntitlementUpdate(evt *eventsystem.EventData)
- func RegisterPlugin()
- func RunPoller()
- func UpdatePremiumSlots(ctx context.Context) error
- type DiscordPremiumPoller
- type DiscordPremiumSource
- type Plugin
Constants ¶
This section is empty.
Variables ¶
View Source
var CmdActivateTestEntitlement = &commands.YAGCommand{ CmdCategory: commands.CategoryDebug, HideFromCommandsPage: true, Name: "activateTestEntitlement", Description: "Enables Test Entitlement for a User. Bot Owner Only", HideFromHelp: true, RequiredArgs: 3, RunInDM: true, Arguments: []*dcmd.ArgDef{ {Name: "User", Type: dcmd.UserID}, }, RunFunc: util.RequireOwner(func(data *dcmd.Data) (interface{}, error) { userID := data.Args[0].Int64() entitlementData := &discordgo.EntitlementTest{ SKUID: int64(confDiscordPremiumSKUID.GetInt()), OwnerID: userID, OwnerType: discordgo.EntitlementOwnerTypeUserSubscription, } err := common.BotSession.EntitlementTestCreate(common.BotApplication.ID, entitlementData) if err != nil { return fmt.Sprintf("Failed enabling Entitlement for <@%d>: %s", userID, err), nil } return fmt.Sprintf("Enabled Entitlement for <@%d>", userID), nil }), }
View Source
var CmdDeleteTestEntitlement = &commands.YAGCommand{ CmdCategory: commands.CategoryDebug, HideFromCommandsPage: true, Name: "deleteTestEntitlement", Description: "Delete Test Entitlement for a User. Bot Owner Only", HideFromHelp: true, RequiredArgs: 3, RunInDM: true, Arguments: []*dcmd.ArgDef{ {Name: "User", Type: dcmd.UserID}, }, RunFunc: util.RequireOwner(func(data *dcmd.Data) (interface{}, error) { userID := data.Args[0].Int64() entitlements, err := common.BotSession.Entitlements(common.BotApplication.ID, &discordgo.EntitlementFilterOptions{ UserID: userID, SkuIDs: []int64{int64(confDiscordPremiumSKUID.GetInt())}, ExcludeEnded: true, }) if err != nil { return fmt.Sprintf("Failed fetching Entitlements for <@%d>: %s", userID, err), nil } if len(entitlements) < 1 { return fmt.Sprintf("No Entitlements found for <@%d>", userID), nil } for _, v := range entitlements { err := common.BotSession.EntitlementTestDelete(common.BotApplication.ID, v.ID) if err != nil { return fmt.Sprintf("Failed deleting Entitlement for <@%d>: %s", userID, err), nil } } return fmt.Sprintf("Deleted Entitlement for <@%d>", userID), nil }), }
Functions ¶
func DiscordPremiumDisabled ¶
func HandleEntitlementCreate ¶
func HandleEntitlementCreate(evt *eventsystem.EventData)
func HandleEntitlementDelete ¶
func HandleEntitlementDelete(evt *eventsystem.EventData)
func HandleEntitlementUpdate ¶
func HandleEntitlementUpdate(evt *eventsystem.EventData)
func RegisterPlugin ¶
func RegisterPlugin()
func UpdatePremiumSlots ¶
Types ¶
type DiscordPremiumPoller ¶
type DiscordPremiumPoller struct {
// contains filtered or unexported fields
}
var ActiveDiscordPremiumPoller *DiscordPremiumPoller
func InitPoller ¶
func InitPoller() *DiscordPremiumPoller
func (*DiscordPremiumPoller) GetEntitlements ¶
func (p *DiscordPremiumPoller) GetEntitlements() (entitlements []*discordgo.Entitlement)
func (*DiscordPremiumPoller) IsLastFetchSuccess ¶ added in v2.48.2
func (p *DiscordPremiumPoller) IsLastFetchSuccess() bool
func (*DiscordPremiumPoller) Poll ¶
func (p *DiscordPremiumPoller) Poll()
func (*DiscordPremiumPoller) Run ¶
func (p *DiscordPremiumPoller) Run()
type DiscordPremiumSource ¶
type DiscordPremiumSource struct{}
func (*DiscordPremiumSource) Init ¶
func (ps *DiscordPremiumSource) Init()
func (*DiscordPremiumSource) Names ¶
func (ps *DiscordPremiumSource) Names() (human string, idname string)
Click to show internal directories.
Click to hide internal directories.