common

package
v0.0.0-...-37b14fa Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const UserAgent = "script:github.com/apiks/zerotsu:v3.4.2 (by /u/thechosenapiks)"

Variables

View Source
var StartTime time.Time

Functions

func CategoryParser

func CategoryParser(s *discordgo.Session, category string, guildID string) (string, string)

Parses a string for a category and returns its ID and name

func ChMention

func ChMention(ch *discordgo.Channel) string

Mentions channel by *discordgo.Channel. By Kagumi

func ChMentionID

func ChMentionID(channelID string) string

Mentions channel by channel ID. By Kagumi

func ChannelParser

func ChannelParser(s *discordgo.Session, channel string, guildID string) (string, string)

ChannelParser parses a string for a channel and returns its ID and name

func CommandErrorHandler

func CommandErrorHandler(s *discordgo.Session, m *discordgo.Message, botLog entities.Cha, err error)

Sends error message to channel command is in. If that throws an error send error message to bot log channel

func GetRedditRSSFeed

func GetRedditRSSFeed(uri string, retryTimes int) (*gofeed.Feed, int, error)

GetRedditRSSFeed parses a reddit uri for an RSS feed and returns it

func GetUserID

func GetUserID(m *discordgo.Message, messageSlice []string) (string, error)

Resolves a userID from a userID, Mention or username#discrim

func LogError

func LogError(s *discordgo.Session, botLog entities.Cha, err error)

Logs the error in the guild BotLog

func ResolveTimeFromString

func ResolveTimeFromString(given string) (ret time.Time, perma bool, err error)

ResolveTimeFromString resolves a time (usually for unbanning) from a given string formatted #w#d#h#m. This returns current time + delay. If no time is added to the offset, then this returns true for permanent. By Kagumi. Modified by Apiks

func RoleParser

func RoleParser(s *discordgo.Session, role string, guildID string) (string, string)

RoleParser parses a string for a role and returns its ID and name

func SplitLongMessage

func SplitLongMessage(message string) (split []string)

SplitLongMessage takes a message and splits it if it's longer than 1900

func Uptime

func Uptime() time.Duration

func WeekStart

func WeekStart(year, week int) time.Time

Types

type SortChannelByAlphabet

type SortChannelByAlphabet []*discordgo.Channel

Sorts channels alphabetically

func (SortChannelByAlphabet) Len

func (r SortChannelByAlphabet) Len() int

func (SortChannelByAlphabet) Less

func (r SortChannelByAlphabet) Less(i, j int) bool

func (SortChannelByAlphabet) Swap

func (r SortChannelByAlphabet) Swap(i, j int)

type SortRoleByAlphabet

type SortRoleByAlphabet []*discordgo.Role

Sorts roles alphabetically

func (SortRoleByAlphabet) Len

func (r SortRoleByAlphabet) Len() int

func (SortRoleByAlphabet) Less

func (r SortRoleByAlphabet) Less(i, j int) bool

func (SortRoleByAlphabet) Swap

func (r SortRoleByAlphabet) Swap(i, j int)

type UserAgentTransport

type UserAgentTransport struct {
	http.Transport
	http.RoundTripper
}

func (*UserAgentTransport) RoundTrip

func (c *UserAgentTransport) RoundTrip(r *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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