account for the discord bridge in the core bot addressed flag
This commit is contained in:
@@ -171,7 +171,18 @@ class DrReactor(irc.client.Reactor):
|
||||
else:
|
||||
all_nicks = connection.get_nickname()
|
||||
addressed_pattern = r'^(({nicks})[:,]|@({nicks}))\s+(?P<addressed_msg>.*)'.format(nicks=all_nicks)
|
||||
match = re.match(addressed_pattern, what, re.IGNORECASE)
|
||||
|
||||
# ignore the first word, a nick, if the speaker is the bridge
|
||||
try:
|
||||
channel = IrcChannel.objects.get(name=sent_location)
|
||||
if sender_nick == channel.discord_bridge:
|
||||
short_what = ' '.join(what.split(' ')[1:])
|
||||
match = re.match(addressed_pattern, short_what, re.IGNORECASE)
|
||||
else:
|
||||
match = re.match(addressed_pattern, what, re.IGNORECASE)
|
||||
except IrcChannel.DoesNotExist:
|
||||
match = re.match(addressed_pattern, what, re.IGNORECASE)
|
||||
|
||||
if match:
|
||||
event.addressed = True
|
||||
event.addressed_msg = match.group('addressed_msg')
|
||||
|
||||
Reference in New Issue
Block a user