we dev on prod in here boys
This commit is contained in:
parent
404c4af435
commit
9cf24faaaf
2 changed files with 8 additions and 9 deletions
|
@ -1,12 +1,15 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { authorize, setActivity } from "./lib/discord";
|
import { authorize, setActivity } from "./lib/discord";
|
||||||
|
|
||||||
let output = {};
|
let output = "";
|
||||||
|
|
||||||
authorize().then(async (auth) => {
|
async function main() {
|
||||||
// we now have our authenticated context.
|
const result = await authorize();
|
||||||
output = await setActivity();
|
|
||||||
});
|
output += `result: ${JSON.stringify(result)}\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
const CLIENT_ID = "869016244613951539";
|
const CLIENT_ID = "869016244613951539";
|
||||||
|
|
||||||
import { DiscordSDK } from "@discord/embedded-app-sdk";
|
import { DiscordSDK } from "@discord/embedded-app-sdk";
|
||||||
import { writable } from "svelte/store";
|
|
||||||
const discordSdk = new DiscordSDK(CLIENT_ID);
|
const discordSdk = new DiscordSDK(CLIENT_ID);
|
||||||
|
|
||||||
export let information = writable();
|
|
||||||
|
|
||||||
export async function authorize() {
|
export async function authorize() {
|
||||||
const { code } = await discordSdk.commands.authorize({
|
const { code } = await discordSdk.commands.authorize({
|
||||||
client_id: CLIENT_ID,
|
client_id: CLIENT_ID,
|
||||||
|
@ -28,7 +25,6 @@ export async function authorize() {
|
||||||
const { access_token } = await response.json();
|
const { access_token } = await response.json();
|
||||||
|
|
||||||
const auth = await discordSdk.commands.authenticate({ access_token });
|
const auth = await discordSdk.commands.authenticate({ access_token });
|
||||||
information.set(auth);
|
|
||||||
|
|
||||||
return auth;
|
return auth;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue