Jump to content

User:Yapperbot/FRS/Documentation/godoc/rfc

From Wikipedia, the free encyclopedia
package rfc // import "yapperbot-frs/src/rfc"


CONSTANTS

const noRfCIDYetErrorText string = "An identified RfC does not yet have an assigned RfC ID from Legobot."
const requestType string = "request for comment"

VARIABLES

var doneRfcs map[string]bool = map[string]bool{}
    doneRfcs maps found this session and completed/already-completed RfCs IDs to
    true (again, only used for o(n) lookups)

var loadedRfcs map[string]bool = map[string]bool{}
    loadedRfcs maps *already-completed* RfC IDs to true. It only contains RfCs
    that were in the JSON at the start. We need this to be separate so we can
    keep ones out of doneRfcs that aren't in the category anymore

var rfcPrefixRegex *regexp.Regexp
    rfcPrefixRegex is a regex that matches the comments at the start of each RfC
    line; these are in the form <!--rfc:categoryname-->, and mean the bot can
    match it.


FUNCTIONS

func AlreadyDone(rfcID string) bool
    AlreadyDone takes an RfC ID and returns whether it's already included in
    either loadedRfcs or doneRfcs.

func LoadRfcsDone(w *mwclient.Client)
    LoadRfcsDone loads the RFCs that have already been marked as done into
    loadedRfcs. It needs to be called before the start of each session that
    includes an RfC lookup.

func MarkRfcsDone(rfcsDone []RfC)
    MarkRfcsDone takes a series of RfC objects, and adds the RfCs to the list of
    completed RfCs.

func SaveRfcsDone(w *mwclient.Client)
    SaveRfcsDone takes an mwclient, and serializes the doneRfcs map, before
    saving it on-wiki.

func init()

TYPES

type NoRfCIDYetError struct{}
    NoRfCIDYetError is an error used when an RfC detected does not yet have an
    ID assigned.

func (e NoRfCIDYetError) Error() string

type RfC struct {
        ID           string
        Categories   map[string]bool
        FeedbackDone bool
        PageHolding  string
}
    An RfC has an id, a categories map and a setting for whether feedback has
    been given for it. The map should be map[string]bool, with bool as true for
    every element This is so membership verification is o(1) rather than o(n)

func (r RfC) IncludeHeader(header string) (bool, bool)
    IncludeHeader determines if a given FRS header corresponds to this item
    correctly Takes a string of the entire header (minus the === bits) and
    returns a bool for if the header is included, and separately a bool
    indicating whether the header is the all header or not

func (r RfC) PageTitle() string
    PageTitle is a simple getter for the HoldingPage in order to make the
    interface work

func (r RfC) RequestType() string
    RequestType returns the type this is - an RfC - so that it can be used in a
    template