mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +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):
|
def get_message_mentions(self, mentions):
|
||||||
ments = []
|
ments = []
|
||||||
for author in mentions:
|
for author in mentions:
|
||||||
if author.nick:
|
|
||||||
author.name = author.nick
|
|
||||||
ments.append({
|
ments.append({
|
||||||
"username": author.name,
|
"username": author.name,
|
||||||
"discriminator": author.discriminator,
|
"discriminator": author.discriminator,
|
||||||
|
@ -54,5 +54,10 @@ def get_channel_messages(guild_id, channel_id, after_snowflake=None):
|
|||||||
message["author"]["nickname"] = None
|
message["author"]["nickname"] = None
|
||||||
if member:
|
if member:
|
||||||
message["author"]["nickname"] = member.nickname
|
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)
|
msgs.append(message)
|
||||||
return msgs
|
return msgs
|
||||||
|
@ -510,8 +510,12 @@
|
|||||||
var mentions = message.mentions;
|
var mentions = message.mentions;
|
||||||
for (var i = 0; i < mentions.length; i++) {
|
for (var i = 0; i < mentions.length; i++) {
|
||||||
var mention = mentions[i];
|
var mention = mentions[i];
|
||||||
message.content = message.content.replace(new RegExp("<@" + mention.id + ">", 'g'), "@" + mention.username + "#" + mention.discriminator);
|
var username = mention.username;
|
||||||
message.content = message.content.replace(new RegExp("<@!" + mention.id + ">", 'g'), "@" + mention.username + "#" + mention.discriminator);
|
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");
|
message.content = message.content.replace("<@&" + guild_id + ">", "@everyone");
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
|
Loading…
Reference in New Issue
Block a user