globals

package
v0.0.0-...-0291a47 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Interactive command aliases
	Retry = "retry"

	// Commands
	Stats                     = "stats"
	Settings                  = "settings"
	Archive                   = "archive"
	ArchiveMessage            = "Get snapshot"
	ArchiveMessageNewSnapshot = "Take snapshot"
	Help                      = "help"

	// Command options
	UrlOption             = "url"
	TakeNewSnapshotOption = "new"

	// Bot settings unique handler names
	// Booleans
	BotEnabled         = "enabled"
	AlwaysArchiveFirst = "alwayssnapshotfirst"
	Details            = "showdetails"
	RemoveRetry        = "removeretry"
	// Integers
	RetryAttempts    = "retries"
	RemoveRetryAfter = "removeretryafter"
	UTCOffset        = "utcoffset"
	// Strings
	UTCSign = "utcsign"

	// Colors
	FrenchGray = 13424349

	// Archive.org URL timestamp layout
	ArchiveOrgTimestampLayout = "20060102150405"

	// Shown to the user when `/help` is called
	BotHelpText = `**Usage**
	React to a message that has links with 🏛 (The "classical building" emoji) and the bot will respond in the channel with an archive.org link for the link(s). It saves the page to archive.org if needed.

- You can also right-click (or long press) a message and use "Get snapshot" to get a message with snapshots that only you can see- You can also right-click (or long press) a message and use "Get snapshot" to get a message with snapshots that only you can see or select "Take snapshot" to take a snapshot of the live page.

**This is a pretty good way to get around paywalls to read articles for free.**

Configure the bot:

` + "`/settings`" + `

Get a snapshot for one URL in a message visible only to you (It will ask if you want to try to find an existing snapshot or take a new one):

` + "`/archive`" + `

Get this help message:

` + "`/help`"
	BotHelpFooterText = "It can take up to a few minutes for archive.org to save a page, so if you don't get a link immediately, please be patient."
)

Variables

View Source
var (
	MinAllowedRetryAttempts      = 0
	MinAllowedRetryAttemptsFloat = float64(MinAllowedRetryAttempts)

	MaxAllowedRetryAttempts      = 5
	MaxAllowedRetryAttemptsFloat = float64(MaxAllowedRetryAttempts)

	AllowedRetryAttemptRemovalDelayValues = []int{0, 10, 30, 90, 120, 300}
	// Enabled takes a boolean and returns "enabled" or "disabled"
	Enabled = map[bool]string{
			// contains filtered or unexported fields
	}
	// Button style takes a boolean and returns a colorized button if true
	ButtonStyle = map[bool]discordgo.ButtonStyle{
				// contains filtered or unexported fields
	}
	SettingFailedResponseMessage = "Error changing setting"
	Commands                     = []*discordgo.ApplicationCommand{
		{
			Name:        Help,
			Description: "How to use this bot",
		},
		{
			Name:        Archive,
			Description: "Archive a URL directly and ephemerally, react with 🏛️ on a message instead for others to see it",
			Type:        discordgo.ChatApplicationCommand,
			Options: []*discordgo.ApplicationCommandOption{
				{
					Name:        UrlOption,
					Description: "URL to get a Wayback Machine snapshot for",
					Type:        discordgo.ApplicationCommandOptionString,
					Required:    true,
				},
				{
					Name:        TakeNewSnapshotOption,
					Description: "Whether to take a new snapshot (True) or try to look for an existing one first (False)",
					Type:        discordgo.ApplicationCommandOptionBoolean,
					Required:    true,
				},
			},
		},
		{
			Name: ArchiveMessage,
			Type: discordgo.MessageApplicationCommand,
		},
		{
			Name: ArchiveMessageNewSnapshot,
			Type: discordgo.MessageApplicationCommand,
		},
		{
			Name:        Stats,
			Description: "Show bot stats",
		},
		{
			Name:        Settings,
			Description: "Change settings",
		},
	}
	RegisteredCommands = make([]*discordgo.ApplicationCommand, len(Commands))
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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