Skip to content

Commit 412cda2

Browse files
authored
Merge pull request #9 from UltronDevelopment/feat/newDiscordTags
Supports discord's new global/display names
2 parents 4bec260 + f7db22b commit 412cda2

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

app.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const app = express();
44
const https = require(`https`);
55
const http = require(`http`);
66
const path = require(`path`);
7-
const axios = require(`axios`);
87
const { readFileSync, existsSync } = require("fs");
98

109
server.cfg = require(`./src/config.json`);
@@ -89,6 +88,9 @@ app.get(`/:id`, async (req, res, next) => {
8988
avatar: `https://cdn.discordapp.com/embed/avatars/${Math.floor(Math.random() * 6)}.png`,
9089
id,
9190
tag: `Clyde#0000`,
91+
globalName: `@clyde`,
92+
displayName: `Clyde`,
93+
migrated: !!Math.floor(Math.random() * 2),
9294
bot: false,
9395
badges: ``,
9496
created,
@@ -121,14 +123,13 @@ app.get(`/:id`, async (req, res, next) => {
121123

122124
const avatar = data.avatar ? `https://cdn.discordapp.com/avatars/${id}/${data.avatar}.${data.avatar.startsWith(`a_`) ? `gif` : `png`}?size=1024` : `https://cdn.discordapp.com/embed/avatars/${data.discriminator % 5}.png`;
123125
const banner = data.banner ? `https://cdn.discordapp.com/banners/${id}/${data.banner}.${data.banner.startsWith(`a_`) ? `gif` : `png`}?size=1024` : null;
124-
const tag = `${data.username}#${data.discriminator}`;
125126
const badges = server.util.getUserBadges(data.public_flags).map((badge) => {
126127
return `<span><img src="img/${badge}.png" class="badgepng"></span>`;
127128
}).join(`\n`);
128129
const created = new Date(server.util.getTimestamp(id)).toUTCString();
129130
const color = data.banner_color;
130131

131-
res.render(`user`, { avatar, banner, id, tag, bot: data.bot, badges, created, color });
132+
res.render(`user`, { avatar, banner, id, tag: `${data.username}#${data.discriminator}`, globalName: data.username, displayName: data.display_name, migrated: data.discriminator == '0', bot: data.bot, badges, created, color });
132133
} else if(invite.success) {
133134
const { guild, channel, code } = invite;
134135

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "discord.id",
3-
"version": "1.3.5",
3+
"version": "1.4.0",
44
"main": "app.js",
55
"description": "This is an inofficial remake of discord.id",
66
"repository": {

public/css/app.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ a {
259259
content: "\f3a5"
260260
}
261261

262+
.fa-globe:before {
263+
content: "\f57d"
264+
}
265+
262266
.fas {
263267
font-family: Font Awesome\ 5 Pro;
264268
font-weight: 900

views/user.ejs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@
5858
</a>
5959
<% } %>
6060
<p><span class="fas fa-hashtag"></span> <strong>User ID</strong>: <span class="resulth"><%= locals.id %></span></p>
61-
<p><span class="fas fa-user"></span> <strong>Username</strong>: <span class="resulth" style="color: rgb(228, 154, 255);"><%= locals.tag %></span><%- locals.bot ? `<img src="img/15.png" style="vertical-align: text-top; height: 1.2rem; margin-left: 0.2rem; margin-bottom: 0.1rem;">` : `` %></p>
61+
<% if(locals.migrated) { %>
62+
<p><span class="fas fa-globe"></span> <strong>Global Name</strong>: <span class="resulth" style="color: rgb(228, 154, 255);"><%= locals.globalName %></span><%- locals.bot ? `<img src="img/15.png" style="vertical-align: text-top; height: 1.2rem; margin-left: 0.2rem; margin-bottom: 0.1rem;">` : `` %></p>
63+
<p><span class="fas fa-user"></span> <strong>Display Name</strong>: <span class="resulth" style="color: rgb(255, 160, 158);"><%= locals.displayName %></span></p>
64+
<% } else { %>
65+
<p><span class="fas fa-user"></span> <strong>Username</strong>: <span class="resulth" style="color: rgb(228, 154, 255);"><%= locals.tag %></span><%- locals.bot ? `<img src="img/15.png" style="vertical-align: text-top; height: 1.2rem; margin-left: 0.2rem; margin-bottom: 0.1rem;">` : `` %></p>
66+
<% } %>
6267
<p><span class="fas fa-tags"></span> <strong>Badges</strong>:
6368
<%- locals.badges || `-` %>
6469
</p>

0 commit comments

Comments
 (0)