async def me(text: str, conn: IrcClient, chan: str, nick: str, event: CommandEvent) -> None: """ [#channel] <action> - acts out <action> in a [#channel], or in the current channel of none is specified """ channel, text = get_chan(chan, text) event.admin_log('{} used ME to make me ACT "{}" in {}.'.format( nick, text, channel)) conn.ctcp(channel, "ACTION", text)
def load_keys(conn: IrcClient, db) -> None: """ Load channel keys to the client """ query = select([table.c.chan, table.c.key], table.c.conn == conn.name.lower()) conn.clear_channel_keys() for row in db.execute(query): conn.set_channel_key(row["chan"], row["key"])
def set_key(db: Session, conn: IrcClient, chan: str, key: Optional[str]) -> None: """ Set the key for a channel """ insert_or_update( db, table, { "conn": conn.name.lower(), "chan": chan.lower(), "key": key or None }, make_clause(conn, chan), ) conn.set_channel_key(chan, key)
def create_connections(self): """ Create a BotConnection for all the networks defined in the config """ for config in self.config['connections']: # strip all spaces and capitalization from the connection name name = clean_name(config['name']) nick = config['nick'] server = config['connection']['server'] port = config['connection'].get('port', 6667) local_bind = (config['connection'].get('bind_addr', False), config['connection'].get('bind_port', 0)) if local_bind[0] is False: local_bind = False self.connections[name] = IrcClient(self, name, nick, config=config, channels=config['channels'], server=server, port=port, use_ssl=config['connection'].get('ssl', False), local_bind=local_bind) logger.debug("[{}] Created connection.".format(name))
def create_connections(self): """ Create a BotConnection for all the networks defined in the config """ for config in self.config['connections']: # strip all spaces and capitalization from the connection name name = clean_name(config['name']) nick = config['nick'] server = config['connection']['server'] port = config['connection'].get('port', 6667) self.connections.append( IrcClient(self, name, nick, config=config, server=server, port=port, use_ssl=config['connection'].get('ssl', False))) logger.debug("[{}] Created connection.".format(name))