csbot.core module

exception csbot.core.PluginError[source]

Bases: Exception

class csbot.core.Bot(config=None, loop=None)[source]

Bases: csbot.plugin.SpecialPlugin, csbot.irc.IRCClient

CONFIG_DEFAULTS = {'channels': '#cs-york-dev', 'use_notice': True, 'realname': 'cs-york bot', 'irc_host': 'irc.freenode.net', 'bind_addr': None, 'password': None, 'command_prefix': '!', 'sourceURL': 'http://github.com/csyork/csbot/', 'irc_port': '6667', 'plugins': 'example', 'auth_method': 'pass', 'username': 'csyorkbot', 'nickname': 'csyorkbot', 'lineRate': '1'}

Default configuration values

CONFIG_ENVVARS = {'password': ['IRC_PASS']}

Environment variable fallbacks

available_plugins = {'last': <class 'csbot.plugins.last.Last'>, 'topic': <class 'csbot.plugins.topic.Topic'>, 'csyork': <class 'csbot.plugins.csyork.CSYork'>, 'imgur': <class 'csbot.plugins.imgur.Imgur'>, 'hoogle': <class 'csbot.plugins.hoogle.Hoogle'>, 'auth': <class 'csbot.plugins.auth.Auth'>, 'termdates': <class 'csbot.plugins.termdates.TermDates'>, 'usertrack': <class 'csbot.plugins.usertrack.UserTrack'>, 'linkinfo': <class 'csbot.plugins.linkinfo.LinkInfo'>, 'mongodb': <class 'csbot.plugins.mongodb.MongoDB'>, 'helix': <class 'csbot.plugins.helix.Helix'>, 'whois': <class 'csbot.plugins.whois.Whois'>, 'cron': <class 'csbot.plugins.cron.Cron'>, 'youtube': <class 'csbot.plugins.youtube.Youtube'>, 'calc': <class 'csbot.plugins.calc.Calc'>, 'logger': <class 'csbot.plugins.logger.Logger'>, 'xkcd': <class 'csbot.plugins.xkcd.xkcd'>}

Dictionary containing available plugins for loading, using straight.plugin to discover plugin classes under a namespace.

bot_setup()[source]

Load plugins defined in configuration and run setup methods.

bot_teardown()[source]

Run plugin teardown methods.

post_event(event)[source]
register_command(cmd, metadata, f, tag=None)[source]
unregister_command(cmd, tag=None)[source]
unregister_commands(tag)[source]
signedOn(event)[source]
privmsg(event)[source]

Handle commands inside PRIVMSGs.

fire_command(event)[source]

Dispatch a command event to its callback.

show_commands(e)[source]
show_plugins(e)[source]
emit_new(event_type, data=None)[source]

Shorthand for firing a new event.

emit(event)[source]

Shorthand for firing an existing event.

connection_made()[source]
connection_lost(exc)[source]
send_line(line)[source]
line_received(line)[source]
on_welcome()[source]
on_joined(channel)[source]
on_left(channel)[source]
on_privmsg(user, channel, message)[source]
on_notice(user, channel, message)[source]
on_action(user, channel, message)[source]
on_user_joined(user, channel)[source]
on_user_left(user, channel, message)[source]
on_user_quit(user, message)[source]
on_user_renamed(oldnick, newnick)[source]
on_topic_changed(user, channel, topic)[source]
irc_RPL_NAMREPLY(msg)[source]
irc_RPL_ENDOFNAMES(msg)[source]
on_names(channel, names, raw_names)[source]

Called when the NAMES list for a channel has been received.

on_capabilities_available(capabilities)[source]
identify(target)[source]

Find the account for a user or all users in a channel.

irc_354(msg)[source]

Handle “formatted WHO” responses.

on_user_identified(user, account)[source]
irc_ACCOUNT(msg)[source]

Account change notification from account-notify capability.

PLUGIN_DEPENDS = set()
irc_JOIN(msg)[source]

Re-implement JOIN handler to account for extended-join info.

plugin_cmds = [('plugins', {}, <function Bot.show_plugins>), ('help', {'help': 'help [command]: show help for command, or show available commands'}, <function Bot.show_commands>)]
plugin_hooks = defaultdict(<class 'list'>, {'core.self.connected': [<function Bot.signedOn>], 'core.message.privmsg': [<function Bot.privmsg>], 'core.command': [<function Bot.fire_command>]})
plugin_integrations = []
plugin_provide = []
reply(to, message)[source]

Reply to a nick/channel.

This is not implemented because it should be replaced in the constructor with a reference to a real method, e.g. self.reply = self.msg.