bot

package
v0.0.0-...-ac0906f Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Arcweld

func Arcweld(wand *imagick.MagickWand, args ArcweldArgs) ([]*imagick.MagickWand, error)

Arcweld destroys an image via a combination of operations.

func Avatar

func Avatar(message *discordgo.MessageCreate, args AvatarArgs)

Avatar fetches a user's avatar.

func Deepfry

func Deepfry(wand *imagick.MagickWand, args DeepfryArgs) ([]*imagick.MagickWand, error)

Deepfry destroys an image via a combination of operations.

func Divine

func Divine(wand *imagick.MagickWand, args DivineArgs) ([]*imagick.MagickWand, error)

func DownloadImage

func DownloadImage(url string) ([]byte, error)

DownloadImage downloads an image from a given URL, returning the resulting bytes.

func Emoji

func Emoji(message *discordgo.MessageCreate, args EmojiArgs)

func FindImageURL

func FindImageURL(m *discordgo.MessageCreate) (string, error)

FindImageURL attempts to find an image in a given message, falling back to scanning message history if one cannot be found.

func Gmagik

func Gmagik(wand *imagick.MagickWand, args GmagikArgs) ([]*imagick.MagickWand, error)

Gmagik runs content-aware scaling on an image.

func Haah

func Haah(wand *imagick.MagickWand, args HaahArgs) ([]*imagick.MagickWand, error)

func HelpCommand

func HelpCommand(message *discordgo.MessageCreate, args HelpArgs)

func Hooh

func Hooh(wand *imagick.MagickWand, args HoohArgs) ([]*imagick.MagickWand, error)

func HueCycle

func HueCycle(wand *imagick.MagickWand, args HueCycleArgs) ([]*imagick.MagickWand, error)

HueCycle cycles the hue on an image

func ImageURLFromMessage

func ImageURLFromMessage(m *discordgo.Message) string

ImageURLFromMessage attempts to retrieve an image URL from a given message.

func Invert

func Invert(wand *imagick.MagickWand, _ InvertArgs) ([]*imagick.MagickWand, error)

Invert inverts an image's colours.

func JackPog

func JackPog(wand *imagick.MagickWand, args JackPogArgs) ([]*imagick.MagickWand, error)

func KeenanThumb

func KeenanThumb(wand *imagick.MagickWand, args KeenanThumbArgs) ([]*imagick.MagickWand, error)

func Lagik

func Lagik(wand *imagick.MagickWand, args LagikArgs) ([]*imagick.MagickWand, error)

Lagik runs content-aware scaling on an image.

func Magik

func Magik(wand *imagick.MagickWand, args MagikArgs) ([]*imagick.MagickWand, error)

Magik runs content-aware scaling on an image.

func MakeGraphicsFormatOpCommand

func MakeGraphicsFormatOpCommand(format graphicsFormat) func(*discordgo.MessageCreate, graphicsFormatArgs)

func MakeImageOpCommand

func MakeImageOpCommand[K ImageOperationArgs](operation ImageOperation[K]) func(*discordgo.MessageCreate, K)

MakeImageOpCommand automatically creates a Parsley command handler for a given ImageOperation

func Malt

func Malt(wand *imagick.MagickWand, args MaltArgs) ([]*imagick.MagickWand, error)

Malt mixes an image via a combination of operations.

func MitchPoint

func MitchPoint(wand *imagick.MagickWand, args MitchPointArgs) ([]*imagick.MagickWand, error)

func Modulate

func Modulate(wand *imagick.MagickWand, args ModulateArgs) ([]*imagick.MagickWand, error)

Modulate allows modifying of the brightness, saturation, and hue of an image

func Otsu

func Otsu(wand *imagick.MagickWand, args OtsuArgs) ([]*imagick.MagickWand, error)

Otsu turns the image black and white by applying an adaptive threshold using Otsu's method

func PrepareAndInvokeOperation

func PrepareAndInvokeOperation[K ImageOperationArgs](message *discordgo.MessageCreate, args K, operation ImageOperation[K])

PrepareAndInvokeOperation automatically handles invoking a given ImageOperation for a Discord message and returning the finished results

func PresidentsFrame

func PresidentsFrame(wand *imagick.MagickWand, args FrameArgs) ([]*imagick.MagickWand, error)

func Resize

func Resize(wand *imagick.MagickWand, args ResizeArgs) ([]*imagick.MagickWand, error)

Resize resizes an image.

func ResizeMaintainAspectRatio

func ResizeMaintainAspectRatio(wand *imagick.MagickWand, width uint, height uint) error

ResizeMaintainAspectRatio resizes an input wand to fit within a box of given width and height, maintaining aspect ratio

func Rotate

