botaccess

package
v0.0.0-...-6929df0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HelpFeepback string = `` /* 361-byte string literal not displayed */

)

handlers

Variables

View Source
var AdminCommands = []types.AcceptedCommands{
	{
		Command:     "seequeue",
		Description: "see who is in the queue now.",
		Handler:     SeeQueueCommand,
	},
	{
		Command:     "ping",
		Description: "send a reminder to the first person in queue.",
		Handler:     PingCommand,
	},
	{
		Command:     "done",
		Description: "remove the first person from the queue once they have finished their photo-taking.",
		Handler:     RemoveFirstInQueueCommand,
	},
	{
		Command:     "kick",
		Description: "remove the specified person from the queue.",
		Handler:     KickCommand,
	},
	{
		Command:     "stopqueue",
		Description: "Stop admitting perople into the queue.",
		Handler:     StopQueueCommand,
	},
	{
		Command:     "startqueue",
		Description: "Start admitting perople into the queue.",
		Handler:     StartQueueCommand,
	},
	{
		Command:     "adminlist",
		Description: "see who has the ability to control the bot.",
		Handler:     CheckAdminListCommand,
	},
	{
		Command:     "addadmin",
		Description: "allow another person to control the bot, e.g. /addadmin @abc",
		Handler:     AddAdminCommand,
	},
	{
		Command:     "removeadmin",
		Description: "remove admin rights for some user, e.g. /removeadmin @abc",
		Handler:     RemoveAdminCommand,
	},
	{
		Command:     "addDummy12345",
		Description: "FOR TESTING ONLY",
		Handler:     AddDummyCommand,
	},
	{
		Command:     "help",
		Description: "Explains the main functionalities of the bot.",
		Handler:     AdminHelpCommand,
	},
	{
		Command:     "start",
		Description: "Explains the main functionalities of the bot.",
		Handler:     AdminHelpCommand,
	},
}

Command and description is hard-coded within the HelpFunction for circular dependencies. You will need to update the help function accordingly if you want to change this definition. If this becomes too troublesome, consider using the reflect package to store the handler function names under a string first before using reflect.ValueOf().Call()

View Source
var UserCommands = []types.AcceptedCommands{
	{
		Command:     "join",
		Description: "Join the virtual queue for the photobooth.",
		Handler:     JoinCommand,
	},
	{
		Command:     "leave",
		Description: "Leave the virtual queue for the photobooth.",
		Handler:     LeaveCommand,
	},
	{
		Command:     "howlong",
		Description: "Returns the expected time to wait in the queue",
		Handler:     HowLongCommand,
	},
	{
		Command:     "help",
		Description: "Explains the main functionalities of the bot.",
		Handler:     UserHelpCommand,
	},
	{
		Command:     "start",
		Description: "Explains the main functionalities of the bot.",
		Handler:     UserHelpCommand,
	},
}

Command and description is hard-coded within the HelpFunction for circular dependencies. You will need to update the help function accordingly if you want to change this definition. If this becomes too troublesome, consider using the reflect package to store the handler function names under a string first before using reflect.ValueOf().Call()

Functions

func AddAdminCommand

func AddAdminCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func AddDummyCommand

func AddDummyCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func AdminHelpCommand

func AdminHelpCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func CheckAdminListCommand

func CheckAdminListCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func GetBotAPIConnection

func GetBotAPIConnection() (*tgbotapi.BotAPI, error)

func GreetFeedback

func GreetFeedback(name string) string

func HowLongCommand

func HowLongCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

To update: should be variable based on whether you have joined the queue.

func HowLongFeedback

func HowLongFeedback(queueLength int) string

func InitializeBotAPIConnection

func InitializeBotAPIConnection() *tgbotapi.BotAPI

implicit .env arguments: BOT_TOKEN.

func InvalidCommand

func InvalidCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func JoinCommand

func JoinCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func KickCommand

func KickCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func LeaveCommand

func LeaveCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func NonCommandHandler

func NonCommandHandler(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func NonTextHandler

func NonTextHandler(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func PingCommand

func PingCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func RemoveAdminCommand

func RemoveAdminCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func RemoveFirstInQueueCommand

func RemoveFirstInQueueCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func SeeQueueCommand

func SeeQueueCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func StartQueueCommand

func StartQueueCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func StopQueueCommand

func StopQueueCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

func UserHelpCommand

func UserHelpCommand(userMessage tgbotapi.Update, bot *tgbotapi.BotAPI) (feedback string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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