Implement nickname support

Nicknames will be shown in both the embed and discord.
This commit is contained in:
JustMaffie
2017-08-02 13:43:51 +02:00
committed by Jeremy Zhang
parent 5da55cc66b
commit 2ace5f7040
2 changed files with 19 additions and 4 deletions

View File

@ -69,6 +69,8 @@ class DatabaseInterface(object):
def get_message_author(self, message):
author = message.author
if author.nick is not None:
author.name = author.nick
obj = {
"username": author.name,
"discriminator": author.discriminator,
@ -81,6 +83,8 @@ class DatabaseInterface(object):
def get_message_mentions(self, mentions):
ments = []
for author in mentions:
if author.nick:
author.name = author.nick
ments.append({
"username": author.name,
"discriminator": author.discriminator,
@ -264,7 +268,7 @@ class DatabaseInterface(object):
dbmember.active = active
dbmember.username = member.name
dbmember.discriminator = member.discriminator
dbmember.nick = member.nick
dbmember.nickname = member.nick
dbmember.avatar = member.avatar
dbmember.roles = json.dumps(self.list_role_ids(member.roles))
session.commit()