Skip to content

ModuleOptions

gkistler edited this page Sep 21, 2011 · 1 revision
  • Module options should be hierarchical (best word). Channel module opts --falls back on--> Server module opts --falls back on--> Global module opts. Something like this:
def getModuleOption(module, server, channel, option):
	if server in moduleopts[module]["servers"]:
		serveropts = moduleopts[module]["servers"][server]
		if channel in serveropts["channels"] and option in serveropts["channels"][channel]:
			return serveropts["channels"][channel][option]
		if option in serveropts:
			return serveropts[option]
	# Guaranteed to be set, globals
	return moduleopts[option]
  • Module options should be configurable through PRIVMSG via a module. Something like this:

COMMAND [server | #channel | implied global] MODULE OPTION VALUE

<Griffin> .config irc.server.net butt buttrate 5
<pyBBM> Module butt: irc.server.net buttrate changed from 9999 to 5
<Griffin> .config #channel butt buttrate 5
<pyBBM> Module butt: irc.server.net:#channel buttrate changed from 1234 to 5
  • Somehow auto-documenting
    <Griffin> .config butt
    <pyBBM> Module butt configurable variables: buttrate.
    <Griffin> .config butt buttrate
    <pyBBM> buttrate: Chance that pyBBM will attempt to butt a message = 1/buttrate.  Global 500, irc.server.net unset, #channel 1.
Clone this wiki locally