0 ? dataset[0].bench.unit : "",
+ },
+ beginAtZero: true,
+ },
+ },
+ plugins: {
+ tooltip: {
+ callbacks: {
+ afterTitle: (items) => {
+ const index = items[0].dataIndex;
+ const data = dataset[index];
+ return "\n" + data.commit.message + "\n\n" + data.commit.timestamp + " committed by @" +
+ data.commit.author.username + "\n";
+ },
+ label: (item) => {
+ let label = item.formattedValue;
+ const { range, unit } = dataset[item.datasetIndex].bench;
+ label += " " + unit;
+ if (range) {
+ label += " (" + range + ")";
+ }
+ return label;
+ },
+ afterLabel: (item) => {
+ const { extra } = dataset[item.datasetIndex].bench;
+ return extra ? "\n" + extra : "";
+ },
+ },
+ },
+ },
+ onClick: (_mouseEvent, activeElems) => {
+ if (activeElems.length === 0) {
+ return;
+ }
+ // XXX: Undocumented. How can we know the index?
+ const index = activeElems[0].index;
+ const url = dataset[index].commit.url;
+ window.open(url, "_blank");
+ },
+ }}
+ />
+ );
+};
+
+export default function BenchmarkResultCharts(): JSX.Element {
+ const [data, setData] = useState<{ entries: { Benchmark: [] } }>();
+
+ useEffect(() => {
+ if (!data) {
+ (async () => {
+ setData(
+ JSON.parse(
+ (await (await fetch(
+ "https://raw.githubusercontent.com/discordeno/discordeno/benchies/benchmarksResult/data.js",
+ )).text()).slice(24),
+ ),
+ );
+ })();
+ }
+ }, []);
+
+ function collectBenchesPerTestCase(entries) {
+ const dataMap = new Map();
+ for (const entry of entries) {
+ const { commit, date, tool, benches } = entry;
+ for (const bench of benches) {
+ const result = { commit, date, tool, bench };
+ const arr = dataMap.get(bench.name);
+ if (arr === undefined) {
+ dataMap.set(bench.name, [result]);
+ } else {
+ arr.push(result);
+ }
+ }
+ }
+ return dataMap;
+ }
+
+ return (
+
+ {data
+ ? Array.from(
+ collectBenchesPerTestCase(data.entries.Benchmark),
+ ([key, value]) => ({ benchName: key, benches: value }),
+ ).map((
+ bench,
+ index,
+ ) => (
+
+ ))
+ : <>>}
+
+ );
+}
diff --git a/site/src/components/BenchmarkResultCharts.jsx b/site/src/components/BenchmarkResultCharts.jsx
deleted file mode 100644
index ef040f82a..000000000
--- a/site/src/components/BenchmarkResultCharts.jsx
+++ /dev/null
@@ -1,147 +0,0 @@
-import { useColorMode } from "@docusaurus/theme-common";
-import React, { useEffect, useState } from "react";
-import { Line } from "react-chartjs-2";
-// Colors from https://github.com/github/linguist/blob/master/lib/linguist/languages.yml
-const toolColors = {
- cargo: "#dea584",
- go: "#00add8",
- benchmarkjs: "#f1e05a",
- benchmarkluau: "#000080",
- pytest: "#3572a5",
- googlecpp: "#f34b7d",
- catch2: "#f34b7d",
- julia: "#a270ba",
- benchmarkdotnet: "#178600",
- customBiggerIsBetter: "#38ff38",
- customSmallerIsBetter: "#ff3838",
- _: "#333333",
-};
-
-const BenchmarkResultChart = ({ name, dataset, theme }) => {
- const color = toolColors[dataset.length > 0 ? dataset[0].tool : "_"];
- const data = {
- labels: dataset.map((d) => d.commit.id.slice(0, 7)),
- datasets: [
- {
- label: name,
- data: dataset.map((d) => d.bench.value),
- borderColor: color,
- backgroundColor: color + "60", // Add alpha for #rrggbbaa
- },
- ],
- };
- const options = {
- scales: {
- xAxes: [
- {
- scaleLabel: {
- display: true,
- labelString: "commit",
- },
- },
- ],
- yAxes: [
- {
- scaleLabel: {
- display: true,
- labelString: dataset.length > 0 ? dataset[0].bench.unit : "",
- },
- ticks: {
- beginAtZero: true,
- },
- },
- ],
- legend: {
- labels: {
- // This more specific font property overrides the global property
- defaultFontColor: theme === "light" ? "#000000" : "#FFFFFF",
- },
- },
- },
- tooltips: {
- callbacks: {
- afterTitle: (items) => {
- const { index } = items[0];
- const data = dataset[index];
- return "\n" + data.commit.message + "\n\n" + data.commit.timestamp + " committed by @" +
- data.commit.committer.username + "\n";
- },
- label: (item) => {
- let label = item.value;
- const { range, unit } = dataset[item.index].bench;
- label += " " + unit;
- if (range) {
- label += " (" + range + ")";
- }
- return label;
- },
- afterLabel: (item) => {
- const { extra } = dataset[item.index].bench;
- return extra ? "\n" + extra : "";
- },
- },
- },
- onClick: (_mouseEvent, activeElems) => {
- if (activeElems.length === 0) {
- return;
- }
- // XXX: Undocumented. How can we know the index?
- const index = activeElems[0]._index;
- const url = dataset[index].commit.url;
- window.open(url, "_blank");
- },
- };
- // console.log(theme);
- return ;
-};
-
-export default function BenchmarkResultCharts() {
- const { colorMode } = useColorMode();
- const [data, setData] = useState();
-
- useEffect(async () => {
- if (!data) {
- setData(
- JSON.parse(
- (await (await fetch(
- "https://raw.githubusercontent.com/discordeno/discordeno/benchies/benchmarksResult/data.js",
- )).text()).slice(24),
- ),
- );
- }
- }, []);
-
- function collectBenchesPerTestCase(entries) {
- const dataMap = new Map();
- for (const entry of entries) {
- const { commit, date, tool, benches } = entry;
- for (const bench of benches) {
- const result = { commit, date, tool, bench };
- const arr = dataMap.get(bench.name);
- if (arr === undefined) {
- dataMap.set(bench.name, [result]);
- } else {
- arr.push(result);
- }
- }
- }
- return dataMap;
- }
-
- return (data
- ? Array.from(
- collectBenchesPerTestCase(data.entries.Benchmark),
- ([key, value]) => ({ benchName: key, benches: value }),
- ).map((
- bench,
- index,
- ) => (
-
- ))
- : <>>);
-}
diff --git a/site/src/components/architecture/BaseFlowChart.tsx b/site/src/components/architecture/BaseFlowChart.tsx
new file mode 100644
index 000000000..bc1117bb2
--- /dev/null
+++ b/site/src/components/architecture/BaseFlowChart.tsx
@@ -0,0 +1,93 @@
+import React, { useEffect, useState } from "react";
+import ReactFlow, { Background, Controls, Edge, Handle, Node, Position, useEdgesState, useNodesState } from "reactflow";
+import "reactflow/dist/style.css";
+
+export const multiplier = 225;
+export const height = 40;
+export const widthMultiplier = 0.75;
+
+export const defaultNodeOptions = {
+ targetPosition: Position.Left,
+ sourcePosition: Position.Right,
+ draggable: false,
+ style: { width: `${multiplier * 0.75}px`, height: `${height}px` },
+};
+
+export const defaultGroupOptions = {
+ draggable: false,
+};
+
+export default function BaseFlowChart(
+ { initialNodes = [], initialEdges = [] }: { initialNodes: Node[]; initialEdges: Edge[] },
+) {
+ function getWindowDimensions() {
+ const { innerWidth: width, innerHeight: height } = window;
+ return {
+ width,
+ height,
+ };
+ }
+
+ const [windowDimensions, setWindowDimensions] = useState(getWindowDimensions());
+
+ useEffect(() => {
+ function handleResize() {
+ setWindowDimensions(getWindowDimensions());
+ }
+
+ window.addEventListener("resize", handleResize);
+ return () => window.removeEventListener("resize", handleResize);
+ }, []);
+
+ const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
+ const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
+
+ return (
+ <>
+ = 997
+ ? `${
+ (100 *
+ ((windowDimensions.width - 300 -
+ (windowDimensions.width >= 1620 ? (windowDimensions.width - 1620) * 0.5 : 0)) /
+ windowDimensions.width) - 2) * widthMultiplier
+ }vw`
+ : "95vw",
+ height: "25vh",
+ }}
+ >
+
(
+
+
+
+
+ ),
+ baseLineNodeText: (n) => (
+
+
{n.data.label}
+
+ ),
+ }}
+ fitView
+ >
+
+
+
+
+ >
+ );
+}
diff --git a/site/src/components/architecture/FlowChart.tsx b/site/src/components/architecture/FlowChart.tsx
new file mode 100644
index 000000000..d89ade8eb
--- /dev/null
+++ b/site/src/components/architecture/FlowChart.tsx
@@ -0,0 +1,103 @@
+import React from "react";
+import { Edge, Node } from "reactflow";
+import "reactflow/dist/style.css";
+import BaseFlowChart, { defaultNodeOptions, multiplier } from "./BaseFlowChart";
+
+const initialNodes: Node[] = [
+ {
+ id: "discordGateway",
+ type: "input",
+ position: { x: 0 * multiplier, y: 0 },
+ data: { label: "Discord Gateway" },
+ ...defaultNodeOptions,
+ },
+ { id: "gateway", position: { x: 1 * multiplier, y: 0 }, data: { label: "Gateway" }, ...defaultNodeOptions },
+ { id: "baseLineNode-1", type: "baseLineNode", position: { x: 0.85 * multiplier, y: 170 }, data: {} },
+ { id: "baseLineNode-2", type: "baseLineNode", position: { x: 0.85 * multiplier, y: -130 }, data: {} },
+ { id: "baseLineNode-3", type: "baseLineNode", position: { x: 2.85 * multiplier, y: 170 }, data: {} },
+ { id: "baseLineNode-4", type: "baseLineNode", position: { x: 2.85 * multiplier, y: -130 }, data: {} },
+ { id: "baseLineNode-5", type: "baseLineNode", position: { x: 3.85 * multiplier, y: 170 }, data: {} },
+ { id: "baseLineNode-6", type: "baseLineNode", position: { x: 3.85 * multiplier, y: -130 }, data: {} },
+ { id: "baseLineNode-7", type: "baseLineNode", position: { x: 4.85 * multiplier, y: 170 }, data: {} },
+ { id: "baseLineNode-8", type: "baseLineNode", position: { x: 4.85 * multiplier, y: -130 }, data: {} },
+ {
+ id: "baseLineNodeText-1",
+ type: "baseLineNodeText",
+ position: { x: 0 * multiplier, y: -130 },
+ data: { label: "Discord" },
+ },
+ {
+ id: "baseLineNodeText-2",
+ type: "baseLineNodeText",
+ position: { x: 1.5 * multiplier, y: -130 },
+ data: { label: "Event In" },
+ },
+ {
+ id: "baseLineNodeText-3",
+ type: "baseLineNodeText",
+ position: { x: 3 * multiplier, y: -130 },
+ data: { label: "Event Processing" },
+ },
+ {
+ id: "baseLineNodeText-4",
+ type: "baseLineNodeText",
+ position: { x: 4 * multiplier, y: -130 },
+ data: { label: "Event out" },
+ },
+ {
+ id: "baseLineNodeText-6",
+ type: "baseLineNodeText",
+ position: { x: 5 * multiplier, y: -130 },
+ data: { label: "Discord" },
+ },
+ { id: "bot", position: { x: 2 * multiplier, y: 0 }, data: { label: "Bot" }, ...defaultNodeOptions },
+ { id: "yourCode", position: { x: 3 * multiplier, y: 0 }, data: { label: "Your Code" }, ...defaultNodeOptions },
+ { id: "rest", position: { x: 4 * multiplier, y: 0 }, data: { label: "Rest" }, ...defaultNodeOptions },
+ {
+ id: "discordApiGateway",
+ type: "output",
+ position: { x: 5 * multiplier, y: 0 },
+ data: { label: "Discord Api" },
+ ...defaultNodeOptions,
+ },
+];
+
+const initialEdges: Edge[] = [
+ { id: "d-g", source: "discordGateway", target: "gateway" },
+ { id: "g-b", source: "gateway", target: "bot" },
+ { id: "b-y", source: "bot", target: "yourCode" },
+ { id: "y-r", source: "yourCode", target: "rest" },
+ { id: "r-d", source: "rest", target: "discordApiGateway" },
+ {
+ id: "baseLine-1",
+ source: "baseLineNode-1",
+ target: "baseLineNode-2",
+ style: { stroke: "blue", strokeDasharray: 20 },
+ animated: false,
+ },
+ {
+ id: "baseLine-2",
+ source: "baseLineNode-3",
+ target: "baseLineNode-4",
+ style: { stroke: "blue", strokeDasharray: 20 },
+ animated: false,
+ },
+ {
+ id: "baseLine-3",
+ source: "baseLineNode-5",
+ target: "baseLineNode-6",
+ style: { stroke: "blue", strokeDasharray: 20 },
+ animated: false,
+ },
+ {
+ id: "baseLine-4",
+ source: "baseLineNode-7",
+ target: "baseLineNode-8",
+ style: { stroke: "blue", strokeDasharray: 20 },
+ animated: false,
+ },
+];
+
+export default function FlowChart() {
+ return ;
+}
diff --git a/site/src/components/architecture/FlowChart2.tsx b/site/src/components/architecture/FlowChart2.tsx
new file mode 100644
index 000000000..6f10ee87d
--- /dev/null
+++ b/site/src/components/architecture/FlowChart2.tsx
@@ -0,0 +1,198 @@
+import React from "react";
+import { Edge, Node, Position } from "reactflow";
+import "reactflow/dist/style.css";
+import BaseFlowChart, { defaultGroupOptions, defaultNodeOptions, multiplier } from "./BaseFlowChart";
+
+const initialNodes: Node[] = [
+ {
+ id: "discordGateway",
+ type: "input",
+ position: { x: 0 * multiplier, y: 0 },
+ data: { label: "Discord Gateway" },
+ ...defaultNodeOptions,
+ },
+ { id: "baseLineNode-1", type: "baseLineNode", position: { x: 0.85 * multiplier, y: 170 }, data: {} },
+ { id: "baseLineNode-2", type: "baseLineNode", position: { x: 0.85 * multiplier, y: -130 }, data: {} },
+ { id: "baseLineNode-3", type: "baseLineNode", position: { x: 3.75 * multiplier, y: 170 }, data: {} },
+ { id: "baseLineNode-4", type: "baseLineNode", position: { x: 3.75 * multiplier, y: -130 }, data: {} },
+ {
+ id: "baseLineNodeText-1",
+ type: "baseLineNodeText",
+ position: { x: 0 * multiplier, y: -130 },
+ data: { label: "Discord" },
+ },
+ {
+ id: "baseLineNodeText-2",
+ type: "baseLineNodeText",
+ position: { x: 2 * multiplier, y: -130 },
+ data: { label: "Gateway" },
+ },
+ {
+ id: "baseLineNodeText-3",
+ type: "baseLineNodeText",
+ position: { x: 4 * multiplier, y: -130 },
+ data: { label: "Bot" },
+ },
+ {
+ id: "gatewayManager",
+ type: "input",
+ position: { x: 2.0625 * multiplier, y: -80 },
+ data: { label: "Gateway Manager" },
+ ...defaultNodeOptions,
+ targetPosition: Position.Top,
+ sourcePosition: Position.Bottom,
+ },
+ {
+ id: "shard-1",
+ type: "output",
+ position: { x: 1.25 * multiplier, y: -20 },
+ data: { label: "Shard-1" },
+ style: { width: `${multiplier * 2}px`, height: "80px" },
+ ...defaultGroupOptions,
+ },
+ {
+ id: "shard-1-socket",
+ position: { x: 0.125 * multiplier, y: 20 },
+ data: { label: "webSocket" },
+ ...defaultNodeOptions,
+ parentNode: "shard-1",
+ extent: "parent",
+ },
+ {
+ id: "shard-1-handleMessage",
+ position: { x: 1.125 * multiplier, y: 20 },
+ data: { label: "HandleMessage" },
+ ...defaultNodeOptions,
+ parentNode: "shard-1",
+ extent: "parent",
+ },
+ {
+ id: "shard-2",
+ type: "output",
+ position: { x: 1.375 * multiplier, y: 0 },
+ data: { label: "Shard-2" },
+ style: { width: `${multiplier * 2}px`, height: "80px" },
+ ...defaultGroupOptions,
+ },
+ {
+ id: "shard-2-socket",
+ position: { x: 0.125 * multiplier, y: 20 },
+ data: { label: "webSocket" },
+ ...defaultNodeOptions,
+ parentNode: "shard-2",
+ extent: "parent",
+ },
+ {
+ id: "shard-2-handleMessage",
+ position: { x: 1.125 * multiplier, y: 20 },
+ data: { label: "HandleMessage" },
+ ...defaultNodeOptions,
+ parentNode: "shard-2",
+ extent: "parent",
+ },
+ {
+ id: "shard-3",
+ type: "output",
+ position: { x: 1.5 * multiplier, y: 20 },
+ data: { label: "Shard-3" },
+ style: { width: `${multiplier * 2}px`, height: "80px" },
+ ...defaultGroupOptions,
+ },
+ {
+ id: "shard-3-socket",
+ position: { x: 0.125 * multiplier, y: 20 },
+ data: { label: "webSocket" },
+ ...defaultNodeOptions,
+ parentNode: "shard-3",
+ extent: "parent",
+ },
+ {
+ id: "shard-3-handleMessage",
+ position: { x: 1.125 * multiplier, y: 20 },
+ data: { label: "HandleMessage" },
+ ...defaultNodeOptions,
+ parentNode: "shard-3",
+ extent: "parent",
+ },
+ {
+ id: "shard-n",
+ type: "output",
+ position: { x: 1.625 * multiplier, y: 40 },
+ data: { label: "Shard-N" },
+ style: { width: `${multiplier * 2}px`, height: "80px" },
+ ...defaultGroupOptions,
+ },
+ {
+ id: "shard-n-socket",
+ position: { x: 0.125 * multiplier, y: 20 },
+ data: { label: "webSocket" },
+ ...defaultNodeOptions,
+ parentNode: "shard-n",
+ extent: "parent",
+ },
+ {
+ id: "shard-n-handleMessage",
+ position: { x: 1.125 * multiplier, y: 20 },
+ data: { label: "HandleMessage" },
+ ...defaultNodeOptions,
+ parentNode: "shard-n",
+ extent: "parent",
+ },
+ { id: "bot", type: "output", position: { x: 4 * multiplier, y: 0 }, data: { label: "Bot" }, ...defaultNodeOptions },
+];
+
+const initialEdges: Edge[] = [
+ { id: "d-g", source: "discordGateway", target: "gateway" },
+ { id: "g-b", source: "gateway", target: "bot" },
+ { id: "b-y", source: "bot", target: "yourCode" },
+ { id: "y-r", source: "yourCode", target: "rest" },
+ { id: "r-d", source: "rest", target: "discordApiGateway" },
+ {
+ id: "baseLine-1",
+ source: "baseLineNode-1",
+ target: "baseLineNode-2",
+ style: { stroke: "blue", strokeDasharray: 20 },
+ animated: false,
+ },
+ {
+ id: "baseLine-2",
+ source: "baseLineNode-3",
+ target: "baseLineNode-4",
+ style: { stroke: "blue", strokeDasharray: 20 },
+ animated: false,
+ },
+ {
+ id: "baseLine-3",
+ source: "baseLineNode-5",
+ target: "baseLineNode-6",
+ style: { stroke: "blue", strokeDasharray: 20 },
+ animated: false,
+ },
+ {
+ id: "baseLine-4",
+ source: "baseLineNode-7",
+ target: "baseLineNode-8",
+ style: { stroke: "blue", strokeDasharray: 20 },
+ animated: false,
+ },
+ { id: "d-shard-1", source: "discordGateway", target: "shard-1-socket", zIndex: 100 },
+ { id: "d-shard-2", source: "discordGateway", target: "shard-2-socket", zIndex: 100 },
+ { id: "d-shard-3", source: "discordGateway", target: "shard-3-socket", zIndex: 100 },
+ { id: "d-shard-n", source: "discordGateway", target: "shard-n-socket", zIndex: 100 },
+ { id: "shard-1-socket-handleMessage", source: "shard-1-socket", target: "shard-1-handleMessage", zIndex: 100 },
+ { id: "shard-2-socket-handleMessage", source: "shard-2-socket", target: "shard-2-handleMessage", zIndex: 100 },
+ { id: "shard-3-socket-handleMessage", source: "shard-3-socket", target: "shard-3-handleMessage", zIndex: 100 },
+ { id: "shard-n-socket-handleMessage", source: "shard-n-socket", target: "shard-n-handleMessage", zIndex: 100 },
+ { id: "shard-1-handleMessage-bot", source: "shard-1-handleMessage", target: "bot", zIndex: 100 },
+ { id: "shard-2-handleMessage-bot", source: "shard-2-handleMessage", target: "bot", zIndex: 100 },
+ { id: "shard-3-handleMessage-bot", source: "shard-3-handleMessage", target: "bot", zIndex: 100 },
+ { id: "shard-n-handleMessage-bot", source: "shard-n-handleMessage", target: "bot", zIndex: 100 },
+ { id: "gatewayManager-shard-1", source: "gatewayManager", target: "shard-1", zIndex: 10 },
+ { id: "gatewayManager-shard-2", source: "gatewayManager", target: "shard-2", zIndex: 100 },
+ { id: "gatewayManager-shard-3", source: "gatewayManager", target: "shard-3", zIndex: 100 },
+ { id: "gatewayManager-shard-n", source: "gatewayManager", target: "shard-n", zIndex: 100 },
+];
+
+export default function FlowChart2() {
+ return ;
+}
diff --git a/site/src/components/architecture/FlowChart3.tsx b/site/src/components/architecture/FlowChart3.tsx
new file mode 100644
index 000000000..6131215e4
--- /dev/null
+++ b/site/src/components/architecture/FlowChart3.tsx
@@ -0,0 +1,669 @@
+import React, { useEffect, useState } from "react";
+import ReactFlow, {
+ Background,
+ Controls,
+ Edge,
+ Handle,
+ Node,
+ NodeMouseHandler,
+ Position,
+ useEdgesState,
+ useNodesState,
+} from "reactflow";
+import "reactflow/dist/style.css";
+import { defaultNodeOptions, height, multiplier, widthMultiplier } from "./BaseFlowChart";
+
+const handlers: {
+ [index: string]: {
+ transformers: string[];
+ event: string;
+ };
+} = {
+ handleChannelCreate: { transformers: ["transformers.channel"], event: "events.channelCreate" },
+ handleChannelDelete: {
+ transformers: ["transformers.channel", "transformers.snowflake"],
+ event: "events.channelDelete",
+ },
+ handleChannelPinsUpdate: {
+ transformers: ["transformers.snowflake", "transformers.snowflake"],
+ event: "events.channelPinsUpdate",
+ },
+ handleChannelUpdate: { transformers: ["transformers.channel"], event: "events.channelUpdate" },
+ handleStageInstanceCreate: {
+ transformers: ["transformers.snowflake", "transformers.snowflake", "transformers.snowflake"],
+ event: "events.stageInstanceCreate",
+ },
+ handleStageInstanceDelete: {
+ transformers: ["transformers.snowflake", "transformers.snowflake", "transformers.snowflake"],
+ event: "events.stageInstanceDelete",
+ },
+ handleStageInstanceUpdate: {
+ transformers: ["transformers.snowflake", "transformers.snowflake", "transformers.snowflake"],
+ event: "events.stageInstanceUpdate",
+ },
+ handleThreadCreate: { transformers: ["transformers.channel"], event: "events.threadCreate" },
+ handleThreadDelete: { transformers: ["transformers.channel"], event: "events.threadDelete" },
+ handleThreadListSync: {
+ transformers: [
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.channel",
+ "transformers.snowflake",
+ "transformers.snowflake",
+ ],
+ event: undefined,
+ },
+ handleThreadMembersUpdate: {
+ transformers: [
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.threadMember",
+ "transformers.snowflake",
+ ],
+ event: "events.threadMembersUpdate",
+ },
+ handleThreadMemberUpdate: {
+ transformers: ["transformers.snowflake", "transformers.snowflake"],
+ event: "events.threadMemberUpdate",
+ },
+ handleThreadUpdate: { transformers: ["transformers.channel"], event: "events.threadUpdate" },
+ handleGuildEmojisUpdate: {
+ transformers: ["transformers.snowflake", "transformers.snowflake"],
+ event: "events.guildEmojisUpdate",
+ },
+ handleAutoModerationActionExecution: {
+ transformers: ["transformers.automodActionExecution"],
+ event: "events.automodActionExecution",
+ },
+ handleAutoModerationRuleCreate: { transformers: ["transformers.automodRule"], event: "events.automodRuleCreate" },
+ handleAutoModerationRuleDelete: { transformers: ["transformers.automodRule"], event: "events.automodRuleDelete" },
+ handleAutoModerationRuleUpdate: { transformers: ["transformers.automodRule"], event: "events.automodRuleUpdate" },
+ handleGuildBanAdd: {
+ transformers: ["transformers.user", "transformers.snowflake"],
+ event: "events.guildBanAdd",
+ },
+ handleGuildBanRemove: {
+ transformers: ["transformers.user", "transformers.snowflake"],
+ event: "events.guildBanRemove",
+ },
+ handleGuildCreate: { transformers: ["transformers.guild"], event: "events.guildCreate" },
+ handleGuildDelete: { transformers: ["transformers.snowflake"], event: "events.guildDelete" },
+ handleGuildIntegrationsUpdate: { transformers: ["transformers.snowflake"], event: "events.integrationUpdate" },
+ handleGuildUpdate: { transformers: ["transformers.guild"], event: "events.guildUpdate" },
+ handleGuildScheduledEventCreate: {
+ transformers: ["transformers.scheduledEvent"],
+ event: "events.scheduledEventCreate",
+ },
+ handleGuildScheduledEventDelete: {
+ transformers: ["transformers.scheduledEvent"],
+ event: "events.scheduledEventDelete",
+ },
+ handleGuildScheduledEventUpdate: {
+ transformers: ["transformers.scheduledEvent"],
+ event: "events.scheduledEventUpdate",
+ },
+ handleGuildScheduledEventUserAdd: {
+ transformers: ["transformers.snowflake", "transformers.snowflake", "transformers.snowflake"],
+ event: "events.scheduledEventUserAdd",
+ },
+ handleGuildScheduledEventUserRemove: {
+ transformers: ["transformers.snowflake", "transformers.snowflake", "transformers.snowflake"],
+ event: "events.scheduledEventUserRemove",
+ },
+ handleIntegrationCreate: { transformers: ["transformers.integration"], event: "events.integrationCreate" },
+ handleIntegrationDelete: {
+ transformers: ["transformers.snowflake", "transformers.snowflake", "transformers.snowflake"],
+ event: "events.integrationDelete",
+ },
+ handleIntegrationUpdate: { transformers: ["transformers.integration"], event: "events.integrationUpdate" },
+ handleInteractionCreate: {
+ transformers: ["transformers.snowflake", "transformers.interaction"],
+ event: "events.interactionCreate",
+ },
+ handleInviteCreate: { transformers: ["transformers.invite"], event: "events.inviteCreate" },
+ handleInviteDelete: {
+ transformers: ["transformers.snowflake", "transformers.snowflake"],
+ event: "events.inviteDelete",
+ },
+ handleGuildMembersChunk: {
+ transformers: [
+ "transformers.snowflake",
+ "transformers.member",
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.user",
+ "transformers.activity",
+ ],
+ event: undefined,
+ },
+ handleGuildMemberAdd: {
+ transformers: ["transformers.snowflake", "transformers.user", "transformers.member"],
+ event: "events.guildMemberAdd",
+ },
+ handleGuildMemberRemove: {
+ transformers: ["transformers.snowflake", "transformers.user"],
+ event: "events.guildMemberRemove",
+ },
+ handleGuildMemberUpdate: {
+ transformers: ["transformers.user", "transformers.member", "transformers.snowflake"],
+ event: "events.guildMemberUpdate",
+ },
+ handleMessageCreate: { transformers: ["transformers.message"], event: "events.messageCreate" },
+ handleMessageDelete: {
+ transformers: ["transformers.snowflake", "transformers.snowflake", "transformers.snowflake"],
+ event: "events.messageDelete",
+ },
+ handleMessageDeleteBulk: {
+ transformers: [
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.snowflake",
+ ],
+ event: "events.messageDeleteBulk",
+ },
+ handleMessageReactionAdd: {
+ transformers: [
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.member",
+ "transformers.user",
+ "transformers.emoji",
+ ],
+ event: "events.reactionAdd",
+ },
+ handleMessageReactionRemove: {
+ transformers: [
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.emoji",
+ ],
+ event: "events.reactionRemove",
+ },
+ handleMessageReactionRemoveAll: {
+ transformers: ["transformers.snowflake", "transformers.snowflake", "transformers.snowflake"],
+ event: "events.reactionRemoveAll",
+ },
+ handleMessageReactionRemoveEmoji: {
+ transformers: [
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.emoji",
+ ],
+ event: "events.reactionRemoveEmoji",
+ },
+ handleMessageUpdate: { transformers: ["transformers.message"], event: "events.messageUpdate" },
+ handlePresenceUpdate: { transformers: ["transformers.presence"], event: "events.presenceUpdate" },
+ handleReady: {
+ transformers: [
+ "transformers.user",
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.snowflake",
+ ],
+ event: "events.ready",
+ },
+ handleTypingStart: {
+ transformers: [
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.snowflake",
+ "transformers.member",
+ ],
+ event: "events.typingStart",
+ },
+ handleUserUpdate: { transformers: ["transformers.user"], event: "events.botUpdate" },
+ handleGuildRoleCreate: {
+ transformers: ["transformers.role", "transformers.snowflake"],
+ event: "events.roleCreate",
+ },
+ handleGuildRoleDelete: {
+ transformers: ["transformers.snowflake", "transformers.snowflake"],
+ event: "events.roleDelete",
+ },
+ handleGuildRoleUpdate: {
+ transformers: ["transformers.role", "transformers.snowflake"],
+ event: "events.roleUpdate",
+ },
+ handleVoiceServerUpdate: { transformers: ["transformers.snowflake"], event: "events.voiceServerUpdate" },
+ handleVoiceStateUpdate: {
+ transformers: ["transformers.snowflake", "transformers.voiceState"],
+ event: "events.voiceStateUpdate",
+ },
+ handleWebhooksUpdate: {
+ transformers: ["transformers.snowflake", "transformers.snowflake"],
+ event: "events.webhooksUpdate",
+ },
+};
+
+export default function FlowChart({ handlerFilter = (handler: string) => true }) {
+ function getWindowDimensions() {
+ const { innerWidth: width, innerHeight: height } = window;
+ return {
+ width,
+ height,
+ };
+ }
+
+ const [windowDimensions, setWindowDimensions] = useState(getWindowDimensions());
+
+ useEffect(() => {
+ function handleResize() {
+ setWindowDimensions(getWindowDimensions());
+ }
+
+ window.addEventListener("resize", handleResize);
+ return () => window.removeEventListener("resize", handleResize);
+ }, []);
+
+ const transformers = [];
+
+ const events = [];
+
+ const initialNodes: Node[] = [
+ {
+ id: "baseNode-gateway",
+ type: "input",
+ position: { x: 0 * multiplier, y: 0 },
+ data: { label: "gateway" },
+ ...defaultNodeOptions,
+ },
+ {
+ id: "baseNode-yourCode",
+ type: "output",
+ position: { x: 5 * multiplier, y: 0 },
+ data: { label: "Your Code" },
+ ...defaultNodeOptions,
+ },
+ { id: "baseLineNode-1", type: "baseLineNode", position: { x: 0.85 * multiplier, y: 170 }, data: {} },
+ { id: "baseLineNode-2", type: "baseLineNode", position: { x: 0.85 * multiplier, y: -130 }, data: {} },
+ { id: "baseLineNode-3", type: "baseLineNode", position: { x: 4.85 * multiplier, y: 170 }, data: {} },
+ { id: "baseLineNode-4", type: "baseLineNode", position: { x: 4.85 * multiplier, y: -130 }, data: {} },
+ {
+ id: "baseLineNodeText-1",
+ type: "baseLineNodeText",
+ position: { x: 0 * multiplier, y: -130 },
+ data: { label: "Gateway" },
+ },
+ {
+ id: "baseLineNodeText-2",
+ type: "baseLineNodeText",
+ position: { x: 1 * multiplier, y: -130 },
+ data: { label: "Bot" },
+ },
+ {
+ id: "baseLineNodeText-3",
+ type: "baseLineNodeText",
+ position: { x: 5 * multiplier, y: -130 },
+ data: { label: "Your Code" },
+ },
+ {
+ id: "baseNode-handleDiscordPayload",
+ position: { x: 1 * multiplier, y: 0 },
+ data: { label: "Handle discord payload" },
+ ...defaultNodeOptions,
+ },
+ ];
+
+ const initialEdges: Edge[] = [
+ { id: "baseEdge-1", source: "baseNode-gateway", target: "baseNode-handleDiscordPayload" },
+ { id: "baseEdge-3", source: "baseNode-g-1", target: "baseNode-g-2" },
+ { id: "baseEdge-4", source: "baseNode-g-2", target: "baseNode-handleDiscordPayload" },
+ {
+ id: "baseLine-1",
+ source: "baseLineNode-1",
+ target: "baseLineNode-2",
+ style: { stroke: "blue", strokeDasharray: 20 },
+ },
+ {
+ id: "baseLine-2",
+ source: "baseLineNode-3",
+ target: "baseLineNode-4",
+ style: { stroke: "blue", strokeDasharray: 20 },
+ },
+ ];
+
+ //@ts-ignore
+ for (const [index, handler] of Object.keys(handlers).filter(handlerFilter).entries()) {
+ initialNodes.push({
+ id: handler,
+ position: {
+ x: 2 * multiplier,
+ y: index * (height + 10) - Object.keys(handlers).filter(handlerFilter).length * ((height + 10) / 2) +
+ height / 2,
+ },
+ data: { label: handler.slice(6) },
+ ...defaultNodeOptions,
+ });
+ initialEdges.push({
+ id: `handleDiscordPayload-${handler}`,
+ source: "baseNode-handleDiscordPayload",
+ target: handler,
+ });
+ if (!events.find((e) => e === handlers[handler].event) && handlers[handler].event) {
+ events.push(handlers[handler].event);
+ initialEdges.push({
+ id: `${handlers[handler].event}-yourCode`,
+ source: handlers[handler].event,
+ target: "baseNode-yourCode",
+ });
+ }
+ for (const transformer of handlers[handler].transformers) {
+ if (!transformers.find((t) => t === transformer) && transformer) transformers.push(transformer);
+ if (!initialEdges.find((edge) => edge.id === `${handler}-${transformer}`) && transformer) {
+ initialEdges.push({ id: `${handler}-${transformer}`, source: handler, target: transformer });
+ }
+ if (
+ !initialEdges.find((edge) => edge.id === `${transformer}-${handlers[handler].event}`) && handlers[handler].event
+ ) {
+ initialEdges.push({
+ id: `${transformer}-${handlers[handler].event}`,
+ source: transformer,
+ target: handlers[handler].event,
+ });
+ }
+ }
+ }
+
+ //@ts-ignore
+ for (const [index, transformer] of transformers.entries()) {
+ initialNodes.push({
+ id: transformer,
+ position: {
+ x: 3 * multiplier,
+ y: index * (height + 10) - transformers.length * ((height + 10) / 2) + height / 2,
+ },
+ data: { label: transformer.slice(13) },
+ ...defaultNodeOptions,
+ });
+ }
+
+ //@ts-ignore
+ for (const [index, event] of events.entries()) {
+ initialNodes.push({
+ id: event,
+ position: { x: 4 * multiplier, y: index * (height + 10) - events.length * ((height + 10) / 2) + height / 2 },
+ data: { label: event.slice(7) },
+ ...defaultNodeOptions,
+ });
+ }
+
+ initialNodes.unshift(
+ {
+ id: "handlers",
+ type: "group",
+ position: {
+ x: 1.925 * multiplier,
+ y: -Object.keys(handlers).filter(handlerFilter).length * ((height + 10) / 2) - 45,
+ },
+ data: { label: "" },
+ style: {
+ height: `${Object.keys(handlers).filter(handlerFilter).length * (height + 10) + 75}px`,
+ width: `${multiplier * 0.9}px`,
+ borderColor: "rgba(0,0,0,0.25)",
+ },
+ draggable: false,
+ },
+ {
+ id: "baseLineNodeText-4",
+ type: "baseLineNodeText",
+ position: {
+ x: 2 * multiplier,
+ y: -Object.keys(handlers).filter(handlerFilter).length * ((height + 10) / 2) - ((height + 10) / 2),
+ },
+ data: { label: "Handlers" },
+ draggable: false,
+ },
+ {
+ id: "transformers",
+ type: "group",
+ position: { x: 2.925 * multiplier, y: -transformers.length * ((height + 10) / 2) - 45 },
+ data: { label: "" },
+ style: {
+ height: `${transformers.length * (height + 10) + 75}px`,
+ width: `${multiplier * 0.9}px`,
+ borderColor: "rgba(0,0,0,0.25)",
+ },
+ draggable: false,
+ },
+ {
+ id: "baseLineNodeText-5",
+ type: "baseLineNodeText",
+ position: { x: 3 * multiplier, y: -transformers.length * ((height + 10) / 2) - ((height + 10) / 2) },
+ data: { label: "Transformers" },
+ draggable: false,
+ },
+ {
+ id: "events",
+ type: "group",
+ position: { x: 3.925 * multiplier, y: -events.length * ((height + 10) / 2) - 45 },
+ data: { label: "" },
+ style: {
+ height: `${events.length * (height + 10) + 75}px`,
+ width: `${multiplier * 0.9}px`,
+ borderColor: "rgba(0,0,0,0.25)",
+ },
+ draggable: false,
+ },
+ {
+ id: "baseLineNodeText-6",
+ type: "baseLineNodeText",
+ position: { x: 4 * multiplier, y: -events.length * ((height + 10) / 2) - ((height + 10) / 2) },
+ data: { label: "Event" },
+ draggable: false,
+ },
+ );
+
+ const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
+ const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
+ const [handlerIndex, setHandlerIndex] = useState(0);
+ const [userClick, setUserClick] = useState(false);
+
+ const nodeMouseHandler: NodeMouseHandler = (_, node, userTrigger = true) => {
+ if (userTrigger) setUserClick(true);
+ if (node.id.split("-")[0] === "baseNode") {
+ edges.forEach((e) => {
+ if (e.id.startsWith("baseLine")) return;
+ e.animated = true;
+ e.style = { stroke: "blue" };
+ });
+ setEdges([...edges]);
+ return;
+ }
+ if (Object.keys(handlers).find((h) => handlers[h].event === node.id)) {
+ const handlerName = Object.keys(handlers).find((h) => handlers[h].event === node.id);
+ const handler = handlers[handlerName];
+ edges.forEach((e) => {
+ if (e.id.startsWith("baseLine")) return;
+ if (e.id.split("-")[0] === "baseEdge") {
+ e.animated = true;
+ e.style = { stroke: "blue" };
+ return;
+ }
+ if (e.id.split("-")[0] === "handleDiscordPayload" && e.id.split("-")[1] === handlerName) {
+ e.animated = true;
+ e.style = { stroke: "blue" };
+ return;
+ }
+ if (e.id.split("-")[0] === handlerName && handler.transformers.includes(e.id.split("-")[1])) {
+ e.animated = true;
+ e.style = { stroke: "blue" };
+ return;
+ }
+ if (handler.transformers.includes(e.id.split("-")[0]) && e.id.split("-")[1] === handler.event) {
+ e.animated = true;
+ e.style = { stroke: "blue" };
+ return;
+ }
+ if (e.id.split("-")[0] === handler.event && e.id.split("-")[1] === "yourCode") {
+ e.animated = true;
+ e.style = { stroke: "blue" };
+ return;
+ }
+ e.animated = false;
+ e.style = { opacity: 0.3 };
+ });
+ setEdges([...edges]);
+ return;
+ }
+ if (Object.keys(handlers).find((h) => handlers[h].transformers.includes(node.id))) {
+ edges.forEach((e) => {
+ if (e.id.startsWith("baseLine")) return;
+ if (e.id.split("-")[0] === "baseEdge") {
+ e.animated = true;
+ e.style = { stroke: "blue" };
+ return;
+ }
+ if (
+ e.id.split("-")[0] === "handleDiscordPayload" &&
+ Object.keys(handlers).filter((h) => handlers[h].transformers.includes(node.id)).includes(e.id.split("-")[1])
+ ) {
+ e.animated = true;
+ e.style = { stroke: "blue" };
+ return;
+ }
+ if (
+ Object.keys(handlers).filter((h) => handlers[h].transformers.includes(node.id)).includes(
+ e.id.split("-")[0],
+ ) && e.id.split("-")[1] === node.id
+ ) {
+ e.animated = true;
+ e.style = { stroke: "blue" };
+ return;
+ }
+ if (e.id.split("-")[0] === node.id) {
+ e.animated = true;
+ e.style = { stroke: "blue" };
+ return;
+ }
+ e.animated = false;
+ e.style = { opacity: 0.3 };
+ });
+ setEdges([...edges]);
+ return;
+ }
+ if (handlers[node.id]) {
+ const handler = handlers[node.id];
+ edges.forEach((e) => {
+ if (e.id.startsWith("baseLine")) return;
+ if (e.id.split("-")[0] === "baseEdge") {
+ e.animated = true;
+ e.style = { stroke: "blue" };
+ return;
+ }
+ if (e.id.split("-")[0] === "handleDiscordPayload" && e.id.split("-")[1] === node.id) {
+ e.animated = true;
+ e.style = { stroke: "blue" };
+ return;
+ }
+ if (e.id.split("-")[0] === node.id && handler.transformers.includes(e.id.split("-")[1])) {
+ e.animated = true;
+ e.style = { stroke: "blue" };
+ return;
+ }
+ if (handler.transformers.includes(e.id.split("-")[0]) && e.id.split("-")[1] === handler.event) {
+ e.animated = true;
+ e.style = { stroke: "blue" };
+ return;
+ }
+ if (e.id.split("-")[0] === handler.event) {
+ e.animated = true;
+ e.style = { stroke: "blue" };
+ return;
+ }
+ e.animated = false;
+ e.style = { opacity: 0.3 };
+ });
+ setEdges([...edges]);
+ return;
+ }
+ edges.forEach((e) => {
+ if (e.id.startsWith("baseLine")) return;
+ e.animated = false;
+ e.style = {};
+ });
+ setEdges([...edges]);
+ };
+
+ useEffect(() => {
+ const interval = setInterval(() => {
+ const randomIndex = Math.round((Object.keys(handlers).filter(handlerFilter).length - 1) * Math.random());
+ if (!userClick) {
+ nodeMouseHandler(undefined, { id: Object.keys(handlers).filter(handlerFilter)[randomIndex] }, false);
+ }
+ setHandlerIndex(randomIndex);
+ }, 1000);
+ return () => clearInterval(interval);
+ }, [userClick]);
+
+ useEffect(() => {
+ if (userClick) {
+ const timeout = setTimeout(() => {
+ setUserClick(false);
+ }, 10000);
+ return () => clearTimeout(timeout);
+ }
+ }, [userClick]);
+
+ return (
+ <>
+ = 997
+ ? `${
+ (100 *
+ ((windowDimensions.width - 300 -
+ (windowDimensions.width >= 1620 ? (windowDimensions.width - 1620) * 0.5 : 0)) /
+ windowDimensions.width) - 2) * widthMultiplier
+ }vw`
+ : "95vw",
+ height: "50vh",
+ }}
+ >
+
{
+ //@ts-ignore
+ if (e.target.className === "react-flow__pane") nodeMouseHandler(e, { id: " - ", data: { label: " - " } });
+ }}
+ nodeTypes={{
+ baseLineNode: () => (
+
+
+
+
+ ),
+ baseLineNodeText: (n) => (
+
+
{n.data.label}
+
+ ),
+ }}
+ fitView
+ >
+
+
+
+
+ >
+ );
+}
diff --git a/site/src/pages/index.tsx b/site/src/pages/index.tsx
index 0fa82d657..21d3bc09e 100644
--- a/site/src/pages/index.tsx
+++ b/site/src/pages/index.tsx
@@ -1,10 +1,10 @@
-import React from "react";
-import clsx from "clsx";
-import Layout from "@theme/Layout";
import Link from "@docusaurus/Link";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
-import styles from "./index.module.css";
+import Layout from "@theme/Layout";
+import clsx from "clsx";
+import React from "react";
import HomepageFeatures from "../components/HomepageFeatures";
+import styles from "./index.module.css";
function HomepageHeader() {
const { siteConfig } = useDocusaurusContext();
diff --git a/site/docs/amethyst/AmethystCollection.md b/site/tutorial/amethyst/AmethystCollection.md
similarity index 100%
rename from site/docs/amethyst/AmethystCollection.md
rename to site/tutorial/amethyst/AmethystCollection.md
diff --git a/site/docs/amethyst/AmethystEmbed.md b/site/tutorial/amethyst/AmethystEmbed.md
similarity index 100%
rename from site/docs/amethyst/AmethystEmbed.md
rename to site/tutorial/amethyst/AmethystEmbed.md
diff --git a/site/docs/amethyst/_category_.json b/site/tutorial/amethyst/_category_.json
similarity index 100%
rename from site/docs/amethyst/_category_.json
rename to site/tutorial/amethyst/_category_.json
diff --git a/site/docs/amethyst/client.md b/site/tutorial/amethyst/client.md
similarity index 100%
rename from site/docs/amethyst/client.md
rename to site/tutorial/amethyst/client.md
diff --git a/site/docs/amethyst/exampleBot.md b/site/tutorial/amethyst/exampleBot.md
similarity index 100%
rename from site/docs/amethyst/exampleBot.md
rename to site/tutorial/amethyst/exampleBot.md
diff --git a/site/docs/amethyst/intro.md b/site/tutorial/amethyst/intro.md
similarity index 100%
rename from site/docs/amethyst/intro.md
rename to site/tutorial/amethyst/intro.md
diff --git a/site/docs/big-bot-guide/_category_.json b/site/tutorial/big-bot-guide/_category_.json
similarity index 100%
rename from site/docs/big-bot-guide/_category_.json
rename to site/tutorial/big-bot-guide/_category_.json
diff --git a/site/docs/big-bot-guide/cache.md b/site/tutorial/big-bot-guide/cache.md
similarity index 100%
rename from site/docs/big-bot-guide/cache.md
rename to site/tutorial/big-bot-guide/cache.md
diff --git a/site/docs/big-bot-guide/events.md b/site/tutorial/big-bot-guide/events.md
similarity index 100%
rename from site/docs/big-bot-guide/events.md
rename to site/tutorial/big-bot-guide/events.md
diff --git a/site/docs/big-bot-guide/gateway.md b/site/tutorial/big-bot-guide/gateway.md
similarity index 99%
rename from site/docs/big-bot-guide/gateway.md
rename to site/tutorial/big-bot-guide/gateway.md
index b2497f00f..7f79dd954 100644
--- a/site/docs/big-bot-guide/gateway.md
+++ b/site/tutorial/big-bot-guide/gateway.md
@@ -127,14 +127,14 @@ const gateway = createGatewayManager({
});
```
-**Basic Keys**
+#### Basic Keys
- `EVENT_HANDLER_SECRET_KEY` is from your configs that will be used to make sure requests sent to your event handler
process are indeed from you.
- `DISCORD_TOKEN` if you can't figure this out, this guide isn't for you. Please find another.
- `INTENTS` pass in a number or a string of intents. Autocomplete/type-safety is provided for strings :)
-**Powerful Keys**
+#### Powerful Keys
If your bot is going to be run on one process, you can re-use the data that discord gave you to connect.
diff --git a/site/docs/big-bot-guide/rest.md b/site/tutorial/big-bot-guide/rest.md
similarity index 100%
rename from site/docs/big-bot-guide/rest.md
rename to site/tutorial/big-bot-guide/rest.md
diff --git a/site/docs/big-bot-guide/step-by-step.md b/site/tutorial/big-bot-guide/step-by-step.md
similarity index 100%
rename from site/docs/big-bot-guide/step-by-step.md
rename to site/tutorial/big-bot-guide/step-by-step.md
diff --git a/site/docs/nodejs/CommandHandler/_category_.json b/site/tutorial/nodejs/CommandHandler/_category_.json
similarity index 100%
rename from site/docs/nodejs/CommandHandler/_category_.json
rename to site/tutorial/nodejs/CommandHandler/_category_.json
diff --git a/site/docs/nodejs/CommandHandler/command-manager.md b/site/tutorial/nodejs/CommandHandler/command-manager.md
similarity index 100%
rename from site/docs/nodejs/CommandHandler/command-manager.md
rename to site/tutorial/nodejs/CommandHandler/command-manager.md
diff --git a/site/docs/nodejs/CommandHandler/create-command.md b/site/tutorial/nodejs/CommandHandler/create-command.md
similarity index 100%
rename from site/docs/nodejs/CommandHandler/create-command.md
rename to site/tutorial/nodejs/CommandHandler/create-command.md
diff --git a/site/docs/nodejs/CommandHandler/getting-started.md b/site/tutorial/nodejs/CommandHandler/getting-started.md
similarity index 100%
rename from site/docs/nodejs/CommandHandler/getting-started.md
rename to site/tutorial/nodejs/CommandHandler/getting-started.md
diff --git a/site/docs/nodejs/EventHandler/_category_.json b/site/tutorial/nodejs/EventHandler/_category_.json
similarity index 100%
rename from site/docs/nodejs/EventHandler/_category_.json
rename to site/tutorial/nodejs/EventHandler/_category_.json
diff --git a/site/docs/nodejs/EventHandler/event-manager.md b/site/tutorial/nodejs/EventHandler/event-manager.md
similarity index 100%
rename from site/docs/nodejs/EventHandler/event-manager.md
rename to site/tutorial/nodejs/EventHandler/event-manager.md
diff --git a/site/docs/nodejs/EventHandler/getting-started.md b/site/tutorial/nodejs/EventHandler/getting-started.md
similarity index 100%
rename from site/docs/nodejs/EventHandler/getting-started.md
rename to site/tutorial/nodejs/EventHandler/getting-started.md
diff --git a/site/docs/nodejs/EventHandler/handle-event.md b/site/tutorial/nodejs/EventHandler/handle-event.md
similarity index 100%
rename from site/docs/nodejs/EventHandler/handle-event.md
rename to site/tutorial/nodejs/EventHandler/handle-event.md
diff --git a/site/docs/nodejs/Structures/_category_.json b/site/tutorial/nodejs/Structures/_category_.json
similarity index 100%
rename from site/docs/nodejs/Structures/_category_.json
rename to site/tutorial/nodejs/Structures/_category_.json
diff --git a/site/docs/nodejs/Structures/collectors.md b/site/tutorial/nodejs/Structures/collectors.md
similarity index 100%
rename from site/docs/nodejs/Structures/collectors.md
rename to site/tutorial/nodejs/Structures/collectors.md
diff --git a/site/docs/nodejs/Structures/components.md b/site/tutorial/nodejs/Structures/components.md
similarity index 100%
rename from site/docs/nodejs/Structures/components.md
rename to site/tutorial/nodejs/Structures/components.md
diff --git a/site/docs/nodejs/Structures/create-structure.md b/site/tutorial/nodejs/Structures/create-structure.md
similarity index 100%
rename from site/docs/nodejs/Structures/create-structure.md
rename to site/tutorial/nodejs/Structures/create-structure.md
diff --git a/site/docs/nodejs/Structures/embeds.md b/site/tutorial/nodejs/Structures/embeds.md
similarity index 100%
rename from site/docs/nodejs/Structures/embeds.md
rename to site/tutorial/nodejs/Structures/embeds.md
diff --git a/site/docs/nodejs/Structures/getting-started.md b/site/tutorial/nodejs/Structures/getting-started.md
similarity index 100%
rename from site/docs/nodejs/Structures/getting-started.md
rename to site/tutorial/nodejs/Structures/getting-started.md
diff --git a/site/docs/nodejs/_category_.json b/site/tutorial/nodejs/_category_.json
similarity index 100%
rename from site/docs/nodejs/_category_.json
rename to site/tutorial/nodejs/_category_.json
diff --git a/site/docs/nodejs/create-application.md b/site/tutorial/nodejs/create-application.md
similarity index 100%
rename from site/docs/nodejs/create-application.md
rename to site/tutorial/nodejs/create-application.md
diff --git a/site/docs/nodejs/design.md b/site/tutorial/nodejs/design.md
similarity index 100%
rename from site/docs/nodejs/design.md
rename to site/tutorial/nodejs/design.md
diff --git a/site/docs/nodejs/getting-started.md b/site/tutorial/nodejs/getting-started.md
similarity index 100%
rename from site/docs/nodejs/getting-started.md
rename to site/tutorial/nodejs/getting-started.md
diff --git a/site/docs/nodejs/initial-setup.md b/site/tutorial/nodejs/initial-setup.md
similarity index 100%
rename from site/docs/nodejs/initial-setup.md
rename to site/tutorial/nodejs/initial-setup.md
diff --git a/site/docs/nodejs/installion.md b/site/tutorial/nodejs/installion.md
similarity index 100%
rename from site/docs/nodejs/installion.md
rename to site/tutorial/nodejs/installion.md
diff --git a/site/docs/nodejs/slash-command.md b/site/tutorial/nodejs/slash-command.md
similarity index 100%
rename from site/docs/nodejs/slash-command.md
rename to site/tutorial/nodejs/slash-command.md
diff --git a/site/tutorialSidebars.js b/site/tutorialSidebars.js
new file mode 100644
index 000000000..3fa56fd10
--- /dev/null
+++ b/site/tutorialSidebars.js
@@ -0,0 +1,30 @@
+/**
+ * Creating a sidebar enables you to:
+ - create an ordered group of docs
+ - render a sidebar for each doc of that group
+ - provide next/previous navigation
+
+ The sidebars can be generated from the filesystem, or explicitly defined here.
+
+ Create as many sidebars as you want.
+ */
+
+// @ts-check
+
+/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
+const sidebars = {
+ // By default, Docusaurus generates a sidebar from the docs folder structure
+ tutorial: [{ type: "autogenerated", dirName: "." }],
+ // But you can create a sidebar manually
+ /*
+ tutorialSidebar: [
+ {
+ type: 'category',
+ label: 'Tutorial',
+ items: ['hello'],
+ },
+ ],
+ */
+};
+
+module.exports = sidebars;
From 6b66b155dd740ef44267428e9180d8263e60606a Mon Sep 17 00:00:00 2001
From: deepsarda <92147339+deepsarda@users.noreply.github.com>
Date: Sun, 4 Dec 2022 22:16:52 +0530
Subject: [PATCH 07/16] Improve grammar and clarity on the site (#2676)
---
site/docs/architecture.mdx | 10 ++++-----
site/docs/frequently-asked-questions.md | 27 +++++++------------------
2 files changed, 12 insertions(+), 25 deletions(-)
diff --git a/site/docs/architecture.mdx b/site/docs/architecture.mdx
index d3306f149..e3745e4c9 100644
--- a/site/docs/architecture.mdx
+++ b/site/docs/architecture.mdx
@@ -12,7 +12,7 @@ import FlowChart from '@site/src/components/architecture/FlowChart'
{() => }
-Discordeno have three main components/process, gateway, bot and rest. The Gateway process is responsible for handling and maintaining the websocket with discord, the websocket events from discord, such as connection, resuming, heartbeating and sending websocket message to discord. The Bot process is responsible for handling and converting all events from discord and trigger your code, like run function on message create. The Rest process is responsible for handling/fetching all http requests to discord, such as ratelimiting and proxying.
+Discordeno have three main components/process, gateway, bot and rest. Websocket events from Discord, such as connecting, restarting, heartbeating, and transmitting websocket messages to Discord, are handled and maintained by the Gateway process. All Discord events are handled and converted by the Bot process, which also activates your code, such as the execute function upon message creation. All http requests to Discord, including proxying and ratelimiting, are handled by the Rest process.
## Gateway Process
import FlowChart2 from '@site/src/components/architecture/FlowChart2'
@@ -21,15 +21,15 @@ import FlowChart2 from '@site/src/components/architecture/FlowChart2'
{() => }
-The Gateway process have two part the gateway manager and the gateway [shard](https://discord.com/developers/docs/topics/gateway#sharding), the gateway manager oversee the gateway shard.
+The Gateway process have two part the gateway manager and the gateway [shard](https://discord.com/developers/docs/topics/gateway#sharding), the gateway manager oversees the gateway shard.
### Gateway Manager
-The gateway manager spawn the right amount of shard acording to data from discord's [getGatewayBot](https://discord.com/developers/docs/topics/gateway#get-gateway-bot) endpoint, user can override the value of gatewayBot by directly passing the value. The manager control the order or sequence of shard identifying base on the session start limit listed in the getGatewayBot to prevent hitting the ratelimiting. By default the manager will check the getGatewayBot endpoint every 8 hours and reshard if the number of shard changed shard. Check [here](/tutorial/big-bot-guide/gateway#understanding-gateway-manager) for more information about the gateway manager.
+The gateway manager spawns the right amount of shard acording to data from discord's [getGatewayBot](https://discord.com/developers/docs/topics/gateway#get-gateway-bot) endpoint, user can override the value of gatewayBot by directly passing the value. The manager control the order or sequence of shard identifying base on the session start limit listed in the getGatewayBot to prevent hitting the ratelimiting. By default the manager will check the getGatewayBot endpoint every 8 hours and reshard if the number of shard changed shard. Check [here](/tutorial/big-bot-guide/gateway#understanding-gateway-manager) for more information about the gateway manager.
### Gateway Shard
-The gateway shard create a websocket connect to discord, and pass any event to the handleMessage function. The handleMessage function will check the event and intercept/process websocket related event like hello, resume, heartbeat, ready, only pass real event to the bot. You may customize the handleMessage to you own case, but it is not recommand unless you know what youd doing, as it is vital for the connection. After the function processed the event, the function will pass the event to the Bot proceess either directly (in same process), with rest api, with message queue, or with other method depend on the user customiztion.
+Any event is passed to the handleMessage method by the gateway shard, which also establishes a websocket connection to Discord. The handleMessage method will examine the event and only deliver genuine events to the bot by intercepting and processing websocket-related events like hello, resume, heartbeat, and ready. You can modify the handleMessage to suit your needs, but it is not advised unless you are certain of your actions because the connection depends on it. After the function has finished processing the event, it will either pass the event directly (in the same process), via the rest api, a message queue, or another mechanism depending on the user's customization.
## Bot Process
import FlowChart3 from '@site/src/components/architecture/FlowChart3'
@@ -42,7 +42,7 @@ A simplified version of function used inside of the bot process, showing only th
### Bot
-The Bot process receive event from gateway and pass all the event to the handleDiscordPayload function. The handleDiscordPayload function will call raw event for all event, and route to three layer for process the event, the handler, transformers and event. The handler will transformer the data of event with transformers and call the event with the transformed data. The transformer will remove useless property, change the name, abstractify bitwise permission flags change transform the data to a javascript.
+When an event arrives from the gateway, the bot process receives it and passes it all to the handleDiscordPayload method. The handleDiscordPayload method will invoke raw events for each event and route calls to handlers, transformers, and events at three different layers for processing. The handler will use transformers to alter the event's contents before calling the event. The data will be transformed into typescript after being stripped of pointless properties, given a new name, and having bitwise permission flags abstracted.
## Rest Process
diff --git a/site/docs/frequently-asked-questions.md b/site/docs/frequently-asked-questions.md
index f32a4d688..b1956207b 100644
--- a/site/docs/frequently-asked-questions.md
+++ b/site/docs/frequently-asked-questions.md
@@ -6,31 +6,18 @@ sidebar_position: 5
## Does Discordeno Support TypeScript?
-Discordeno provides first class support for TypeScript! Since Deno provides support for TypeScript, that also comes into
-Discordeno. This means you don't need to compile TypeScript before you use it. However, this isn't really why Discordeno
-is the best library for TypeScript developers. When I developed this library, I was experimenting with a lot of
-different things and one of them was automated typings.
+TypeScript is supported to the highest standard by Discordeno. TypeScript is included in Discordeno since Deno supports it. This implies that before using TypeScript, you do not need to compile it. But this isn't the main reason Discordeno is the ideal library for TypeScript programmers. I was experimenting with a lot of various things when I created this library, and automatic typings was one of them.
-Whenever I used other libraries, I was always seeing typings being inaccurate or problematic. This is because in any
-Discord API library, the majority is not used by the library itself so TypeScript doesn't warn the library developers.
-This makes it extremely likely that those typings become inaccurate or out of date because of simple mistakes like
-forgetting to update typings. Sometimes libraries will add a property and forget to add that on their typings. This
-makes it usable for JavaScript developers but not for TypeScript devs. For TypeScript developers, typings are
-everything! Discordeno treats typings as part of it's code! A breaking change in typings is a breaking change for the
-library!
+When I utilised other libraries, I frequently observed incorrect or troublesome typings. This is so that TypeScript won't alert the library developers because most of the Discord API typings aren't utilised by the libraries themselves.
+
+It is quite unlikely that these typings would become wrong or outdated as a result of minor errors like forgetting to update typings because Discordeno utilises them as part of the rest process. Libraries occasionally add a property without also adding it to their typings. Because of this, TypeScript developers cannot use it, only JavaScript developers can. Typings are crucial for TypeScript developers. Typings are treated as a component of the code by Discordeno! A breaking change in typings is a breaking change for the library!
## How Stable Is Discordeno?
-One of the biggest issues with almost every library (that I have used) is stability. None of the libraries gave much
-love and attention to TypeScript developers the way it deserves. Sometimes TypeScript projects would break because
-breaking changes to typings did not make a MAJOR bump so TypeScript bots in production would break. Sometimes I was
-personally maintaining the typings because no one else was for that lib. Some libs were pre 1.0 and didn't even have a
-stable branch/version where I would not have to worry about breaking changes.
+Stability is one of the main problems with practically every library (I have used). None of the libraries showed TypeScript developers the love and care that they deserve. Because breaking changes to typings occasionally occurred without producing a MAJOR bump, TypeScript projects would occasionally fail. As a result, production TypeScript bots would fail. At times, I was the only one keeping the typings up to date for that library. Some libraries that were older than 1.0 didn't even have a stable branch or version, so I didn't have to worry about them undergoing breaking changes.
-This is why I made it one of my foundational goals of this library to have the best stability for TypeScript developers.
-No matter how small, a breaking change is a breaking change when it affects the public API. I could care less if we end
-up at version 500. Being afraid to bump a MAJOR because it's a small change or a typing change is a terrible decision as
-a library maintainer and destroys the experience for end users.
+The finest stability for TypeScript developers is one of my basic goals for this library.
+No matter how little, a change that impacts the public API qualifies as a breaking change. I don't care whether we reach version 500. As a library maintainer, you should never be scared to bump a MAJOR because it just involves a tiny modification or a type change because doing so will ruin the end user's experience.
## Why Doesn't Discordeno Use Classes or EventEmitter?
From df5910612147aa96c20aa028c8914c264df93538 Mon Sep 17 00:00:00 2001
From: Lars_und_so <46791248+Larsundso@users.noreply.github.com>
Date: Thu, 8 Dec 2022 03:09:06 +0100
Subject: [PATCH 08/16] fix for #2678 exporting autoModerationRule (#2679)
---
transformers/mod.ts | 1 +
1 file changed, 1 insertion(+)
diff --git a/transformers/mod.ts b/transformers/mod.ts
index 584df93ec..469909447 100644
--- a/transformers/mod.ts
+++ b/transformers/mod.ts
@@ -9,6 +9,7 @@ export * from "./applicationCommandOptionChoice.ts";
export * from "./applicationCommandPermission.ts";
export * from "./attachment.ts";
export * from "./auditLogEntry.ts";
+export * from "./automodRule.ts";
export * from "./channel.ts";
export * from "./component.ts";
export * from "./embed.ts";
From c888bb9cf10a3e2e236a7dad7ebae9bf7bd5e10e Mon Sep 17 00:00:00 2001
From: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
Date: Thu, 12 Jan 2023 17:40:54 -0600
Subject: [PATCH 09/16] Update shared.ts
---
types/shared.ts | 2 ++
1 file changed, 2 insertions(+)
diff --git a/types/shared.ts b/types/shared.ts
index e1320c06e..82602960a 100644
--- a/types/shared.ts
+++ b/types/shared.ts
@@ -1048,6 +1048,7 @@ export type GatewayDispatchEventNames =
| "CHANNEL_DELETE"
| "CHANNEL_PINS_UPDATE"
| "CHANNEL_UPDATE"
+ | "GUILD_AUDIT_LOG_ENTRY_CREATE"
| "GUILD_BAN_ADD"
| "GUILD_BAN_REMOVE"
| "GUILD_CREATE"
@@ -1131,6 +1132,7 @@ export enum GatewayIntents {
*/
GuildMembers = 1 << 1,
/**
+ * - GUILD_AUDIT_LOG_ENTRY_CREATE
* - GUILD_BAN_ADD
* - GUILD_BAN_REMOVE
*/
From 945b1f2007dc7a321ab025e92d542f2d352ca28c Mon Sep 17 00:00:00 2001
From: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
Date: Thu, 12 Jan 2023 17:46:05 -0600
Subject: [PATCH 10/16] Audit Log Entry Event (#2719)
* Create GUILD_AUDIT_LOG_ENTRY_CREATE.ts
* Update mod.ts
* Update bot.ts
* Update GUILD_AUDIT_LOG_ENTRY_CREATE.ts
* Update shared.ts
---
bot.ts | 4 ++++
handlers/guilds/GUILD_AUDIT_LOG_ENTRY_CREATE.ts | 8 ++++++++
handlers/guilds/mod.ts | 1 +
3 files changed, 13 insertions(+)
create mode 100644 handlers/guilds/GUILD_AUDIT_LOG_ENTRY_CREATE.ts
diff --git a/bot.ts b/bot.ts
index b7be6f2f8..a4a884388 100644
--- a/bot.ts
+++ b/bot.ts
@@ -230,6 +230,7 @@ export function createEventHandlers(
return {
debug: events.debug ?? ignore,
+ auditLogEntryCreate: events.auditLogEntryCreate ?? ignore,
automodRuleCreate: events.automodRuleCreate ?? ignore,
automodRuleUpdate: events.automodRuleUpdate ?? ignore,
automodRuleDelete: events.automodRuleDelete ?? ignore,
@@ -550,6 +551,7 @@ export function createTransformers(options: Partial) {
export interface EventHandlers {
debug: (text: string, ...args: any[]) => unknown;
+ auditLogEntryCreate: (bot: Bot, log: AuditLogEntry, guildId: bigint) => unknown;
automodRuleCreate: (bot: Bot, rule: AutoModerationRule) => unknown;
automodRuleUpdate: (bot: Bot, rule: AutoModerationRule) => unknown;
automodRuleDelete: (bot: Bot, rule: AutoModerationRule) => unknown;
@@ -800,6 +802,7 @@ export interface BotGatewayHandlerOptions {
STAGE_INSTANCE_CREATE: typeof handlers.handleStageInstanceCreate;
STAGE_INSTANCE_UPDATE: typeof handlers.handleStageInstanceUpdate;
STAGE_INSTANCE_DELETE: typeof handlers.handleStageInstanceDelete;
+ GUILD_AUDIT_LOG_ENTRY_CREATE: typeof handlers.handleGuildAuditLogEntryCreate;
GUILD_BAN_ADD: typeof handlers.handleGuildBanAdd;
GUILD_BAN_REMOVE: typeof handlers.handleGuildBanRemove;
GUILD_CREATE: typeof handlers.handleGuildCreate;
@@ -869,6 +872,7 @@ export function createBotGatewayHandlers(
handlers.handleStageInstanceDelete,
// guilds
+ GUILD_AUDIT_LOG_ENTRY_CREATE: options.GUILD_AUDIT_LOG_ENTRY_CREATE ?? handlers.handleGuildAuditLogEntryCreate,
GUILD_BAN_ADD: options.GUILD_BAN_ADD ?? handlers.handleGuildBanAdd,
GUILD_BAN_REMOVE: options.GUILD_BAN_REMOVE ?? handlers.handleGuildBanRemove,
GUILD_CREATE: options.GUILD_CREATE ?? handlers.handleGuildCreate,
diff --git a/handlers/guilds/GUILD_AUDIT_LOG_ENTRY_CREATE.ts b/handlers/guilds/GUILD_AUDIT_LOG_ENTRY_CREATE.ts
new file mode 100644
index 000000000..685def91d
--- /dev/null
+++ b/handlers/guilds/GUILD_AUDIT_LOG_ENTRY_CREATE.ts
@@ -0,0 +1,8 @@
+import type { Bot } from "../../bot.ts";
+import { DiscordGatewayPayload, DiscordAuditLogEntry } from "../../types/discord.ts";
+
+export async function handleGuildAuditLogEntryCreate(bot: Bot, data: DiscordGatewayPayload) {
+ // TODO: better type here
+ const payload = data.d as DiscordAuditLogEntry & { guild_id: string };
+ bot.events.auditLogEntryCreate(bot, bot.transformers.auditLogEntry(bot, payload), bot.transformers.snowflake(payload.guild_id));
+}
diff --git a/handlers/guilds/mod.ts b/handlers/guilds/mod.ts
index 354f21794..a96a507a6 100644
--- a/handlers/guilds/mod.ts
+++ b/handlers/guilds/mod.ts
@@ -1,5 +1,6 @@
export * from "./scheduledEvents/mod.ts";
+export * from "./GUILD_AUDIT_LOG_ENTRY_CREATE.ts";
export * from "./GUILD_BAN_ADD.ts";
export * from "./GUILD_BAN_REMOVE.ts";
export * from "./GUILD_CREATE.ts";
From a48f72b1fa62c240a8202e210e099fa312498c0d Mon Sep 17 00:00:00 2001
From: deepsarda <92147339+deepsarda@users.noreply.github.com>
Date: Fri, 13 Jan 2023 22:19:12 +0530
Subject: [PATCH 11/16] Update Discordeno version (#2721)
---
util/constants.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/constants.ts b/util/constants.ts
index b03ee5db9..d19a8d76c 100644
--- a/util/constants.ts
+++ b/util/constants.ts
@@ -6,7 +6,7 @@ export const API_VERSION = 10;
// TODO: update this version
/** https://github.com/discordeno/discordeno/releases */
-export const DISCORDENO_VERSION = "17.1.0";
+export const DISCORDENO_VERSION = "18.0.1";
/** https://discord.com/developers/docs/reference#user-agent */
export const USER_AGENT = `DiscordBot (https://github.com/discordeno/discordeno, v${DISCORDENO_VERSION})`;
From c522cd9a0ee973d3862021bd80e26e2f62a6d983 Mon Sep 17 00:00:00 2001
From: Jonathan Ho
Date: Fri, 13 Jan 2023 09:00:46 -0800
Subject: [PATCH 12/16] Update release.yml (#2722)
---
.github/workflows/release.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index ba63856b0..dc04e37f2 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -4,6 +4,7 @@ on:
push:
branches:
- main
+ workflow_dispatch:
jobs:
publish:
From 35f98ccd5842830b3740d4f77d0290211c438f12 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Sat, 14 Jan 2023 19:41:01 -0600
Subject: [PATCH 13/16] chore(deps): bump json5 from 2.2.1 to 2.2.3 in /site
(#2715)
Bumps [json5](https://github.com/json5/json5) from 2.2.1 to 2.2.3.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v2.2.1...v2.2.3)
---
updated-dependencies:
- dependency-name: json5
dependency-type: indirect
...
Signed-off-by: dependabot[bot]
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
site/package-lock.json | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/site/package-lock.json b/site/package-lock.json
index d12d8f556..22745360b 100644
--- a/site/package-lock.json
+++ b/site/package-lock.json
@@ -8593,9 +8593,9 @@
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
},
"node_modules/json5": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
- "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",
+ "version": "2.2.3",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
+ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
"bin": {
"json5": "lib/cli.js"
},
@@ -19898,9 +19898,9 @@
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
},
"json5": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
- "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA=="
+ "version": "2.2.3",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
+ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="
},
"jsonfile": {
"version": "6.1.0",
From 3579e9ee7ec6922c62f17aac39e0b37497875ce1 Mon Sep 17 00:00:00 2001
From: Lars_und_so <46791248+Larsundso@users.noreply.github.com>
Date: Thu, 26 Jan 2023 16:36:59 +0100
Subject: [PATCH 14/16] wrong note (#2707)
* missing export
* added ActiveDeveloper Flag
* wrong bit
* wrong note
---
transformers/mod.ts | 1 +
transformers/toggles/member.ts | 2 +-
types/shared.ts | 21 +++++++++++----------
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/transformers/mod.ts b/transformers/mod.ts
index 469909447..fd2a24867 100644
--- a/transformers/mod.ts
+++ b/transformers/mod.ts
@@ -10,6 +10,7 @@ export * from "./applicationCommandPermission.ts";
export * from "./attachment.ts";
export * from "./auditLogEntry.ts";
export * from "./automodRule.ts";
+export * from "./automodActionExecution.ts";
export * from "./channel.ts";
export * from "./component.ts";
export * from "./embed.ts";
diff --git a/transformers/toggles/member.ts b/transformers/toggles/member.ts
index 77a0a7aa2..be90ad87c 100644
--- a/transformers/toggles/member.ts
+++ b/transformers/toggles/member.ts
@@ -24,7 +24,7 @@ export class MemberToggles extends ToggleBitfield {
}
}
- /** Whether the user belongs to an OAuth2 application */
+ /** Whether the user is deafened in voice channels */
get deaf() {
return this.has("deaf");
}
diff --git a/types/shared.ts b/types/shared.ts
index 82602960a..bd7759e88 100644
--- a/types/shared.ts
+++ b/types/shared.ts
@@ -39,6 +39,7 @@ export enum UserFlags {
EarlyVerifiedBotDeveloper = 1 << 17,
DiscordCertifiedModerator = 1 << 18,
BotHttpInteractions = 1 << 19,
+ ActiveDeveloper = 1 << 22,
}
/** https://discord.com/developers/docs/resources/channel#channels-resource */
@@ -1287,7 +1288,7 @@ export enum Errors {
MISSING_MANAGE_THREADS_AND_NOT_MEMBER = "MISSING_MANAGE_THREADS_AND_NOT_MEMBER",
CANNOT_GET_MEMBERS_OF_AN_UNJOINED_PRIVATE_THREAD = "CANNOT_GET_MEMBERS_OF_AN_UNJOINED_PRIVATE_THREAD",
HAVE_TO_BE_THE_CREATOR_OF_THE_THREAD_OR_HAVE_MANAGE_THREADS_TO_REMOVE_MEMBERS =
- "HAVE_TO_BE_THE_CREATOR_OF_THE_THREAD_OR_HAVE_MANAGE_THREADS_TO_REMOVE_MEMBERS",
+ "HAVE_TO_BE_THE_CREATOR_OF_THE_THREAD_OR_HAVE_MANAGE_THREADS_TO_REMOVE_MEMBERS",
// Message Get Errors
INVALID_GET_MESSAGES_LIMIT = "INVALID_GET_MESSAGES_LIMIT",
// Message Delete Errors
@@ -1429,9 +1430,9 @@ export type CamelCase = S extends `${infer P1}_${infer P2}${in
: Lowercase;
export type Camelize = {
[K in keyof T as CamelCase]: T[K] extends Array ? U extends {} ? Array>
- : T[K]
- : T[K] extends {} ? Camelize
- : never;
+ : T[K]
+ : T[K] extends {} ? Camelize
+ : never;
};
/** Non object primitives */
@@ -1484,14 +1485,14 @@ export type AnythingBut = Exclude<
* object identity type
*/
export type Id = T extends infer U ? {
- [K in keyof U]: U[K];
- }
+ [K in keyof U]: U[K];
+}
: never;
export type KeysWithUndefined = {
[K in keyof T]-?: undefined extends T[K] ? K
- : null extends T[K] ? K
- : never;
+ : null extends T[K] ? K
+ : never;
}[keyof T];
type OptionalizeAux = Id<
@@ -1509,8 +1510,8 @@ type OptionalizeAux = Id<
*/
export type Optionalize = T extends object
? T extends Array ? number extends T["length"] ? T[number] extends object ? Array>
- : T
- : Partial
+ : T
+ : Partial
: OptionalizeAux
: T;
From 39939d472d0d250a148066066277976e496d087a Mon Sep 17 00:00:00 2001
From: Matthew Hatcher <3768988+MatthewSH@users.noreply.github.com>
Date: Mon, 6 Feb 2023 13:28:21 -0600
Subject: [PATCH 15/16] fix: await importDirectory call (#2770)
await importDirectory to ensure all recursive calls inside the function are completed before calling fileLoader
---
plugins/fileloader/mod.ts | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/plugins/fileloader/mod.ts b/plugins/fileloader/mod.ts
index eef8ad476..8602b878f 100644
--- a/plugins/fileloader/mod.ts
+++ b/plugins/fileloader/mod.ts
@@ -55,12 +55,11 @@ export async function fastFileLoader(
before?: (uniqueFilePathCounter: number, paths: string[]) => void,
) {
await Promise.all(
- [...paths].map((path) => {
+ [...paths].map(async (path) => {
if (between) between(path, uniqueFilePathCounter, paths);
- importDirectory(path);
+ await importDirectory(path);
}),
);
-
if (before) before(uniqueFilePathCounter, paths);
await fileLoader();
From 1a717ddc7d97e31d3775747df9df153729d2925d Mon Sep 17 00:00:00 2001
From: Mohammed Taha <62352949+6km@users.noreply.github.com>
Date: Mon, 13 Feb 2023 20:22:05 +0200
Subject: [PATCH 16/16] =?UTF-8?q?[=F0=9F=93=9C=20Docs]=20Fix=20grammar=20i?=
=?UTF-8?q?ssues=20(#2779)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Update getting-started.md
* Update frequently-asked-questions.md
* Update getting-started.md
---
site/docs/frequently-asked-questions.md | 12 +++++-------
site/tutorial/nodejs/getting-started.md | 9 +++------
2 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/site/docs/frequently-asked-questions.md b/site/docs/frequently-asked-questions.md
index b1956207b..2efadcba2 100644
--- a/site/docs/frequently-asked-questions.md
+++ b/site/docs/frequently-asked-questions.md
@@ -21,17 +21,15 @@ No matter how little, a change that impacts the public API qualifies as a breaki
## Why Doesn't Discordeno Use Classes or EventEmitter?
-This is a design decision for the lib itself. You can still use class if you want on your bot. In fact, I hope someone
+This is a design decision for the library itself. You can still use class on your bot if you want. In fact, I hope someone
makes a framework/templates for this lib one day using classes so that devs have a choice on which style they prefer.
-Without trying to write an entire thesis statement on the reasons why I avoided Classes in this lib, I will just link to
-the best resources I believe help explain it.
+Without trying to write an entire thesis statement on the reasons why I avoided Classes in this library, I will just link to
+the best resources that I believe help explain it.
- [Really good article](https://dannyfritz.wordpress.com/2014/10/11/class-free-object-oriented-programming/)
- [Lecture by one of the developers who makes JavaScript](https://www.youtube.com/watch?v=PSGEjv3Tqo0)
-In regards to EventEmitter, I believe a functional event API was a much better choice. EventEmitter at it's core is
-simply just functions that run when a certain event is emitted. In Discordeno, that function is executed instead of
-emitting some event to trigger that function.
+In regards to EventEmitter, I believe a functional event API was a much better choice. EventEmitter at its core, is simply a set of functions that run when a certain event is emitted. In Discordeno, that function is executed instead of emitting some event to trigger it.
```typescript
// EventEmitter Example
@@ -47,7 +45,7 @@ issues I had. It prevents anyone from having this as a potential issue. Another
update the code in those functions without having to deal with headaches left and right of removing and adding
listeners. You don't need to worry about binding or not binding events. They are just pure functions
-In Discordeno, this is extremely simple, you just simply give it the new event handlers. For example:
+In Discordeno, this is extremely simple; you just simply give it the new event handlers. For example:
```typescript
bot.events.guildCreate = newGuildCreateEventHandler;
diff --git a/site/tutorial/nodejs/getting-started.md b/site/tutorial/nodejs/getting-started.md
index 7ec1a58fb..04a65d5d3 100644
--- a/site/tutorial/nodejs/getting-started.md
+++ b/site/tutorial/nodejs/getting-started.md
@@ -4,14 +4,11 @@ sidebar_position: 1
# Getting Started
-If you are reading this, you probably want to create a Discord bot with Discordeno or migrate from popular libraries
-like Discord.js.
+If you are reading this, you probably want to create a Discord bot with Discordeno or migrate from popular libraries like Discord.js.
-If this is going to be your first time making a bot, you should use Deno instead of Node.js. Although in some cases Deno
-might not be suitable for you, because of missing packages or a code base which too large to migrate to a slightly
-different language.
+If this is going to be your first time making a bot, you should use Deno instead of Node.js. Although in some cases, Deno might not be suitable for you because of missing packages or a code base that is too large to migrate to a slightly different language.
-This guide will help you making your first Discord Bot using Node.js or even migrating your Bot from a other Library.
+This guide will help you make your first Discord bot using Node.js or even migrate your bot from another library.
Moreover this guide will utilize two different options. One option to use the Discordeno package without any frameworks
and one, which uses the wrapper called `Discordeno.js`, which aims to achieve a djs-like interface.