2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=5";
3
4export async function aqi(interval: Interval) {
5 const location = "seattle, wa"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });
6import cheerio from "https://esm.sh/cheerio@1.0.0-rc.12";
7
8export default async function server(request: Request): Promise<Response> {
9 const url = new URL(request.url);
10 const zillowUrl = url.searchParams.get("url");
7import { createRoot } from "https://esm.sh/react-dom/client";
8
9function App() {
10 const [url, setUrl] = useState('');
11 const [listing, setListing] = useState(null);
59}
60
61function client() {
62 createRoot(document.getElementById("root")).render(<App />);
63}
65if (typeof document !== "undefined") { client(); }
66
67async function server(request: Request): Promise<Response> {
68 const url = new URL(request.url);
69 const cheerio = await import("https://esm.sh/cheerio@1.0.0-rc.12");
1Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality
12 * The email address(es) to send the email to. Only available to Val Town Pro subscribers.
13 * Can be a single string, IAddress object, or an array of strings/IAddress objects.
14 * @default the email of the logged user calling this function.
15 */
16 to?: (IAddress | string)[] | IAddress | string;
22const rest = new REST({ version: "9" }).setToken(process.env.DISCORD_BOT_TOKEN);
23
24async function findUserVoiceChannel(guildId, userId) {
25 try {
26 const channels = await rest.get(Routes.guildChannels(guildId));
39}
40
41async function sayMessage(guildId, channelId, message) {
42 const url = googleTTS.getAudioUrl(message, {
43 lang: "en",
68}
69
70function createDiscordJSAdapter(channelId, guildId) {
71 return {
72 sendPayload: (payload) => {
1Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality
89];
90
91async function getCurrentTopic() {
92 const storedTopic = await blob.getJSON("currentTopic");
93 if (storedTopic && new Date(storedTopic.expiresAt) > new Date()) {
105}
106
107function TopicDisplay({ topic, expiresAt }) {
108 const expirationDate = new Date(expiresAt);
109 const timeRemaining = expirationDate - new Date();
130}
131
132export default async function server(req: Request): Promise<Response> {
133 const currentTopic = await getCurrentTopic();
134 const { renderToString } = await import("https://esm.sh/react-dom/server");
236}
237
238function transformIntoDatabaseSession(raw: SessionSchema): DatabaseSession {
239 const { id, user_id: userId, expires_at: expiresAtUnix, ...attributes } = raw;
240 return {
246}
247
248function transformIntoDatabaseUser(raw: UserSchema): DatabaseUser {
249 const { id, ...attributes } = raw;
250 return {
254}
255
256function escapeName(val: string): string {
257 return "`" + val + "`";
258}
259
260// Helper functions
261export async function createTables(userTable: string, sessionTable: string) {
262 return sqlite.batch([
263 `CREATE TABLE IF NOT EXISTS ${userTable} (
277}
278
279export async function createUser({ userTable, sessionTable, username, password, github_id, google_id }: {
280 userTable: string;
281 sessionTable: string;
299}
300
301export async function getUser(
302 { userTable, username, github_id, google_id }: {
303 userTable: string;
330}
331
332export async function verifyPassword(hashed_password: string, password: string): Promise<boolean> {
333 return new Scrypt().verify(hashed_password, password);
334}
6 webhook_url: string = process.env.discord_webhook,
7) => {
8 function chunkString(str) {
9 const chunks = [];
10 let startIndex = 0;