Skip to content

Commit

Permalink
doing something
Browse files Browse the repository at this point in the history
  • Loading branch information
yorunoken committed Jun 5, 2024
1 parent 1651b70 commit 7aa58d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/embed-builders/card.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { chromium } from "playwright";
import { browser } from "index";
import type { CardBuilderOptions } from "@type/embedBuilders";
import type { MessageReplyOptions } from "@lilybird/transformers";

const browser = await chromium.launch();

export async function cardBuilder({ user }: CardBuilderOptions): Promise<MessageReplyOptions> {
const now = performance.now();

Expand Down
13 changes: 8 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { createHandler } from "@lilybird/handlers/simple";
import { CachingDelegationType, createClient, Intents } from "lilybird";
import { Channel, Guild, GuildVoiceChannel } from "@lilybird/transformers";
import { $ } from "bun";
import { chromium } from "playwright";
import { writeFile } from "node:fs/promises";

// refresh token every hour
Expand All @@ -16,6 +17,13 @@ async function setToken(): Promise<void> {

await setToken();

// make sure chromium is dead
try {
await $`pkill chromium && pkill chromium-browser`;
} catch (e) {}

export const browser = await chromium.launch();

process.on("unhandledRejection", async (error: Error) => {
await loadLogs(`ERROR: uncaught exception: ${error.stack}`, true);
});
Expand Down Expand Up @@ -51,8 +59,3 @@ await createClient({
...listeners
});

// make sure chromium is dead
try {
await $`pkill chromium && pkill chromium-browser`;
} catch (e) {}

0 comments on commit 7aa58d7

Please sign in to comment.