busybee

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2017 License: GPL-3.0 Imports: 10 Imported by: 0

README

BusyBee

GitHub release Build Status GoDoc

WINDOWS NOT RECOMMENDED I am having trouble finding a reliable way to run a task every 5 minutes without annoying the user with a popup each time. If a solution is found and working please let me know!

A bot (or server depending on how far this goes) that will update hipchat status based on exchange calendar. It is being built in a way that it should be able to update any Chatting services status with any calendars events (using interfaces).

Hipchat User Token

Go to Account API Access to grab a token for BusyBee. The token must have Administer Group and View Group scopes in order for BusyBee to update your users status.

Install

Go to the Latest Release and download BusyBee_linux, BusyBee_mac or BusyBee.exe depending on if you are on a Linux, Mac or Windows machine respectivley. Also download the appropriate install script for your machine as well. This install script will setup you machine to run BusyBee every 5 minutes.

Once everything is downloaded it is recommended to move both the files somewhere they will be out of the way. A good location may be %HOME%/BusyBee/ and put them in that folder.

Once files are moved, if you are on a Unix box (Mac or Linux) we need to make the files executable.

cd ~/BusyBee #Assuming this is where you moved your files too
chmod +x BusyBee_linux #Or BusyBee_mac
chmod +x UnixInstall.sh

If you are on a Mac and try to double click the files you will get a warning. To bypass, navigate to this file in Finder, Control-Click the file, then from the shortcut menu, select Open. It will warn you one more time but with a different option now. Click Open again.

For Mac or Linux machines it should be as simple as running UnixInstall.sh and everything will be set up.

As for Windows you will need to run BusyBee.exe first and answer all the questions. Make sure that it did not fail after all prompts were answered. Then run WindowsInstall.ps1 to install it to the Task Scheduler. You will have to log out then back in so that the schedular triggers the newly added task.

Edit Task

There may be times when you need to update the task because something has changed. Examples include:

  • Moved executable
  • Change Hipchat @Mention name
  • Change AD Auth Password

To edit the task, simply edit the configuration file and on next run BusyBee will use those values.

If the value you are trying to edit is encrypted, you have two options:

  1. Remove it from the configuration file and then run BusyBee to reprompt for that field
  2. Run ./BusyBee_linux encrypt string replacing string with the value you want to encrypt. Copy the output and paste it into the config

Using the latter, make sure you run your version of BusyBee.

Uninstalling

If you want to uninstall or upgrade to a new version of BusyBee follow the steps bellow depending on you operating system to remove BusyBee. It is recommended to Uninstall everytime you want to upgrade for right now.

Unix (Mac or Linux)

Open a terminal and run crontab -e. This will open an editor. Remove the line that has /path/to/BusyBee in it. This will stop it from running every 5 minutes.

Windows
  1. Search for Task Scheduler in Windows 8 or Windows 10.
  2. On the left side click Task Scheduler Library
  3. In the middle find the Task named BusyBee
  4. Click on it
  5. On the left there is a delete button. Click it.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterEventService added in v0.1.2

func RegisterEventService(name string, event *EventService) error

RegisterEventService registers an EventService instance with BusyBee.

func RegisterStatusService

func RegisterStatusService(name string, statusService *StatusService) error

RegisterStatusService registers a StatusService instance with BusyBee

Types

type BusyBee added in v0.2.0

type BusyBee struct {
	EventUID   string `quest:"What is the unique identifier for the Event Service?"`
	StatusUID  string `quest:"What is the unique identifier for the Status Service?"`
	PrivateKey string
	Plugins    map[string]PluginConfig
}

BusyBee are configuration values that are not dependent on the the plugins installed.

func (*BusyBee) CreateEventService added in v0.2.0

func (bb *BusyBee) CreateEventService(name string, conf interface{}) (InEventer, error)

CreateEventService returns an instance of a registered EventService by name.

func (*BusyBee) CreateKeys added in v0.2.0

func (bb *BusyBee) CreateKeys(priv string) error

CreateKeys will create a public/private key pair and write them to the files specified. It will also update busybee to use the new key value pairs.

func (*BusyBee) CreateStatusService added in v0.2.0

func (bb *BusyBee) CreateStatusService(name string, conf interface{}) (UpdateStatuser, error)

CreateStatusService returns an instance of a registered StatusService by name.

func (*BusyBee) Decrypt added in v0.2.0

