weechat-protocol.js: factor common commands formatting code