/* * Please write the below line into .vimperatorrc. * let g:twittperator_plugin_pong = 1 * let g:twittperator_screen_name = "" */ (function () { let screenName = liberator.globalVariables.twittperator_screen_name; if (!screenName) return liberator.echoerr('please. let g:twittperator_screen_name = ""'); plugins.twittperator.ChirpUserStream.addListener( function onMsg (msg, raw) { function negi (pattern, reply) { if (RegExp('^\\s*@' + screenName + '\\s+' + pattern + '\s*$').test(msg.text.trim())) { let replyText = reply instanceof Array ? reply[parseInt(Math.random() * reply.length, 10)] : reply; plugins.twittperator.Twitter.say('@' + msg.user.screen_name + ' ' + replyText, msg.id_str); return true; } } if (!(msg.text && msg.user)) return; if (msg.text.trim() === ('@' + screenName)) return plugins.twittperator.Twitter.say('@' + msg.user.screen_name, msg.id_str); negi('ping', 'pong') || negi('pong', 'pang') || negi('pang', 'bang') || negi('bang', '( \u25D5 \u203F\u203F \u25D5 )') || negi('\u30C6\u30A3\u30ED', '\u30D5\u30A3\u30CA\u30FC\u30EC') || negi('ニンジャ', ['コマンドー!', 'チョーカン', 'トノサマ']) || negi('ねこなめりんちょくらぶ', 'ざりっ…ざりっ…') || negi('いつやるか?', '今でしょ!') || negi('.*こんな世の中じゃ.?', 'ポイズン') || true; } ); })(); // vim: sw=2 ts=2 et fdm=marker ft=javascript: