git://git.furryclan.net
/
furrycat
/
catbot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
72645c9
)
Added format_mention().
author
CMDR furrycat
<elite@furrycat.net>
Tue, 6 Dec 2016 08:24:27 +0000
(08:24 +0000)
committer
CMDR furrycat
<elite@furrycat.net>
Tue, 6 Dec 2016 08:24:27 +0000
(08:24 +0000)
bot.py
patch
|
blob
|
history
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: