gochan

Constants

Modules

The following are modules that can be loaded via require("modulename"). See ./examples/plugins/ for usage examples.

External modules

bbcode

config

events

gclog

gcsql

gctemplates

geoip

Key Type Explanation
init func(options map[string]any) error The function to initialize the GeoIP handler with options. If it needs no initialization, the function can return null
get_country func(request http.Request, board string, errEv zerolog.Event) geoip.Country, error The function to get the requesting IP’s country, returning it and any errors that occured
close func() error The function to close any network or file handles, if any were opened, returning an error if any occured

manage

Key Type Explanation
board string|int|nil The board directory or ID that the IP will be banned from. If this is nil or omitted, it will be a global ban
post int The post ID
is_thread_ban bool If true, the user will be able to post but unable to create threads
appeal_after string User can appeal after this duration. If unset, the user can appeal immediately.
appealable bool Sets whether or not the user can appeal the ban. If unset, the user is able to appeal.
staff_note string A private note attached to the ban that only staff can see
Key Type Required Explanation
id string yes The action ID, used in the URL path
title string yes The action title, used in the page title and header
perms string no (defaults to NoPerms) The required permission level to access the action
hidden bool no If true, the action will not be shown in the manage dashboard or dropdown (useful for subpages)
json string no (defaults to NoJSON) If “no_json”, the action will always return HTML. If “optional_json”, the action may return JSON or HTML depending on the request. If “always_json”, the action will always return JSON.
callback CallbackFunction yes The function to call when the action is accessed. If the request is not JSON, the first return value should be a string with the HTML content of the manage page.

server

serverutil

uploads

url

Events

This is a list of events that gochan may trigger at some point and can be used in the plugin system.