utils

package
v0.0.0-...-094d83a Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanUserID

func CleanUserID(input string) string

func ColorRoles

func ColorRoles(s *discordgo.Session, guildID string) (colorRoles []*discordgo.Role)

func CreationTime

func CreationTime(ID string) (t time.Time, err error)

CreationTime returns the creation time of a Snowflake ID relative to the creation of Discord. Taken from https://github.com/Moonlington/FloSelfbot/blob/master/commands/commandutils.go#L117

func DeleteChunks

func DeleteChunks(s *discordgo.Session, channelID string, messageIDs []string) (err error)

DeleteChunks will take your list of message IDs, pair them in chunks of 100, and bulk delete them

func EscapeMarkdown

func EscapeMarkdown(s string) string

func FilterColorRoles

func FilterColorRoles(roles []*discordgo.Role) (colorRoles []*discordgo.Role)

func GetChannelTypeName

func GetChannelTypeName(channelType discordgo.ChannelType) string

GetChannelTypeName returns a readable name for a discordgo.ChannelType

func MemberAdmin

func MemberAdmin(s *discordgo.Session, guildID, userID string) (bool, error)

MemberAdmin returns true if the given user has the Administrator permission, is the server owner, or has the role that's been tagged as "admin"

func MemberHasPermission

func MemberHasPermission(s *discordgo.Session, guildID, userID, role string) (bool, error)

MemberHasPermission returns true if the user is in the given role (meaning they have permisison to access/use whatever they are trying to access), or if the user is an administrator (meaning they should always have access to everything)

func MemberInRoles

func MemberInRoles(s *discordgo.Session, guildID, userID, role string) (bool, error)

MemberInRoles returns true if the given user id is in one of the given roles

func MentionMember

func MentionMember(member *discordgo.Member) string

func MentionUser

func MentionUser(s *discordgo.Session, guildID string, user *discordgo.User) string

func MentionUserFromParts

func MentionUserFromParts(s *discordgo.Session, guildID string, userID string, userName string, userDiscriminator string) string

func RemoveNitroColors

func RemoveNitroColors(s *discordgo.Session, guildID, userID string, colorRoles []*discordgo.Role) error

func Reply

func Reply(s *discordgo.Session, m *discordgo.MessageCreate, format string, args ...interface{}) error

func ReplyAuthor

func ReplyAuthor(s *discordgo.Session, channelID string, author *discordgo.User, format string, args ...interface{}) error

func ResolveInviteCode

func ResolveInviteCode(content string) (inviteCode string, ok bool)

func SendChunks

func SendChunks(prefix, suffix string, chunks []string, channelID string, s *discordgo.Session)

SendChunks will take your list of chunks, pair them together, and send them to the given channel surrounded by your given prefix and suffix If your chunks paired together don't fit in a single discord message, it will split them up, ensuring both messages that are sent are surrounded by the prefix and suffix

func SplitIntoChunks

func SplitIntoChunks(chunkSize int, data []string) (chunks [][]string)

SplitIntoChunks splits the data into chunks of chunkSize size

Types

This section is empty.

Jump to

Keyboard shortcuts

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