Browse Source

Support 'User (mention)' style mentions.

pull/171/head
slicedlime 5 years ago
parent
commit
f51fc05252
  1. 1
      disco/bot/bot.py
  2. 4
      disco/types/user.py

1
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:

4
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)

Loading…
Cancel
Save