csbot.core module

exception csbot.core.PluginError[source]

Bases: Exception

class csbot.core.Bot(config=None, *, plugins: Sequence[Type[csbot.plugin.Plugin]] = None, loop=None)[source]

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

class Config(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]

Bases: csbot.config.Config

ircv3 = <BooleanType() instance on Config as 'ircv3'>
nickname = <StringType() instance on Config as 'nickname'>
username = <StringType() instance on Config as 'username'>
realname = <StringType() instance on Config as 'realname'>
auth_method = <StringType() instance on Config as 'auth_method'>
password = <StringType() instance on Config as 'password'>
irc_host = <StringType() instance on Config as 'irc_host'>
irc_port = <IntType() instance on Config as 'irc_port'>
command_prefix = <StringType() instance on Config as 'command_prefix'>
channels = <WordList(StringType) instance on Config as 'channels'>
plugins = <WordList(StringType) instance on Config as 'plugins'>
use_notice = <IntType() instance on Config as 'use_notice'>
client_ping = <IntType() instance on Config as 'client_ping'>
bind_addr = <StringType() instance on Config as 'bind_addr'>
rate_limit_period = <IntType() instance on Config as 'rate_limit_period'>
rate_limit_count = <IntType() instance on Config as 'rate_limit_count'>
available_plugins = None

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.

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.

line_sent(line: str)[source]

Callback for sent raw IRC message.

Subclasses can implement this to get access to the actual message that was sent (which may have been truncated from what was passed to send_line()).

line_received(line)[source]

Callback for received raw IRC message.

recent_messages
on_welcome()[source]

Successfully signed on to the server.

on_joined(channel)[source]

Joined a channel.

on_left(channel)[source]

Left a channel.

on_privmsg(user, channel, message)[source]

Received a message, either directly or in a channel.

on_notice(user, channel, message)[source]

Received a notice, either directly or in a channel.

on_action(user, channel, message)[source]

Received CTCP ACTION. Common enough to deserve its own event.

on_user_joined(user, channel)[source]

User joined a channel.

on_user_left(user, channel, message)[source]

User left a channel.

on_user_quit(user, message)[source]

User disconnected.

on_user_renamed(oldnick, newnick)[source]

User changed nick.

on_topic_changed(user, channel, topic)[source]

user changed the topic of channel to topic.

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.

identify(target)[source]

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

connection_lost(exc)[source]

Handle a broken connection by attempting to reconnect.

Won’t reconnect if the broken connection was deliberate (i.e. close() was called).

connection_made()[source]

Callback for successful connection.

Register with the IRC server.

fire_command(event)[source]

Dispatch a command event to its callback.

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.

irc_JOIN(msg)[source]

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

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.

classmethod write_example_config(f, plugins=None, commented=False)[source]