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 23f7e46 commit 1a072ee
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions discord.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$(document).ready(function() {
const clientId = "1001933562565644338"; // Replace with your actual client ID
const redirectUri = "https://code-glitchers.github.io/Glitch-Gadgets/"; // Your actual redirect URI
const redirectUri = "https://code-glitchers.github.io/Glitch-Gadgets/callback"; // Your actual redirect URI
const scope = "identify";

const loginButton = $("#loginButton");
Expand All @@ -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 Down

0 comments on commit 1a072ee

Please sign in to comment.