Skip to content

Commit

Permalink
Update discord.js
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenbanz authored Aug 10, 2023
1 parent 62ad4cd commit 39979da
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions discord.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $(document).ready(function() {
const usernameElement = $("#username");

loginButton.click(function() {
window.location.href = https://discord.com/api/oauth2/authorize?client_id=${clientId}&redirect_uri=${encodeURIComponent(redirectUri)}&response_type=token&scope=${scope};
window.location.href = `https://discord.com/api/oauth2/authorize?client_id=${clientId}&redirect_uri=${encodeURIComponent(redirectUri)}&response_type=token&scope=${scope}`;
});

function parseHashParams() {
Expand All @@ -28,14 +28,14 @@ $(document).ready(function() {

fetch("https://discord.com/api/users/@me", {
headers: {
Authorization: Bearer ${params.access_token},
Authorization: `Bearer ${params.access_token}`,
},
})
.then(response => response.json())
.then(user => {
const avatarUrl = user.avatar ? https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png : "https://discord.com/assets/322c936a8c8be1b803cd94861bdfa868.png";
const avatarUrl = user.avatar ? `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png` : "https://discord.com/assets/322c936a8c8be1b803cd94861bdfa868.png";
avatarElement.attr("src", avatarUrl);
usernameElement.text(Hello, ${user.username}#${user.discriminator}!);
usernameElement.text(`Hello, ${user.username}#${user.discriminator}!`);
userInfoDiv.show();
loginButton.hide();
})
Expand All @@ -44,3 +44,4 @@ $(document).ready(function() {
});
}
});

0 comments on commit 39979da

Please sign in to comment.