mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-24 14:07:03 +01:00
Zero pad discriminators
This commit is contained in:
parent
1d2a94ce1a
commit
2d9f962edf
@ -61,6 +61,12 @@
|
|||||||
String.prototype.replaceAll = function(target, replacement) {
|
String.prototype.replaceAll = function(target, replacement) {
|
||||||
return this.split(target).join(replacement);
|
return this.split(target).join(replacement);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function zeroPad(discrim) {
|
||||||
|
var str = "" + discrim;
|
||||||
|
var pad = "0000";
|
||||||
|
return pad.substring(0, pad.length - str.length) + str;
|
||||||
|
}
|
||||||
|
|
||||||
function query_guild() {
|
function query_guild() {
|
||||||
var url = "/api/query_guild";
|
var url = "/api/query_guild";
|
||||||
@ -707,7 +713,7 @@
|
|||||||
$("#guest-members-count").html(users.length);
|
$("#guest-members-count").html(users.length);
|
||||||
for (var i = 0; i < users.length; i++) {
|
for (var i = 0; i < users.length; i++) {
|
||||||
var member = users[i];
|
var member = users[i];
|
||||||
var rendered = Mustache.render(template, {"username": member.username, "discriminator": member.discriminator});
|
var rendered = Mustache.render(template, {"username": member.username, "discriminator": zeroPad(member.discriminator)});
|
||||||
$("#embed-unauth-users").append(rendered);
|
$("#embed-unauth-users").append(rendered);
|
||||||
}
|
}
|
||||||
unauthenticated_users_list = users;
|
unauthenticated_users_list = users;
|
||||||
@ -755,8 +761,8 @@
|
|||||||
}
|
}
|
||||||
$("#usercard .avatar").attr("src", data.avatar_url);
|
$("#usercard .avatar").attr("src", data.avatar_url);
|
||||||
$("#usercard .identity .username").text(data.username);
|
$("#usercard .identity .username").text(data.username);
|
||||||
$("#usercard .identity .discriminator").text(data.discriminator);
|
$("#usercard .identity .discriminator").text(zeroPad(data.discriminator));
|
||||||
$("#usercard .identity .discriminator").text(data.discriminator);
|
$("#usercard .identity .discriminator").text(zeroPad(data.discriminator));
|
||||||
|
|
||||||
var template = $('#mustache_rolebubble').html();
|
var template = $('#mustache_rolebubble').html();
|
||||||
Mustache.parse(template);
|
Mustache.parse(template);
|
||||||
@ -846,7 +852,7 @@
|
|||||||
if (mention.nickname) {
|
if (mention.nickname) {
|
||||||
username = mention.nickname;
|
username = mention.nickname;
|
||||||
}
|
}
|
||||||
var rendered = Mustache.render(template, {"username": username, "discriminator": mention.discriminator}).trim();
|
var rendered = Mustache.render(template, {"username": username, "discriminator": zeroPad(mention.discriminator)}).trim();
|
||||||
message.content = message.content.replace(new RegExp("<@" + mention.id + ">", 'g'), rendered);
|
message.content = message.content.replace(new RegExp("<@" + mention.id + ">", 'g'), rendered);
|
||||||
message.content = message.content.replace(new RegExp("<@!" + mention.id + ">", 'g'), rendered);
|
message.content = message.content.replace(new RegExp("<@!" + mention.id + ">", 'g'), rendered);
|
||||||
message.content = message.content.replace("<@&" + guild_id + ">", "@everyone");
|
message.content = message.content.replace("<@&" + guild_id + ">", "@everyone");
|
||||||
@ -1094,7 +1100,7 @@
|
|||||||
if (message.author.nickname) {
|
if (message.author.nickname) {
|
||||||
username = message.author.nickname;
|
username = message.author.nickname;
|
||||||
}
|
}
|
||||||
var rendered = Mustache.render(template, {"id": message.id, "full_timestamp": message.formatted_timestamp, "time": message.formatted_time, "username": username, "discriminator": message.author.discriminator, "avatar": avatar, "content": nl2br(message.content)});
|
var rendered = Mustache.render(template, {"id": message.id, "full_timestamp": message.formatted_timestamp, "time": message.formatted_time, "username": username, "discriminator": zeroPad(message.author.discriminator), "avatar": avatar, "content": nl2br(message.content)});
|
||||||
if (replace == null) {
|
if (replace == null) {
|
||||||
$("#chatcontent").append(rendered);
|
$("#chatcontent").append(rendered);
|
||||||
handle_last_message_mention();
|
handle_last_message_mention();
|
||||||
|
Loading…
Reference in New Issue
Block a user