From c78bcc96ca3cbc18939a34e775ca0eb34bcd9023 Mon Sep 17 00:00:00 2001 From: CMDR furrycat Date: Wed, 12 Oct 2016 21:27:11 +0100 Subject: [PATCH] Parse channel by name. --- bot.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bot.py b/bot.py index a36e1bd..920f5d0 100755 --- a/bot.py +++ b/bot.py @@ -1201,11 +1201,19 @@ def create_announcement(message, raw): m = re.match(r'<#(\d+)>', param) if m is None: m = re.match(r'#(\d+)', param) - if m is not None: + if m is None: + m = re.match(r'#(.+)', param) + if m is not None: + # Look for a channel with that name. + for channel in client.get_all_channels(): + if channel.name == m.group(1): + create[k] = channel.id + ok = True + break + else: create[k] = m.group(1) ok = True - else: - break + break elif arg == 'sound': create['sound'] = param ok = True -- 2.7.4