From d6d4ec5c9801e94201002af6425bb6d686e3161b Mon Sep 17 00:00:00 2001 From: jw Date: Sun, 29 Oct 2017 00:07:19 -0700 Subject: [PATCH] Replace if with try statement --- tipbot/modules/reddit.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tipbot/modules/reddit.py b/tipbot/modules/reddit.py index 59c936d..a1b5e62 100644 --- a/tipbot/modules/reddit.py +++ b/tipbot/modules/reddit.py @@ -160,10 +160,12 @@ class RedditNetwork(Network): while '' in cmd: cmd.remove('') cmd[0] = cmd[0].strip(' \t\n\r') - if cmd[1]: - if cmd[0] == u'tip' and cmd[1][0:3] == u'/u/': - log_info("Subbing out /u/ from username") - cmd[1] = cmd[1][3:] + try: + if cmd[0] == u'tip' and cmd[1][0:3] == u'/u/': + log_info("Subbing out /u/ from username") + cmd[1] = cmd[1][3:] + except: + pass log_info('Found command from %s: %s' % (link.identity(), str(cmd))) if self.on_command: self.on_command(link,cmd)