func Rotate(wand *imagick.MagickWand, args RotateArgs) ([]*imagick.MagickWand, error)

Rotate rotates an image.

func Schedule

func Schedule(what func(), delay time.Duration) chan bool

Schedule some func to be run in a cancelable goroutine on an interval

func SideKeenan

func SideKeenan(wand *imagick.MagickWand, args SideKeenanArgs) ([]*imagick.MagickWand, error)

func StevePoint

func StevePoint(wand *imagick.MagickWand, args StevePointArgs) ([]*imagick.MagickWand, error)

func Sticker

func Sticker(message *discordgo.MessageCreate, args struct{})

func TypingIndicator

func TypingIndicator(message *discordgo.MessageCreate) func()

TypingIndicator invokes a typing indicator in the channel of a message

func Waaw

func Waaw(wand *imagick.MagickWand, args WaawArgs) ([]*imagick.MagickWand, error)

func Woow

func Woow(wand *imagick.MagickWand, args WoowArgs) ([]*imagick.MagickWand, error)

Types

type ArcweldArgs

type ArcweldArgs struct {
	ImageURL string `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
}

func (ArcweldArgs) GetImageURL

func (args ArcweldArgs) GetImageURL() string

type AvatarArgs

type AvatarArgs struct {
	User           string `default:"" description:"User to fetch the avatar for. Must be a single Discord mention."`
	UseGuildAvatar bool   `default:"true" description:"Attempt to fetch the user's guild avatar first. Disable to always use their global avatar.'"`
}

type Bot

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

Bot represents an individual instance of Borik

var Instance *Bot

Instance is the current instance of Borik

func New

func New() (*Bot, error)

New constructs a new instance of Borik.

func (*Bot) Start

func (b *Bot) Start() error

func (*Bot) Stop

func (b *Bot) Stop()

type DeepfryArgs

type DeepfryArgs struct {
	ImageURL        string  `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	EdgeRadius      float64 `default:"100" description:"Radius of outline to draw around edges."`
	DownscaleFactor uint    `default:"2" description:"Factor to downscale the image by while processing."`
}

func (DeepfryArgs) GetImageURL

func (args DeepfryArgs) GetImageURL() string

type DivineArgs

type DivineArgs struct {
	ImageURL   string  `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	EdgeRadius float64 `default:"5" description:"Edge radius for edge detection."`
	BlurRadius float64 `default:"4" description:"Gaussian blur radius."`
	BlurSigma  float64 `default:"2" description:"Sigma value for gaussian blur."`
	Brightness float64 `default:"100" description:"Relative percentage for the brightness of the final image."`
	Saturation float64 `default:"50" description:"Relative percentage for the saturation of the final image."`
	Hue        float64 `default:"100" description:"Relative percentage for the hue of the final image."`
}

func (DivineArgs) GetImageURL

func (args DivineArgs) GetImageURL() string

type EmojiArgs

type EmojiArgs struct {
	Emoji string `description:"Emoji to fetch as an image. Leave blank to attempt to auto-locate an emoji." default:""`
}

type FrameArgs

type FrameArgs struct {
	ImageURL string `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
}

func (FrameArgs) GetImageURL

func (args FrameArgs) GetImageURL() string

type GmagikArgs

type GmagikArgs struct {
	ImageURL         string  `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	Scale            float64 `default:"1" description:"Scale of the magikification. Larger numbers produce more destroyed images."`
	Iterations       uint    `default:"5" description:"Number of iterations of magikification to run."`
	WidthMultiplier  float64 `default:"0.5" description:"Multiplier to apply to the width of the input image to produce the intermediary image."`
	HeightMultiplier float64 `default:"0.5" description:"Multiplier to apply to the height of the input image to produce the intermediary image."`
}

func (GmagikArgs) GetImageURL

func (args GmagikArgs) GetImageURL() string

type HaahArgs

type HaahArgs struct {
	ImageURL string `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
}

func (HaahArgs) GetImageURL

func (args HaahArgs) GetImageURL() string

type HelpArgs

type HelpArgs struct {
	Command string `default:"" description:"Command to get help for."`
}

type HoohArgs

type HoohArgs struct {
	ImageURL string `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
}

func (HoohArgs) GetImageURL

func (args HoohArgs) GetImageURL() string

type HueCycleArgs

type HueCycleArgs struct {
	ImageURL string `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	Steps    uint   `default:"20" description:"Number of steps to do the hue shift in."`
}

func (HueCycleArgs) GetImageURL

func (args HueCycleArgs) GetImageURL() string

type ImageOperation

type ImageOperation[K ImageOperationArgs] func(*imagick.MagickWand, K) ([]*imagick.MagickWand, error)

