User:Yapperbot/FRS/Documentation/godoc

Included packages: /frslist /ga /rfc /yapperconfig

CONSTANTS

const editSummaryForFeedbackMsgs string = `[[WP:FRS|Feedback Request Service]] notification on a "%s" %s%s. You can unsubscribe at [[WP:FRS]].`
    editSummaryForFeedbackMsgs is used to generate our edit summary. We run
    Sprintf over it with: %s 1: header the user was subscribed to %s 2: the type
    of request (GA nom, RfC, etc) %s 3: limitInEditSummary, or empty string for
    no limit

const limitInEditSummary string = ` (%d/%d this month)`
    limitInEditSummary is used where users have a limit set. Sprintf is run over
    it with the first param as the used amount, and the second as the limit.

const maxMsgsToSend int = 15
const minMsgsToSend int = 5
const rfcIDParam string = "rfcid="

VARIABLES

var cleanedHeaders = map[string]string{}
    cleanedHeaders is a map mapping our "dirty" headers (those containing the
    HTML comments) to cleaned versions, that have had comments removed using the
    commentRegex.

var commentRegex *regexp.Regexp
    commentRegex matches HTML comments, allowing us to remove them; we use it to
    clean our headers before we send to users.

var gaMatcher *regexp.Regexp
    gaMatcher is a regex that matches {{GA nominee}} templates on pages. Its
    contents are documented in matchers.go:init().

var namedParamMatcher *regexp.Regexp
    namedParamMatcher is a regex that matches against named parameters in a
    template parameter list; e.g. {{template|name=param}}, matching name=param.
    Its contents are documented in matchers.go:init().

var rfcMatcher *regexp.Regexp
    rfcMatcher is a regex that matches {{rfc}} templates on pages. Its contents
    are documented in matchers.go:init().


FUNCTIONS

func extractGANom(content string, title string) (nom ga.Nom)
    extractGANom takes a page name and content that's been nominated for GA, and
    returns the GA nom object.

func extractRfcs(content string, title string, excludeDone bool) (rfcs []rfc.RfC, err error)
    extractRfcs takes a string of content containing rfcs, and the page title,
    and returns a slice of rfcs. It can optionally be passed excludeDone, which
    prevents already-done RfCs from being included in the generated list.
    extractRfcs output should be checked for RfCs with no ID string, as those
    haven't yet been assigned an ID by Legobot.

func init()
func loadFromRunfile(category string) (timestamp, pageID string)
    loadFromRunfile takes a category name, and loads the applicable .frsrunfile
    file, if there is one. The .frsrunfile file stores the timestamp of the last
    processed page in the category, and its page ID. This is used to track our
    progress through the category, and prevent us from sending messages about
    the same page twice. The function returns the timestamp and the page ID,
    both as strings.

func main()
func processCategory(w *mwclient.Client, category string, rfcCat bool)
    processCategory takes a mwclient instance, a category name, and a bool
    indicating if the category contains RfCs. it then iterates through the pages
    in the category, checking whether they've already been processed; if they've
    not, and they're applicable, they'll be sent for a feedback request. This is
    the main program loop.

func requestFeedbackFor(requester frsRequesting, w *mwclient.Client)
    requestFeedbackFor takes an object that implements frsRequesting and a
    mwclient instance, and processes the feedback request for the frsRequesting
    object.


TYPES

type frsRequesting interface {
        // IncludeHeader returns a bool indicating if the header is applicable for the
        // requesting instance, and also a bool indicating if the header is the catch-all
        // for the requester.
        IncludeHeader(string) (headerShouldBeIncluded bool, headerIsAllHeader bool)

        PageTitle() string
        RequestType() string
}
    frsRequesting is an interface covering all objects that could request FRS.
    At the moment, that's only ga.Nom and rfc.RfC