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 39979da commit 23f7e46
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 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,4 +44,3 @@ $(document).ready(function() {
});
}
});

0 comments on commit 23f7e46

Please sign in to comment.