common

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Version is the current dscli app version
	Version = "2.0.0"

	// MaxDiscordFileSizeDefault represents the maximum file size in bytes that
	// an attachment can be for non nitro users
	MaxDiscordFileSizeDefault = 8388119

	// MaxDiscordFileSizeNitroClassic represents the maximum file size in bytes that
	// an attachment can be for nitro classic users
	MaxDiscordFileSizeNitroClassic = 52428308

	// MaxDiscordFileSizeNitro represents the maximum file size in bytes that
	// an attachment can be for nitro users
	MaxDiscordFileSizeNitro = 104856616

	// MaxDiscordMessageRequest is the maximum number of messages you can query
	MaxDiscordMessageRequest = 100
)

Variables

View Source
var HttpClient = http.Client{Timeout: 60 * time.Second}

HttpClient is used to download file chunks from Discord

Functions

func DecodeFilename

func DecodeFilename(filename string) (string, error)

DecodeFilename decodes filename to the original filename

func EncodeFilename

func EncodeFilename(filename string) (string, error)

EncodeFilename encodes filename to Discord-safe channel name

func GetDiscordSession

func GetDiscordSession() (*discordgo.Session, *discordgo.Guild, []*discordgo.Channel, error)

GetDiscordSession gets the Discord session, guild and channels

func GetMaxFileSizeUpload

func GetMaxFileSizeUpload(session *discordgo.Session, guild *discordgo.Guild) (int, error)

GetMaxFileSizeUpload gets the maximum file size that can be uploaded

func ParseFileMap

func ParseFileMap(channels []*discordgo.Channel) (map[string]*discordgo.Channel, error)

ParseFileMap creates channel name to channel struct mapping

func PrintFiles

func PrintFiles(files []string)

PrintFiles print files in table format when applicable TODO: optimize algorithm

func SetConfigVal

func SetConfigVal(key, value, usage, prompt string) error

SetConfigVal sets value to key if value exists If value doesn't exist, then the value is read from stdin

Types

This section is empty.

Jump to

Keyboard shortcuts

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