Documentation ¶
Index ¶
- func Interceptor(q *Queue) gb.Interceptor
- type Queue
- func (q *Queue) Add(t *Topic) error
- func (q *Queue) Attach(n, s string) error
- func (q *Queue) Bump(s string) error
- func (q *Queue) Detach(n string, i int) error
- func (q *Queue) Len() int
- func (q *Queue) List() []*Topic
- func (q *Queue) Load(path string) error
- func (q *Queue) Next() (*Topic, error)
- func (q *Queue) Remove(s string) error
- func (q *Queue) Save(path string) error
- func (q *Queue) Skip(s string) error
- type QueueCommand
- type Topic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Interceptor ¶ added in v0.3.0
func Interceptor(q *Queue) gb.Interceptor
Returns an interceptor. Have to nest functions so that the Interceptor can access the Queue
Types ¶
type Queue ¶
type Queue struct { Q []*Topic `json:"q"` // hide the internal list from the user Modified time.Time `json:"modified"` // time last modified }
Slice for simplicity, no need to make it a heap-based PQ
func NewQueue ¶
func NewQueue() *Queue
Create a new Queue, initializes the underlying slice and updates Modified
func (*Queue) Remove ¶
Removes a Topic of the specified name from the Queue, does nothing if the name is not found
type QueueCommand ¶
type QueueCommand int
Enum for commands for discussion queues
const ( QError QueueCommand = iota QAdd QRemove QNext QBump QSkip QAttach QDetach QList )
func ArgToQueueCommand ¶
func ArgToQueueCommand(arg string) QueueCommand
parse a string arg into a QueueCommand
func (QueueCommand) String ¶
func (qc QueueCommand) String() string
type Topic ¶
type Topic struct { Name string `json:"name"` // the name of the topic Description string `json:"description"` // longer description of the topic Sources []string `json:"sources"` // an optional list of links to source articles Modified time.Time `json:"modified"` Created time.Time `json:"created"` CreatedBy string `json:"created_by"` // original author username of the topic }
Defines data for a discrete discussion topic
func (*Topic) Embed ¶ added in v0.3.0
func (t *Topic) Embed() *discordgo.MessageEmbed
Built in Embed function for Topics, primarily used for queue.Next()
Click to show internal directories.
Click to hide internal directories.