func (bb *BusyBee) Decrypt(encMsg, label string) (string, error)

Decrypt will decrypt the string and return the unencrypted string using the private key specified by busybee. It expects the encMsg to be in base64 encoding. label must match the label specified during encoding

func (*BusyBee) Encrypt added in v0.2.0

func (bb *BusyBee) Encrypt(msg, label string) (string, error)

Encrypt will encrypt the string and return an encrypted string using the public key specified by busybee. msg is the message to encrypt. label is what the message is to encrypt (can be blank). It is base64 encoded so that it can be saved safely to a file.

func (*BusyBee) KeyValid added in v0.2.0

func (bb *BusyBee) KeyValid() (bool, error)

KeyValid checks to make sure that the private key has not been tampered with.

func (*BusyBee) ListEventService added in v0.2.0

func (bb *BusyBee) ListEventService() []string

ListEventService returns a slice of all registered event services.

func (*BusyBee) ListStatusService added in v0.2.0

func (bb *BusyBee) ListStatusService() []string

ListStatusService returns a slice of all registered status services.

func (*BusyBee) NewUser added in v0.2.0

func (bb *BusyBee) NewUser(eventService InEventer, statusService UpdateStatuser) *User

NewUser creates a new user link betweent the statuser and calendarer.

type ConfigCreator added in v0.1.2

type ConfigCreator func() interface{}

ConfigCreator is a function that should return a pointer to an empty configuration for that service.

type EventService added in v0.1.2

type EventService struct {
	Service
	Create EventServiceCreator
}

EventService is the foundation of a service that can retrieve whether someone is in an event or not.

func GetEventService added in v0.1.2

func GetEventService(name string) (*EventService, error)

GetEventService will return the struct on how to create a new instance and a new config for that service.

type EventServiceCreator added in v0.1.2

type EventServiceCreator func(interface{}, *BusyBee) (InEventer, error)

EventServiceCreator is a function that will create a new instance of an InEventer.

type InEventer added in v0.1.2

type InEventer interface {
	InEvent(uid string) (bool, error)
}

InEventer is any service that can tell if UID is in an event.

type PluginConfig added in v0.2.0

type PluginConfig struct {
	Type   ServiceType
	Config interface{}
}

PluginConfig is the structure of a Plugin for configuration

type Service added in v0.2.0

type Service struct {
	CreateConfig ConfigCreator
}

Service is used for any services that can be registered to busybee

type ServiceType added in v0.2.0

type ServiceType int

ServiceType are the different types of services BusyBee supports.

const (
	//ServiceTypeEvent is for event services.
	ServiceTypeEvent ServiceType = iota
	//ServiceTypeStatus is for status services.
	ServiceTypeStatus
)

type Status

type Status int

Status is an integer representing possable status.

const (
	//StatusUnknown is used if a service could not figure out what the status of the user was.
	StatusUnknown Status = iota
	//StatusBusy is used to state that the user is busy.
	StatusBusy
	//StatusAvailable is used to state that the user is Available.
	StatusAvailable
)

type StatusService

type StatusService struct {
	Service
	Create StatusServiceCreator
}

StatusService is the foundation for any service that can update the status of a user.

func GetStatusService added in v0.1.2

func GetStatusService(name string) (*StatusService, error)

GetStatusService will return the struct on how to create a new instance and a new config for that service.

type StatusServiceCreator added in v0.1.2

type StatusServiceCreator func(interface{}, *BusyBee) (UpdateStatuser, error)

StatusServiceCreator is a function that will create a new instance of a UpdateStatuser.

type UpdateStatuser added in v0.1.2

type UpdateStatuser interface {
	UpdateStatus(uid string, status Status) error
}

UpdateStatuser is any service that can be used to update your status.

type User

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

User is the link between the calendar and status.

func (*User) InEvent

func (u *User) InEvent() (bool, error)

InEvent returns true if the user is in an event and false otherwise.

func (*User) UpdateStatus

func (u *User) UpdateStatus(status Status) error

UpdateStatus updates the status for the user.

Directories

Path Synopsis
cmd
Package exchange is used as a CalendarService in BusyBee.
Package exchange is used as a CalendarService in BusyBee.
Package hipchat is used for implementing a StatusService in BusyBee.
Package hipchat is used for implementing a StatusService in BusyBee.

Jump to

Keyboard shortcuts

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