ethan!
ethan!
Explore posts from servers
NNuxt
Created by ethan! on 6/28/2024 in #❓・help
API route called multiple times
after that they load fine
15 replies
NNuxt
Created by ethan! on 6/28/2024 in #❓・help
API route called multiple times
? but it only happens when i first start the project
15 replies
NNuxt
Created by ethan! on 6/28/2024 in #❓・help
API route called multiple times
@manniL / TheAlexLichter okay so it only seems to do it when im on the page then i restart
15 replies
NNuxt
Created by ethan! on 6/28/2024 in #❓・help
API route called multiple times
i dont know
15 replies
NNuxt
Created by ethan! on 6/28/2024 in #❓・help
API route called multiple times
<template>
<div class="mt-20 mb-10">
<h1 class="text-5xl font-bold">Select a server</h1>
<h2 class="text-xl text-muted-foreground mb-5">You manage <span class="text-primary">{{ user?.guilds.length }}</span> servers</h2>

<Button variant="outline" @click="refreshGuilds">
<Icon icon="radix-icons:reload" class="mr-2 h-5 w-5" />
<span class="text-base">Refresh</span>
</Button>

<div class="mx-1 h-px bg-muted my-10" />
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-9">
<Card v-for="(guild, i) in guilds" :key="i" class="flex flex-col justify-between flex-grow">
<CardHeader>
<img :src="`https://cdn.discordapp.com/icons/${guild.id}/${guild.icon}.png`" alt="icon" height="70" width="70" class="rounded-full">
<CardTitle class="pt-3 text-lg break-words">{{ guild.name }}</CardTitle>
<CardDescription class="text-base">{{ guild.owner ? 'Owner' : 'Server Manager' }}</CardDescription>
</CardHeader>
<CardFooter>
<Button :variant="guild.botInGuild ? 'default' : 'outline'" class="w-full text-base">
<RouterLink :external="guild.botInGuild ? false : true" :to="guild.botInGuild ? `/dashboard/${guild.id}/member-screening` : `https://discord.com/oauth2/authorize?client_id=${runtimeConfig.public.url}&guild_id=${guild.id}&redirect_uri=${encodeURIComponent(`${runtimeConfig.public.url}/dashboard`)}&response_type=code&permissions=8&scope=bot`">
{{ guild.botInGuild ? 'Configure' : 'Add Bot' }}
</RouterLink>
</Button>
</CardFooter>
</Card>
</div>
</template>

<script setup lang="ts">
import { Icon } from "@iconify/vue";
import { useToast } from "@/components/ui/toast/use-toast";

const { toast } = useToast();
const runtimeConfig = useRuntimeConfig();

const user = useUser();
const { data: guilds } = useFetch("/api/discord/guilds");

async function refreshGuilds() { // TODO: ratelimit
if(!user) return toast({ title: "Uh oh! Something went wrong.", description: "If this issue persists, please contact the site manager." });

// TODO
}
</script>
<template>
<div class="mt-20 mb-10">
<h1 class="text-5xl font-bold">Select a server</h1>
<h2 class="text-xl text-muted-foreground mb-5">You manage <span class="text-primary">{{ user?.guilds.length }}</span> servers</h2>

<Button variant="outline" @click="refreshGuilds">
<Icon icon="radix-icons:reload" class="mr-2 h-5 w-5" />
<span class="text-base">Refresh</span>
</Button>

<div class="mx-1 h-px bg-muted my-10" />
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-9">
<Card v-for="(guild, i) in guilds" :key="i" class="flex flex-col justify-between flex-grow">
<CardHeader>
<img :src="`https://cdn.discordapp.com/icons/${guild.id}/${guild.icon}.png`" alt="icon" height="70" width="70" class="rounded-full">
<CardTitle class="pt-3 text-lg break-words">{{ guild.name }}</CardTitle>
<CardDescription class="text-base">{{ guild.owner ? 'Owner' : 'Server Manager' }}</CardDescription>
</CardHeader>
<CardFooter>
<Button :variant="guild.botInGuild ? 'default' : 'outline'" class="w-full text-base">
<RouterLink :external="guild.botInGuild ? false : true" :to="guild.botInGuild ? `/dashboard/${guild.id}/member-screening` : `https://discord.com/oauth2/authorize?client_id=${runtimeConfig.public.url}&guild_id=${guild.id}&redirect_uri=${encodeURIComponent(`${runtimeConfig.public.url}/dashboard`)}&response_type=code&permissions=8&scope=bot`">
{{ guild.botInGuild ? 'Configure' : 'Add Bot' }}
</RouterLink>
</Button>
</CardFooter>
</Card>
</div>
</template>

<script setup lang="ts">
import { Icon } from "@iconify/vue";
import { useToast } from "@/components/ui/toast/use-toast";

const { toast } = useToast();
const runtimeConfig = useRuntimeConfig();

const user = useUser();
const { data: guilds } = useFetch("/api/discord/guilds");

async function refreshGuilds() { // TODO: ratelimit
if(!user) return toast({ title: "Uh oh! Something went wrong.", description: "If this issue persists, please contact the site manager." });

// TODO
}
</script>
the page itself loads two times
15 replies
NNuxt
Created by ethan! on 6/28/2024 in #❓・help
API route called multiple times
well when the bot joins a server the info will be outdated so i cant really cache
15 replies
NNuxt
Created by ethan! on 6/28/2024 in #❓・help
API route called multiple times
i can assure you i have one call
15 replies
NNuxt
Created by ethan! on 6/25/2024 in #❓・help
Buffer is not defined
thank you
20 replies
NNuxt
Created by ethan! on 6/25/2024 in #❓・help
Buffer is not defined
ah, are there any docs on that?
20 replies
NNuxt
Created by ethan! on 6/25/2024 in #❓・help
Buffer is not defined
what are the pros of using nitro as opposed to a custom backend?
20 replies
NNuxt
Created by ethan! on 6/25/2024 in #❓・help
Buffer is not defined
there's a lot of api calls in that file, how do i go about moving that to the server and using it in the client?
20 replies
NNuxt
Created by ethan! on 6/25/2024 in #❓・help
Buffer is not defined
ah i use it in src/lib
20 replies
NNuxt
Created by ethan! on 6/25/2024 in #❓・help
Buffer is not defined
all i have in that file is
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
import * as schema from "~/server/db/schema";
import { env } from "~/env";

const db = drizzle(postgres(env.DATABASE_URL), { schema });
export { db };
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
import * as schema from "~/server/db/schema";
import { env } from "~/env";

const db = drizzle(postgres(env.DATABASE_URL), { schema });
export { db };
20 replies
NNuxt
Created by ethan! on 6/25/2024 in #❓・help
Buffer is not defined
how do i know if i'm on the client or server side?
20 replies
NNuxt
Created by ethan! on 6/25/2024 in #❓・help
Buffer is not defined
the only place i reference postgres is in src/server/db/index.ts
20 replies
NNuxt
Created by ethan! on 6/23/2024 in #❓・help
Pages directory
No description
19 replies
NNuxt
Created by ethan! on 6/23/2024 in #❓・help
Pages directory
is it because of my core folder?
19 replies
NNuxt
Created by ethan! on 6/23/2024 in #❓・help
Pages directory
it’s not detecting my components because they’re called index.vue
19 replies
NNuxt
Created by ethan! on 6/23/2024 in #❓・help
Pages directory
i mean for auto imports
19 replies
NNuxt
Created by ethan! on 6/23/2024 in #❓・help
Pages directory
@manniL / TheAlexLichter i’m sorry for the pings i kinda need this bug fixed ;-;
19 replies