mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-23 21:47:04 +01:00
Fix mentions with nicknames
This commit is contained in:
parent
77bde8f258
commit
68d8882d3e
@ -81,8 +81,6 @@ 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,
|
||||
|
@ -54,5 +54,10 @@ def get_channel_messages(guild_id, channel_id, after_snowflake=None):
|
||||
message["author"]["nickname"] = None
|
||||
if member:
|
||||
message["author"]["nickname"] = member.nickname
|
||||
for mention in message["mentions"]:
|
||||
author = get_guild_member(guild_id, mention["id"])
|
||||
mention["nickname"] = None
|
||||
if author:
|
||||
mention["nickname"] = author.nickname
|
||||
msgs.append(message)
|
||||
return msgs
|
||||
|
@ -510,8 +510,12 @@
|
||||
var mentions = message.mentions;
|
||||
for (var i = 0; i < mentions.length; i++) {
|
||||
var mention = mentions[i];
|
||||
message.content = message.content.replace(new RegExp("<@" + mention.id + ">", 'g'), "@" + mention.username + "#" + mention.discriminator);
|
||||
message.content = message.content.replace(new RegExp("<@!" + mention.id + ">", 'g'), "@" + mention.username + "#" + mention.discriminator);
|
||||
var username = mention.username;
|
||||
if (mention.nickname) {
|
||||
username = mention.nickname;
|
||||
}
|
||||
message.content = message.content.replace(new RegExp("<@" + mention.id + ">", 'g'), "@" + username + "#" + mention.discriminator);
|
||||
message.content = message.content.replace(new RegExp("<@!" + mention.id + ">", 'g'), "@" + username + "#" + mention.discriminator);
|
||||
message.content = message.content.replace("<@&" + guild_id + ">", "@everyone");
|
||||
}
|
||||
return message;
|
||||
|
Loading…
Reference in New Issue
Block a user