The weeb for the next gen discord boat - Wamellow wamellow.com
bot discord
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

add /new page

Luna 8cb7966b 05644015

+85 -4
+26
app/(home)/new/page.tsx
··· 1 + import React from "react"; 2 + import { HiHome } from "react-icons/hi"; 3 + 4 + import BeautifyMarkdown from "@/components/BeautifyMarkdown"; 5 + import OverviewLinkComponent from "@/components/OverviewLinkComponent"; 6 + import { getCanonicalUrl } from "@/utils/urls"; 7 + 8 + export default async function Home() { 9 + const res = await fetch(getCanonicalUrl("new.md"), { next: { revalidate: 60 * 60 } }); 10 + const markdown = await res.text(); 11 + 12 + return ( 13 + <div> 14 + 15 + <OverviewLinkComponent 16 + title="View Homepage" 17 + message="Start your exciting journey with wamellow here in just a few seconds." 18 + url="/" 19 + icon={<HiHome />} 20 + /> 21 + 22 + <BeautifyMarkdown markdown={markdown} /> 23 + 24 + </div> 25 + ); 26 + }
+19 -4
components/BeautifyMarkdown.tsx
··· 5 5 6 6 const BeautifyMarkdown: FunctionComponent<{ markdown: string }> = ({ markdown }) => { 7 7 8 + function parseDiscordMarkdown(content: string) { 9 + return content 10 + .replace(/__(.*?)__/g, "<u>$1</u>") 11 + // .replace(/<a?:\w{2,32}:(.*?)>/g, "<img className='rounded-md' style='height: 1.375em; position: relative' src=\"https://cdn.discordapp.com/emojis/$1.webp?size=40&quality=lossless\" />") 12 + .replace(/<a?:\w{2,32}:(.*?)>/g, "") 13 + .replace(/<(@|@!)\d{15,21}>/g, "<span className='bg-blurple/25 hover:bg-blurple/50 p-1 rounded-md dark:text-neutral-100 text-neutral-900 font-light text-sx duration-200 cursor-pointer'>@User</span>") 14 + .replace(/<(#)\d{15,21}>/g, "<span className='bg-blurple/25 hover:bg-blurple/50 p-1 rounded-md dark:text-neutral-100 text-neutral-900 font-light text-sx duration-200 cursor-pointer'>@Channel</span>"); 15 + } 8 16 9 17 return ( 10 18 <ReactMarkdown 11 19 rehypePlugins={[rehypeRaw]} 12 20 components={{ 21 + h1: ({ ...props }) => <Link 22 + href={`#${props.children.toString().toLowerCase().replace(/ +/g, "-")}`} 23 + className="flex mt-10 mb-3 cursor-pointer dark:text-neutral-100 text-neutral-900 hover:underline" 24 + > 25 + <h2 id={props.children.toString().toLowerCase().replace(/ +/g, "-")} className="text-3xl font-semibold" {...props} /> 26 + </Link>, 27 + 13 28 h2: ({ ...props }) => <Link 14 29 href={`#${props.children.toString().toLowerCase().replace(/ +/g, "-")}`} 15 - className="flex mt-6 mb-2 cursor-pointer text-neutral-100 hover:underline" 30 + className="flex mt-6 mb-2 cursor-pointer dark:text-neutral-100 text-neutral-900 hover:underline" 16 31 > 17 - <div id={props.children.toString().toLowerCase().replace(/ +/g, "-")} className="text-2xl font-semibold" {...props} /> 32 + <h1 id={props.children.toString().toLowerCase().replace(/ +/g, "-")} className="text-2xl font-semibold" {...props} /> 18 33 </Link>, 19 34 20 - strong: ({ ...props }) => <span className="font-semibold text-neutral-200" {...props} />, 35 + strong: ({ ...props }) => <span className="font-semibold dark:text-neutral-200 text-neutral-800" {...props} />, 21 36 i: ({ ...props }) => <span className="italic" {...props} />, 22 37 a: ({ ...props }) => <a className="text-blue-500 hover:underline underline-blue-500" {...props} />, 23 38 del: ({ ...props }) => <span className="line-through" {...props} />, ··· 28 43 </div> 29 44 }} 30 45 > 31 - {markdown} 46 + {parseDiscordMarkdown(markdown)} 32 47 </ReactMarkdown> 33 48 ); 34 49
+2
components/discord/Markdown.tsx
··· 13 13 .replaceAll(">", "&gt;"); 14 14 15 15 const plClassName = `${mode === "DARK" ? "bg-wamellow text-neutral-200" : "bg-wamellow-100 text-neutral-800"} border border-violet-400 p-[3px] rounded-lg opacity-80 font-light`; 16 + const emClassName = "rounded.md"; 16 17 17 18 function parseDiscordMarkdown(content: string) { 18 19 return content 19 20 .replace(/__(.*?)__/g, "<u>$1</u>") 20 21 .replace(/\{(.*?)\.(.*?)\}/g, `<span className='${plClassName}'>$1 $2</span>`) 22 + .replace(/<a?:\w{2,32}:(.*?)>/g, `<img className='${emClassName}' src="$https://cdn.discordapp.com/emojis/$1.webp?size=40&quality=lossless" />`) 21 23 .replace(/<(@|@!)\d{15,21}>/g, "<span className='bg-blurple/25 hover:bg-blurple/50 p-1 rounded-md text-neutral-100 font-light text-sx duration-200 cursor-pointer'>@User</span>") 22 24 .replace(/<(#)\d{15,21}>/g, "<span className='bg-blurple/25 hover:bg-blurple/50 p-1 rounded-md text-neutral-100 font-light text-sx duration-200 cursor-pointer'>@Channel</span>"); 23 25 }
+38
public/new.md
··· 1 + # Why a new version 2 + **last modified 04/13/2023 (MM/DD/YYYY)** 3 + 4 + The current version of @waya (v2, or also referenced as waya.ts) started development on __June 11th 2022__ using <:typescript:1073953098772529222> **Typescript** as programming language and <:MongoDB:1112259921220751360> **Mongodb** as database. 5 + 6 + <br /> 7 + 8 + As Waya grew to more and more servers, we’ve received more “`This interaction failed`” issues occurring, this was because of our database having a latency of 3 seconds or more, which should me sub 0.1 second (<100ms) and the [CPU usage going to 100%](<https://c.lunish.nl/r/Ef5W4N.png>) on all 6 cores. The original solution was a way to cache the database locally in the bots memory space to speed up database requests, but this only partially solved the issue. Yes it solved the database’s latency on cached responses but it didn’t at all on not cached responses, even though the servers CPU usage dropped from 100% on 6 cores to an average of 21%. But that caching also made up a new issue, [the ram usage](<https://c.lunish.nl/r/Z49rrv.png>), not only is [Waya using up to 10% (1.2gb) ram per shard](<https://c.lunish.nl/r/SQtMxT.png>) but also [MongoDB is using 16% (1.2gb)](https://c.lunish.nl/r/PCSW8A.png). 9 + 10 + <br /> 11 + 12 + Additional to the database issue, Waya suffered a huge issue with the /config command due to it having more than 9.000 lines of code, having redundant code and just being a pain to work on, plus code and quality was really inconsistent across the whole source code (both Waya bot and Waya web). 13 + 14 + <br /> 15 + 16 + After this all I came to the following conclusions: 17 + - Fuck am I a bad developer 18 + - The code out grew it’s user base 19 + - Commands do not work for setup 20 + - A rewrite has to come 21 + 22 + 23 + # The rewrite to Waya v3 24 + On the __2nd of July__ I’ve started with the development of v3, code named [mwya](<https://wamellow.com>), @wamellow. It still uses <:typescript:1073953098772529222> **Typescript** as programming language but <:postgres:1073953306667397161> **PostgreSQL** as a database and finally a dashboard made with <:next1:1065672519144714322> **NextJs** and <:tailwind:913088128468787210> **TailwindCSS**. 25 + 26 + 27 + I’ve seen the opportunity of [making a web dashboard already in __January 2022__](<https://cdn.waya.one/r/1645566813.mp4>), have even started one, but it has never reached a production level as I was never happy with the design and solutions I have come up with, __1 and a half year later,__ I think I’ve done a better job than ever with __https://wamellow.com__ and I’m excited to announce that this is the **public alpha version of Waya v3**. There isn’t a lot of done yet and many things to come, but I think that it will be an amazing product, and with your help we can make it bug free for the release into #bugs. 28 + 29 + 30 + # Notes before testing v3 31 + Please note that @wamellow ([Waya v3](<https://wamellow.com>)) is expected to have a ton of bugs until the final release of it, we do not recommend using @wamellow as your primary bot in your server and rather just play and test with it. We'd thank you for reporting any bugs in the <#1135632624019329085> forum. 32 + 33 + 34 + # Wamellow -> Waya migration 35 + Wamellow will stay online for ever, even after the migration, it will be turned into the nightly (moonly) version of @waya, which means it will get new updates instantly which may have bugs or other issues, just so the bot keeps a purpose <a:RainbowVibeCat:819684581505499166> 36 + 37 + 38 + I guess the ETA to the migration to 1-2 months from now on august 2023, there are still quiet a few things left to do