class_notify

package module
v0.0.0-...-19ee209 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

class-notify

Discord bot to notify students if a class that they are tracking is available for sign up.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchEvent = errors.New("class_notify: no classes exist with such uri")
View Source
var ErrUserUnavailable = errors.New("class_notify: unable to create DM with user")

Functions

This section is empty.

Types

type Bot

type Bot struct {
	School schools.ISchool
	DB     *Database
}

func (*Bot) GetUserEvents

func (bot *Bot) GetUserEvents(userID string) ([]Event, error)

func (*Bot) Monitor

func (bot *Bot) Monitor(updateFn func(event Event) error) error

func (*Bot) StartMonitor

func (bot *Bot) StartMonitor(updateFn func(event Event) error)

func (*Bot) Subscribe

func (bot *Bot) Subscribe(uri string, userID string) (Event, error)

func (*Bot) Unsubscribe

func (bot *Bot) Unsubscribe(uri string, userID string) (Event, error)

type Database

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

func (*Database) AddSubscriber

func (db *Database) AddSubscriber(uri string, subscriberID string) error

func (*Database) Connect

func (db *Database) Connect(uri string) error

func (*Database) CreateEvent

func (db *Database) CreateEvent(uri string, details schools.ClassDetails, userID string) (Event, error)

func (*Database) GetActiveEventsCount

func (db *Database) GetActiveEventsCount() (int64, error)

func (*Database) GetAllActiveEvents

func (db *Database) GetAllActiveEvents(c chan Event) error

func (*Database) GetAllEvents

func (db *Database) GetAllEvents(c chan Event) error

func (*Database) GetEventWithURI

func (db *Database) GetEventWithURI(uri string) (Event, error)

func (*Database) GetEventsWithSubscriber

func (db *Database) GetEventsWithSubscriber(userID string) ([]Event, error)

func (*Database) RemoveEvent

func (db *Database) RemoveEvent(uri string) error

func (*Database) RemoveSubscriber

func (db *Database) RemoveSubscriber(uri string, subscriberID string) error

func (*Database) UpdateEventDetails

func (db *Database) UpdateEventDetails(uri string, details schools.ClassDetails) error

type Discord

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

func (*Discord) Close

func (d *Discord) Close()

func (*Discord) Connect

func (d *Discord) Connect(token string, guildID string) error

func (*Discord) UpdateSubscriber

func (d *Discord) UpdateSubscriber(event Event) error

type Event

type Event struct {
	URI          string               `bson:"uri"`
	Subscribers  []string             `bson:"subscribers"`
	ClassDetails schools.ClassDetails `bson:"class_details"`
}

func (Event) String

func (e Event) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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