chiark
/
gitweb
/
~matthewv
/
irc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0d052d1
)
gracefully fail on non-ASCII tweets
author
Matthew Vernon
<matthewv@chiark.greenend.org.uk>
Wed, 2 Mar 2011 14:29:05 +0000
(14:29 +0000)
committer
Matthew Vernon
<matthewv@chiark.greenend.org.uk>
Wed, 2 Mar 2011 14:29:05 +0000
(14:29 +0000)
commands.py
patch
|
blob
|
history
diff --git
a/commands.py
b/commands.py
index 32ac05e8b49bcac10dbbd635f81cc3eb89fa48bc..0f958e277ac8c47b7976446fdfe4234e1deb3093 100644
(file)
--- a/
commands.py
+++ b/
commands.py
@@
-398,10
+398,10
@@
def twitterq(bot,cmd,nick,conn,public,twitapi):
urlstring = urlre.search(cmd).group(1)
if (urlstring.find("twitter.com") !=-1):
stringout = getTweet(urlstring,twitapi)
-
if public
:
-
conn.action(bot.channel,
stringout)
- e
lse
:
-
bot.automsg(public, nick, stringout
)
+
try
:
+
bot.automsg(public, nick,
stringout)
+ e
xcept UnicodeEncodeError
:
+
bot.automsg(public, nick, "Sorry, that tweet contained non-ASCII characters"
)
def getTweet(urlstring,twitapi):
parts = string.split(urlstring,'/')