bot

package
v0.0.0-...-8b17de3 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

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

Bot represents the Discord bot.

func StartBot

func StartBot(config *c.DiscordConfig, store *db.Store) *Bot

StartBot starts the Discord bot. It will return a pointer to the Bot for the webserver to use.

func (*Bot) CheckRoles

func (bot *Bot) CheckRoles(roles []string) (isWhitelisted, isAdmin bool)

CheckRoles returns two booleans, first boolean returned is whether they're whitelisted or not. The second boolean returned is whether or not they're an administrator

func (*Bot) PlayerDetails

func (bot *Bot) PlayerDetails(playerID string) c.PlayerDetailsRes

PlayerDetails will resolve the Minecraft player's MCAuth state and Discord roles.

func (*Bot) VerifyPlayer

func (bot *Bot) VerifyPlayer(playerID string) (bool, string)

VerifyPlayer verifies and Minecraft player and returns a boolean and a reason why they are verified or not.

type SyncHandler

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

SyncHandler is for syncing roles of users in memory to prevent Discord API rate limiting.

func GetSyncHandler

func GetSyncHandler() SyncHandler

GetSyncHandler is used by StartBot

func (*SyncHandler) GetDiscordIDs

func (sh *SyncHandler) GetDiscordIDs() (userIDs []string)

GetDiscordIDs returns all the ID's stored.

func (*SyncHandler) GetRoles

func (sh *SyncHandler) GetRoles(userID string) (*[]string, bool)

GetRoles returns a member's roles from memory (possibly nil).

func (*SyncHandler) SyncRoles

func (sh *SyncHandler) SyncRoles(userID string, roles *[]string)

SyncRoles stores a given member's roles in memory.

Jump to

Keyboard shortcuts

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