discordpremiumsource

package
v2.47.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

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 DiscordPremiumDisabled(err error, reason string)

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 RunPoller

func RunPoller()

func UpdatePremiumSlots

func UpdatePremiumSlots(ctx context.Context) error

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) 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)

type Plugin

type Plugin struct{}

func (*Plugin) AddCommands

func (p *Plugin) AddCommands()

func (*Plugin) BotInit

func (p *Plugin) BotInit()

func (*Plugin) InitWeb

func (p *Plugin) InitWeb()

func (*Plugin) PluginInfo

func (p *Plugin) PluginInfo() *common.PluginInfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL