commands

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: AGPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChartCommandData = &discordgo.ApplicationCommand{
	Name:        "chart",
	Description: "View a chart of your activity",
	Options: []*discordgo.ApplicationCommandOption{
		{
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Name:        "duration",
			Description: "View a chart of your daily activity duration",
			Options: []*discordgo.ApplicationCommandOption{
				{
					Type:        discordgo.ApplicationCommandOptionString,
					Name:        "start",
					Description: "The start date of the chart",
					Required:    false,
				},
				{
					Type:        discordgo.ApplicationCommandOptionString,
					Name:        "end",
					Description: "The end date of the chart",
					Required:    false,
				},
			},
		},
		{
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Name:        "youtube-channel",
			Description: "View a chart of your YouTube activity by channel",
			Options: []*discordgo.ApplicationCommandOption{
				{
					Type:        discordgo.ApplicationCommandOptionString,
					Name:        "type",
					Description: "The type of chart to view",
					Required:    false,
					Choices: []*discordgo.ApplicationCommandOptionChoice{
						{
							Name:  "pie",
							Value: "pie",
						},
						{
							Name:  "bar",
							Value: "bar",
						},
					},
				},
				{
					Type:        discordgo.ApplicationCommandOptionString,
					Name:        "start",
					Description: "The start date of the chart",
					Required:    false,
				},
				{
					Type:        discordgo.ApplicationCommandOptionString,
					Name:        "end",
					Description: "The end date of the chart",
					Required:    false,
				},
			},
		},
	},
}
View Source
var ConfigCommandData = &discordgo.ApplicationCommand{
	Name:        "config",
	Description: "Configure your timezone and active guilds",
	Options: []*discordgo.ApplicationCommandOption{
		{
			Name:         "timezone",
			Description:  "Set your timezone",
			Type:         discordgo.ApplicationCommandOptionString,
			Required:     false,
			Autocomplete: true,
		},
		{
			Name:         "vn-speed",
			Description:  "Set your VN reading speed (char/min)",
			Type:         discordgo.ApplicationCommandOptionNumber,
			Required:     false,
			Autocomplete: true,
		},
		{
			Name:         "book-speed",
			Description:  "Set your book reading speed (page/min)",
			Type:         discordgo.ApplicationCommandOptionNumber,
			Required:     false,
			Autocomplete: true,
		},
		{
			Name:         "manga-speed",
			Description:  "Set your manga reading speed (page/min)",
			Type:         discordgo.ApplicationCommandOptionNumber,
			Required:     false,
			Autocomplete: true,
		},
		{
			Name:         "daily-goal",
			Description:  "Set your daily immersion goal (minutes)",
			Type:         discordgo.ApplicationCommandOptionInteger,
			MinValue:     ref.New(0.0),
			MaxValue:     1440,
			Required:     false,
			Autocomplete: false,
		},
	},
}
View Source
var ExportCommandData = &discordgo.ApplicationCommand{
	Name:        "export",
	Description: "Export your activities to a JSONL file.",
}
View Source
var GoalCommandData = &discordgo.ApplicationCommand{
	Name:        "goal",
	Description: "Manage your goals.",
	Options: []*discordgo.ApplicationCommandOption{
		{
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Name:        "create",
			Description: "Create a new goal.",
			Options: []*discordgo.ApplicationCommandOption{
				{
					Type:        discordgo.ApplicationCommandOptionString,
					Name:        "name",
					Description: "The name of the goal.",
					Required:    true,
				},
				{
					Type:        discordgo.ApplicationCommandOptionInteger,
					Name:        "target",
					Description: "The target duration of the goal.",
					Required:    true,
				},
				{
					Type:         discordgo.ApplicationCommandOptionString,
					Name:         "cron",
					Description:  "The cron expression for the goal.",
					Required:     true,
					Autocomplete: true,
				},
				{
					Type:        discordgo.ApplicationCommandOptionString,
					Name:        "activity-type",
					Description: "The type of activity to track.",
					Required:    false,
					Choices: []*discordgo.ApplicationCommandOptionChoice{
						{
							Name:  "Listening",
							Value: activities.ActivityImmersionTypeListening,
						},
						{
							Name:  "Reading",
							Value: activities.ActivityImmersionTypeReading,
						},
					},
				},
				{
					Type:        discordgo.ApplicationCommandOptionString,
					Name:        "media-type",
					Description: "The type of media to track.",
					Required:    false,
					Choices: []*discordgo.ApplicationCommandOptionChoice{
						{
							Name:  "Visual Novel",
							Value: activities.ActivityMediaTypeVisualNovel,
						},
						{
							Name:  "Book",
							Value: activities.ActivityMediaTypeBook,
						},
						{
							Name:  "Manga",
							Value: activities.ActivityMediaTypeManga,
						},
						{
							Name:  "Anime",
							Value: activities.ActivityMediaTypeAnime,
						},
						{
							Name:  "Video",
							Value: activities.ActivityMediaTypeVideo,
						},
					},
				},
				{
					Type:        discordgo.ApplicationCommandOptionString,
					Name:        "youtube-channels",
					Description: "The YouTube channels to track (comma separated, e.g. @HakuiKoyori,@ui_shig,@MinatoAqua).",
					Required:    false,
				},
			},
		},
		{
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Name:        "list",
			Description: "List your goals.",
		},
		{
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Name:        "delete",
			Description: "Delete a goal.",
			Options: []*discordgo.ApplicationCommandOption{
				{
					Type:        discordgo.ApplicationCommandOptionInteger,
					Name:        "id",
					Description: "The ID of the goal.",
					Required:    true,
				},
			},
		},
	},
}
View Source
var GuildConfigCommandData = &discordgo.ApplicationCommand{
	Name:                     "guild-config",
	Description:              "Configure guild settings",
	DMPermission:             ref.New(false),
	DefaultMemberPermissions: ref.New(int64(discordgo.PermissionAdministrator)),
	Options: []*discordgo.ApplicationCommandOption{
		{
			Name:         "timezone",
			Description:  "Set the guild's timezone",
			Type:         discordgo.ApplicationCommandOptionString,
			Required:     false,
			Autocomplete: true,
		},
	},
}
View Source
var HistoryCommandData = &discordgo.ApplicationCommand{
	Name:        "history",
	Description: "View your activity history",
	Options: []*discordgo.ApplicationCommandOption{
		{
			Name:        "show-ids",
			Type:        discordgo.ApplicationCommandOptionBoolean,
			Description: "Show the IDs of the activities.",
			Required:    false,
		},
		{
			Name:        "quick-nav",
			Type:        discordgo.ApplicationCommandOptionBoolean,
			Description: "Enable quick navigation buttons.",
			Required:    false,
		},
		{
			Name:        "user",
			Type:        discordgo.ApplicationCommandOptionUser,
			Description: "The user to view the history of (defaults to yourself).",
			Required:    false,
		},
		{
			Name:        "page",
			Type:        discordgo.ApplicationCommandOptionInteger,
			MinValue:    ref.New(1.0),
			Description: "The page of history to view.",
			Required:    false,
		},
	},
}
View Source
var ImportCommandData = &discordgo.ApplicationCommand{
	Name:        "import",
	Description: "Import new data and manage your previous imports",
	Options: []*discordgo.ApplicationCommandOption{
		{
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Name:        "botsu-file",
			Description: "Import new data",
			Options: []*discordgo.ApplicationCommandOption{
				{
					Type:        discordgo.ApplicationCommandOptionAttachment,
					Name:        "file",
					Description: "Import your data from a file exported by Botsu",
					Required:    true,
				},
			},
		},
		{
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Name:        "list",
			Description: "List your previous imports",
		},
		{
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Name:        "undo",
			Description: "Undo an import by timestamp",
			Options: []*discordgo.ApplicationCommandOption{
				{
					Type:        discordgo.ApplicationCommandOptionString,
					Name:        "timestamp",
					Description: "The timestamp of the import to undo (see `/import list`)",
					Required:    true,
				},
			},
		},
	},
}
View Source
var LeaderboardCommandData = &discordgo.ApplicationCommand{
	Name:         "leaderboard",
	Description:  "View the leaderboard",
	DMPermission: ref.New(false),
	Options: []*discordgo.ApplicationCommandOption{
		{
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Name:        "day",
			Description: "View the leaderboard for the current day",
		},
		{
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Name:        "week",
			Description: "View the leaderboard for the current week",
		},
		{
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Name:        "month",
			Description: "View the leaderboard for the current month",
		},
		{
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Name:        "year",
			Description: "View the leaderboard for the current year",
		},
		{
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Name:        "all",
			Description: "View the leaderboard for all time",
		},
		{
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Name:        "custom",
			Description: "View the leaderboard over a custom time period",
			Options: []*discordgo.ApplicationCommandOption{
				{
					Type:        discordgo.ApplicationCommandOptionString,
					Name:        "start",
					Description: "The start date",
					Required:    true,
				},
				{
					Type:        discordgo.ApplicationCommandOptionString,
					Name:        "end",
					Description: "The end date",
					Required:    true,
				},
			},
		},
	},
}
View Source
var LogCommandData = &discordgo.ApplicationCommand{
	Name:        "log",
	Description: "Log your time spent on language immersion",
	Options: []*discordgo.ApplicationCommandOption{
		{
			Name:        "manual",
			Description: "Manually log your immersion time",
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Options:     manualCommandOptions,
		},
		{
			Name:        "video",
			Description: "Quickly log a video you watched",
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Options:     videoCommandOptions,
		},
		{
			Name:        "vn",
			Description: "Log a visual novel you read",
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Options:     vnCommandOptions,
		},
		{
			Name:        "book",
			Description: "Log a book you read",
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Options:     bookCommandOptions,
		},
		{
			Name:        "manga",
			Description: "Log a manga you read",
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Options:     bookCommandOptions,
		},
		{
			Name:        "anime",
			Description: "Log an anime you watched",
			Type:        discordgo.ApplicationCommandOptionSubCommand,
			Options:     animeCommandOptions,
		},
	},
}
View Source
var UndoCommandData = &discordgo.ApplicationCommand{
	Name:        "undo",
	Description: "Undo the last activity you logged",
	Options: []*discordgo.ApplicationCommandOption{
		{
			Type:        discordgo.ApplicationCommandOptionInteger,
			MinValue:    ref.New(0.0),
			Name:        "id",
			Description: "The ID of the activity to undo",
			Required:    false,
		},
	},
}
View Source
var ValidTimezones = []string{
	"UTC",
	"GMT",
	"EET",
	"WET",
	"CET",
	"EST",
	"MST",
	"Cuba",
	"Egypt",
	"Eire",
	"Greenwich",
	"Iceland",
	"Iran",
	"Israel",
	"Jamaica",
	"Japan",
	"Libya",
	"Poland",
	"Portugal",
	"PRC",
	"Singapore",
	"Turkey",
	"Asia/Shanghai",
	"Asia/Chongqing",
	"Asia/Harbin",
	"Asia/Urumqi",
	"Asia/Hong_Kong",
	"Asia/Macao",
	"Asia/Taipei",
	"Asia/Tokyo",
	"Asia/Saigon",
	"Asia/Seoul",
	"Asia/Bangkok",
	"Asia/Dubai",
	"America/New_York",
	"America/Los_Angeles",
	"America/Chicago",
	"Europe/Moscow",
	"Europe/London",
	"Europe/Berlin",
	"Europe/Paris",
	"Europe/Rome",
	"Australia/Sydney",
	"Australia/Melbourne",
	"Australia/Darwin",
}

