11});
12
13async function setupDiscordSdk() {
14 await discordSdk.ready();
15
73
74/**
75 * This function fetches the current voice channel over RPC. It then creates a
76 * text element that displays the voice channel's name
77 */
78async function appendVoiceChannelName() {
79 const app = document.querySelector("#app");
80 if (!app) {
104
105/**
106 * This function utilizes RPC and HTTP apis, in order show the current guild's avatar
107 * Here are the steps:
108 * 1. From RPC fetch the currently selected voice channel, which contains the voice channel's guild id
111 * 4. Append to the UI an img tag with the related information
112 */
113async function appendGuildAvatar() {
114 const app = document.querySelector("#app");
115 if (!app) {
26
27
28async function streamToBuffer(stream) {
29 const chunks = [];
30 const reader = stream.getReader();
41}
42
43async function detectFileType(buffer) {
44 const type = await fileTypeFromBuffer(buffer);
45 // return type ? type.mime : 'unknown';
51
52
53export async function get(key, c) {
54 let result = await blobby.get(key);
55 // console.log('raw result for key:', result, typeof result);
211 newKeyName: '',
212
213 init: async function() {
214 console.log('blobby:', this.blobby);
215 },
6 * for use with Hono instead of Express
7 */
8export function authorize(
9 options: IOAuth2Options,
10 c: Context,
41 * @returns Query string with key and value pairs separated by "&"
42 */
43export function encodeParam(key: string, value: any): string {
44 // For array of arrays, repeat key=value for each element of containing array
45 if (Array.isArray(value) && value[0] && Array.isArray(value[0])) {
58 * @returns An encoded query string.
59 */
60export function encodeQueryString(params: any): string {
61 const newParams = processParams(params);
62 return Object.keys(newParams)
72 * @return A boolean indicating if FormData will be required.
73 */
74export function requiresFormData(params: any) {
75 return Object.keys(params).some((key) => {
76 let value = params[key];
93 case "Date":
94 return false;
95 case "Function":
96 return false;
97 case "Boolean":
112 * @return A new object with properly encoded values.
113 */
114export function processParams(params: any): any {
115 const newParams: any = {};
116
138 // ported from https://github.com/Esri/esri-leaflet/blob/master/src/Request.js#L22-L30
139 // also see https://github.com/Esri/arcgis-rest-js/issues/18:
140 // null, undefined, function are excluded. If you want to send an empty key you need to send an empty string "".
141 switch (type) {
142 case "Array":
157 value = param.valueOf();
158 break;
159 case "Function":
160 value = null;
161 break;
5import safeJsonValue from "npm:safe-json-value";
6
7export default async function(req: Request): Promise<Response> {
8 if (req.method === "GET") {
9 return new Response(indexHTML, {
1import safeJsonValue from "npm:safe-json-value";
2
3export async function evalCode(
4 code: string,
5): Promise<{ error: { message: string; name: string; stack: string } } | any> {
43}
44
45function getMainExport(
46 mod: any,
47): { ok: true; value: any } | { ok: false; error: Error } {
5import confetti from "https://esm.sh/canvas-confetti";
6
7function Instructions() {
8 return (
9 <div className="bg-gray-100 p-4 rounded-xl mb-6">
31}
32
33function TippingForm({ onPaymentSuccess }) {
34 const [amount, setAmount] = useState(20);
35 const [name, setName] = useState("");
148}
149
150function Leaderboard({ payments }) {
151 return (
152 <div className="bg-white p-8 rounded-3xl shadow-md w-full">
165}
166
167function Confetti() {
168 useEffect(() => {
169 const duration = 15 * 1000;
171 const defaults = { startVelocity: 30, spread: 360, ticks: 60, zIndex: 0 };
172
173 function randomInRange(min, max) {
174 return Math.random() * (max - min) + min;
175 }
176
177 const interval = setInterval(function() {
178 const timeLeft = animationEnd - Date.now();
179
200}
201
202function App() {
203 const [payments, setPayments] = useState([]);
204 const [showConfetti, setShowConfetti] = useState(false);
233}
234
235function client() {
236 createRoot(document.getElementById("root")).render(<App />);
237}
241}
242
243export default async function server(req: Request): Promise<Response> {
244 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
245 const SCHEMA_VERSION = 1;
1export async function capturePostHogEvent(
2 key: string,
3 distinct_id: string,
1import { email } from "https://esm.town/v/std/email";
2export default async function(interval: Interval) {
3 await email({ subject: "Daily Motivation", text: "You can do it!" });
4}
5import { falProxyRequest } from "https://esm.town/v/stevekrouse/falProxyRequest";
6
7function App() {
8 const [prompt, setPrompt] = useState("");
9 const [imageUrl, setImageUrl] = useState("");
103}
104
105function client() {
106 createRoot(document.getElementById("root")).render(<App />);
107}
108if (typeof document !== "undefined") { client(); }
109
110export default async function server(req: Request): Promise<Response> {
111 const url = new URL(req.url);
112 if (url.pathname === "/") {
5import { falProxyRequest } from "https://esm.town/v/stevekrouse/falProxyRequest";
6
7function App() {
8 const [prompt, setPrompt] = useState("");
9 const [imageUrl, setImageUrl] = useState("");
103}
104
105function client() {
106 createRoot(document.getElementById("root")).render(<App />);
107}
108if (typeof document !== "undefined") { client(); }
109
110export default async function server(req: Request): Promise<Response> {
111 const url = new URL(req.url);
112 if (url.pathname === "/") {