From f51fc052522dc32a760c6148d34c14f08ba0ea81 Mon Sep 17 00:00:00 2001 From: slicedlime Date: Thu, 19 Dec 2019 17:01:10 +0100 Subject: [PATCH] Support 'User (mention)' style mentions. --- disco/bot/bot.py | 1 + disco/types/user.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/disco/bot/bot.py b/disco/bot/bot.py index 0679381..65d8a58 100644 --- a/disco/bot/bot.py +++ b/disco/bot/bot.py @@ -312,6 +312,7 @@ class Bot(LoggingClass): if member.nick: content = content.replace(member.mention, '', 1) content = content.replace(member.user.mention, '', 1) + content = content.replace(member.user.mention_nickname, '', 1) else: content = content.replace(self.client.state.me.mention, '', 1) elif mention_everyone: diff --git a/disco/types/user.py b/disco/types/user.py index 63e9542..974233c 100644 --- a/disco/types/user.py +++ b/disco/types/user.py @@ -44,6 +44,10 @@ class User(SlottedModel, with_equality('id'), with_hash('id')): def mention(self): return '<@{}>'.format(self.id) + @property + def mention_nickname(self): + return '<@!{}>'.format(self.id) + def open_dm(self): return self.client.api.users_me_dms_create(self.id)