Functions

func IsValidTimezone added in v0.3.1

func IsValidTimezone(timezone string) bool

Types

type ChartCommand

type ChartCommand struct {
	// contains filtered or unexported fields
}

func (*ChartCommand) Handle

func (c *ChartCommand) Handle(ctx *bot.InteractionContext) error

type ConfigCommand

type ConfigCommand struct {
	// contains filtered or unexported fields
}

func (*ConfigCommand) Handle

func (c *ConfigCommand) Handle(ctx *bot.InteractionContext) error

type ExportCommand

type ExportCommand struct {
	// contains filtered or unexported fields
}

func (*ExportCommand) Handle

func (c *ExportCommand) Handle(ctx *bot.InteractionContext) error

type GoalCommand added in v0.3.1

type GoalCommand struct {
	// contains filtered or unexported fields
}

func NewGoalCommand added in v0.3.1

func NewGoalCommand(goals *goals.GoalService) *GoalCommand

func (*GoalCommand) Handle added in v0.3.1

func (c *GoalCommand) Handle(cmd *bot.InteractionContext) error

type GuildConfigCommand

type GuildConfigCommand struct {
	// contains filtered or unexported fields
}

func NewGuildConfigCommand

func NewGuildConfigCommand(r *guilds.GuildRepository) *GuildConfigCommand

func (*GuildConfigCommand) Handle

type HistoryCommand

type HistoryCommand struct {
	// contains filtered or unexported fields
}

func (*HistoryCommand) Handle

func (c *HistoryCommand) Handle(ctx *bot.InteractionContext) error

type ImportCommand added in v0.2.0

type ImportCommand struct {
	// contains filtered or unexported fields
}

func NewImportCommand added in v0.2.0

func NewImportCommand(r *activities.ActivityRepository) *ImportCommand

func (*ImportCommand) Handle added in v0.2.0

func (c *ImportCommand) Handle(cmd *bot.InteractionContext) error

type LeaderboardCommand

type LeaderboardCommand struct {
	// contains filtered or unexported fields
}

func (*LeaderboardCommand) Handle

type LogCommand

type LogCommand struct {
	// contains filtered or unexported fields
}

func (*LogCommand) Handle

func (c *LogCommand) Handle(ctx *bot.InteractionContext) error

type UndoCommand

type UndoCommand struct {
	// contains filtered or unexported fields
}

func (*UndoCommand) Handle

func (c *UndoCommand) Handle(ctx *bot.InteractionContext) error

Jump to

Keyboard shortcuts

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