we dev on prod in here boys

This commit is contained in:
cirroskais 2024-03-18 15:09:46 -04:00
parent 79bf78252f
commit 23db1d5c88
No known key found for this signature in database
GPG key ID: 5FC73EBF2678E33D
2 changed files with 15 additions and 16 deletions

View file

@ -1,15 +1,22 @@
<script lang="ts"> <script lang="ts">
import { authorize, setActivity } from "./lib/discord"; import { authorize, discordSdk } from "./lib/discord";
let output = ""; let output = "";
async function main() { async function main() {
const auth = await authorize(); const auth = await authorize();
output += `auth: ${JSON.stringify(auth)}\n`; output = output + `auth: ${JSON.stringify(auth)}\n`;
if (!auth) return (output += `failed to authenticate :'c`); if (!auth) return (output += `failed to authenticate :'c`);
const activity = await setActivity(); const activity = await discordSdk.commands.setActivity({
output += `activity: ${JSON.stringify(activity)}\n`; activity: {
type: 0,
details: "garf",
state: "Playing",
},
});
output = output + `activity: ${JSON.stringify(activity)}\n`;
} }
main(); main();
@ -17,5 +24,7 @@
<main> <main>
<p>garf 2: eletric boogaloo</p> <p>garf 2: eletric boogaloo</p>
<tt>{output}</tt> {#key output}
<tt>{output}</tt>
{/key}
</main> </main>

View file

@ -1,7 +1,7 @@
const CLIENT_ID = "869016244613951539"; const CLIENT_ID = "869016244613951539";
import { DiscordSDK } from "@discord/embedded-app-sdk"; import { DiscordSDK } from "@discord/embedded-app-sdk";
const discordSdk = new DiscordSDK(CLIENT_ID); export const discordSdk = new DiscordSDK(CLIENT_ID);
export async function authorize() { export async function authorize() {
await discordSdk.ready(); await discordSdk.ready();
@ -30,13 +30,3 @@ export async function authorize() {
return auth; return auth;
} }
export async function setActivity() {
return await discordSdk.commands.setActivity({
activity: {
type: 0,
details: "garf",
state: "Playing",
},
});
}