Added format_mention().
authorCMDR furrycat <elite@furrycat.net>
Tue, 6 Dec 2016 08:24:27 +0000 (08:24 +0000)
committerCMDR furrycat <elite@furrycat.net>
Tue, 6 Dec 2016 08:24:27 +0000 (08:24 +0000)
bot.py

diff --git a/bot.py b/bot.py
index 749e3bc..7998e3e 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -252,6 +252,13 @@ def parse_mention(text, author):
   log.warning("Can't parse {}!".format(text))
   return None
 
+def format_mention(mention):
+  if mention in ['everyone', 'here']:
+    return '@{}'.format(mention)
+  if mention[0] == '#':
+    return '<{}>'.format(mention)
+  return '<@{}>'.format(mention)
+
 def open_url(url):
   # Specify our own user agent as Cloudflare doesn't seem to like the urllib one
   try: