we dev on prod in here boys

This commit is contained in:
cirroskais 2024-03-18 14:58:51 -04:00
parent 404c4af435
commit 9cf24faaaf
No known key found for this signature in database
GPG key ID: 5FC73EBF2678E33D
2 changed files with 8 additions and 9 deletions

View file

@ -1,12 +1,15 @@
<script lang="ts">
import { authorize, setActivity } from "./lib/discord";
let output = {};
let output = "";
authorize().then(async (auth) => {
// we now have our authenticated context.
output = await setActivity();
});
async function main() {
const result = await authorize();
output += `result: ${JSON.stringify(result)}\n`;
}
main();
</script>
<main>

View file

@ -1,11 +1,8 @@
const CLIENT_ID = "869016244613951539";
import { DiscordSDK } from "@discord/embedded-app-sdk";
import { writable } from "svelte/store";
const discordSdk = new DiscordSDK(CLIENT_ID);
export let information = writable();
export async function authorize() {
const { code } = await discordSdk.commands.authorize({
client_id: CLIENT_ID,
@ -28,7 +25,6 @@ export async function authorize() {
const { access_token } = await response.json();
const auth = await discordSdk.commands.authenticate({ access_token });
information.set(auth);
return auth;
}