diff --git a/rhonrhon.py b/rhonrhon.py
index 6f55906..af70ffa 100644
--- a/rhonrhon.py
+++ b/rhonrhon.py
@@ -17,6 +17,7 @@
from twython import TwythonStreamer
from twython import TwythonError, TwythonRateLimitError, TwythonAuthError
from daemonize import Daemonize
+import random
import rhonmod.coin
@@ -269,29 +270,34 @@ def on_pubmsg(self, serv, ev):
if 'nolog' in tags:
return
+ # handle yolo tag
+ if re.search('[\[#]\ *yolo\ *[#\]]', pl, re.I):
+ msg = '{0}: you got SWAG'
+ self.send_message(serv, channel, msg.format(nick))
+ if self.flip_coin():
+ return
+ pl = re.sub(r"[\[#]\ *yolo\ *[#\]]", "", pl);
+ tags.append('yolo')
+
urls = re.findall('(https?://[^\s]+)', pl)
urls_copy = list(urls)
for url in urls_copy:
(vieille, rep) = self.vieille(url, channel)
if vieille:
- try:
- msg = '{0}: VIEUX ! The URL [ {1} ] has been posted '
+ msg = '{0}: VIEUX ! The URL [ {1} ] has been posted '
+ msg = msg + 'by {2} the {3} at {4}.'
+
+ if len(msg) > 512:
+ msg = '{0}: VIEUX ! This URL has been posted '
msg = msg + 'by {2} the {3} at {4}.'
- if len(msg) > 512:
- msg = '{0}: VIEUX ! This URL has been posted '
- msg = msg + 'by {2} the {3} at {4}.'
-
- serv.privmsg('#{0}'.format(channel),
- msg.format(nick,
- url,
- 'you' if rep['_source']['nick'] == nick
- else rep['_source']['nick'],
- rep['_source']['date'],
- rep['_source']['time']))
- except Exception as e:
- logger.warn(e)
- pass
+ self.send_message(serv, channel,
+ msg.format(nick,
+ url,
+ 'you' if rep['_source']['nick'] == nick
+ else rep['_source']['nick'],
+ rep['_source']['date'],
+ rep['_source']['time']))
urls.remove(url)
@@ -326,6 +332,20 @@ def on_pubmsg(self, serv, ev):
r = es.index(index=es_idx, doc_type=channel, body=json.dumps(data))
logger.debug(r)
+ def send_message(self, serv, channel, msg):
+ try:
+
+ if len(msg) > 512:
+ return
+
+ serv.privmsg('#{0}'.format(channel), msg)
+
+ except Exception as e:
+ logger.warn(e)
+ pass
+
+
+
def handle_noauth_privcmd(self, serv, ev, s):
if s[0] == 'rage':
self.showrage(serv, ev, 'priv')
@@ -482,6 +502,10 @@ def vieille(self, url, channel):
pass
return (False, [])
+ def flip_coin(self):
+ if random.random() > 0.5:
+ return True
+ return False
foreground = False
diff --git a/www/static/gcu.css b/www/static/gcu.css
index 8b65673..3357e66 100644
--- a/www/static/gcu.css
+++ b/www/static/gcu.css
@@ -32,6 +32,13 @@ body {
.line {
margin-left: 5px;
}
+.yolo {
+ margin-left: 5px;
+ font-weight: bold;
+ color: red;
+ text-decoration: blink;
+ font-family: "Comic Sans MS", cursive, sans-serif;
+}
.tags {
margin-left: 5px;
}
diff --git a/www/templates/gerard.js b/www/templates/gerard.js
index 05f3c71..14528aa 100644
--- a/www/templates/gerard.js
+++ b/www/templates/gerard.js
@@ -165,7 +165,15 @@ var process_ircline = function(data, lastdate, cnt, pos) {
/* destination nicks */
{{ js.buttonlst('tonick', ircline_style) }}
/* real line */
- ircline += '' + decoline(source) + '';
+
+ var line_class = 'line';
+ if (source.tags && source.tags[0] && $.inArray('yolo', source.tags) !== false) {
+ ircline += '';
+ }
+ else {
+ ircline += '' + decoline(source) + '';
+ }
+
/* tags */
{{ js.buttonlst('tags', ircline_style, 'tag') }}