type ImageOperationArgs

type ImageOperationArgs interface {
	GetImageURL() string
}

type InvertArgs

type InvertArgs struct {
	ImageURL string `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
}

func (InvertArgs) GetImageURL

func (args InvertArgs) GetImageURL() string

type JackPogArgs

type JackPogArgs struct {
	ImageURL string `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	HFlip    bool   `default:"false" description:"Flip Jack horizontally."`
	VFlip    bool   `default:"false" description:"Flip Jack vertically."`
}

func (JackPogArgs) GetImageURL

func (args JackPogArgs) GetImageURL() string

type KeenanThumbArgs

type KeenanThumbArgs struct {
	ImageURL string `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	Flip     bool   `default:"false" description:"Flip Keenan the other way."`
}

func (KeenanThumbArgs) GetImageURL

func (args KeenanThumbArgs) GetImageURL() string

type LagikArgs

type LagikArgs struct {
	ImageURL string  `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	Scale    float64 `default:"1" description:"Scale of the magikification. Larger numbers produce more destroyed images."`
}

func (LagikArgs) GetImageURL

func (args LagikArgs) GetImageURL() string

type MagikArgs

type MagikArgs struct {
	ImageURL         string  `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	Scale            float64 `default:"1" description:"Scale of the magikification. Larger numbers produce more destroyed images."`
	WidthMultiplier  float64 `default:"0.5" description:"Multiplier to apply to the width of the input image to produce the intermediary image."`
	HeightMultiplier float64 `default:"0.5" description:"Multiplier to apply to the height of the input image to produce the intermediary image."`
}

func (MagikArgs) GetImageURL

func (args MagikArgs) GetImageURL() string

type MaltArgs

type MaltArgs struct {
	ImageURL string  `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	Degree   float64 `default:"45" description:"Number of degrees to rotate the image by while processing."`
}

func (MaltArgs) GetImageURL

func (args MaltArgs) GetImageURL() string

type MitchPointArgs

type MitchPointArgs struct {
	ImageURL string `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	Flip     bool   `default:"false" description:"Have Mitch pointing from the left side of the image, rather than the right side."`
}

func (MitchPointArgs) GetImageURL

func (args MitchPointArgs) GetImageURL() string

type ModulateArgs

type ModulateArgs struct {
	ImageURL   string  `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	Brightness float64 `default:"100" description:"Percent change in brightness. Numbers > 100 increase brightness, < 100 decreases."`
	Saturation float64 `default:"100" description:"Percent change in saturation. Numbers > 100 increase saturation, < 100 decreases."`
	Hue        float64 `default:"100" description:"Percent change in hue. Numbers > 100 rotates hue clockwise, < 100 rotates counter-clockwise."`
}

func (ModulateArgs) GetImageURL

func (args ModulateArgs) GetImageURL() string

type OtsuArgs

type OtsuArgs struct {
	ImageURL string `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	Invert   bool   `default:"false" description:"Invert the colors."`
}

func (OtsuArgs) GetImageURL

func (args OtsuArgs) GetImageURL() string

type ResizeArgs

type ResizeArgs struct {
	ImageURL string  `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	Mode     string  `` /* 141-byte string literal not displayed */
	Width    float64 `` /* 190-byte string literal not displayed */
	Height   float64 `` /* 192-byte string literal not displayed */
}

func (ResizeArgs) GetImageURL

func (args ResizeArgs) GetImageURL() string

type RotateArgs

type RotateArgs struct {
	ImageURL string  `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	Degrees  float64 `default:"90" description:"Number of degrees to rotate the image by."`
}

func (RotateArgs) GetImageURL

func (args RotateArgs) GetImageURL() string

type SideKeenanArgs

type SideKeenanArgs struct {
	ImageURL string `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	Flip     bool   `default:"false" description:"Flip Side Keenan the other way."`
}

func (SideKeenanArgs) GetImageURL

func (args SideKeenanArgs) GetImageURL() string

type StevePointArgs

type StevePointArgs struct {
	ImageURL string `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
	Flip     bool   `default:"false" description:"Have Steve pointing from the left side of the image, rather than the right side."`
}

func (StevePointArgs) GetImageURL

func (args StevePointArgs) GetImageURL() string

type WaawArgs

type WaawArgs struct {
	ImageURL string `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
}

func (WaawArgs) GetImageURL

func (args WaawArgs) GetImageURL() string

type WoowArgs

type WoowArgs struct {
	ImageURL string `default:"" description:"URL to the image to process. Leave blank to automatically attempt to find an image."`
}

func (WoowArgs) GetImageURL

func (args WoowArgs) GetImageURL() string

Jump to

Keyboard shortcuts

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