From 19e99d3751aafda0c9a356e593e5e14ec8ed652a Mon Sep 17 00:00:00 2001
From: David M <62346025+aboutdavid@users.noreply.github.com>
Date: Sun, 1 Sep 2024 14:12:16 -0400
Subject: [PATCH 1/4] dropin fix for loss of admin (cross fingers)

---
 interactions/message.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/interactions/message.js b/interactions/message.js
index 227ff49..3e5f53f 100644
--- a/interactions/message.js
+++ b/interactions/message.js
@@ -12,7 +12,7 @@ module.exports = ({ app, client }) => {
       await app.client.chat.delete({
         channel: message.channel,
         ts: message.ts,
-        token: process.env.SLACK_USER_TOKEN,
+        token: process.env.SLACK_BOT_TOKEN,
       });
     if (utils.blockedChannels.includes(message.channel)) return;
 

From 9f176053c17a2543dc51bbe2fa54f13d6ffe342b Mon Sep 17 00:00:00 2001
From: David M <62346025+aboutdavid@users.noreply.github.com>
Date: Sun, 1 Sep 2024 14:13:34 -0400
Subject: [PATCH 2/4] Update redo.js

---
 utils/redo.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils/redo.js b/utils/redo.js
index 89cdb8a..6fa2f2e 100644
--- a/utils/redo.js
+++ b/utils/redo.js
@@ -14,7 +14,7 @@ module.exports = async function ({ app, client }) {
     messages.map((message) =>
       app.client.chat
         .delete({
-          token: process.env.SLACK_USER_TOKEN,
+          token: process.env.SLACK_BOT_TOKEN,
           channel: process.env.SLACK_CHANNEL,
           ts: message?.ts,
           thread_ts: message?.thread_ts,

From 31bf73b83663a2928e19df5ca4902d037e2808d6 Mon Sep 17 00:00:00 2001
From: David M <62346025+aboutdavid@users.noreply.github.com>
Date: Mon, 2 Sep 2024 00:42:19 -0400
Subject: [PATCH 3/4] fire department keeps breaking stuff

---
 buttons/local.js.disabled | 119 --------------------------------------
 1 file changed, 119 deletions(-)
 delete mode 100644 buttons/local.js.disabled

diff --git a/buttons/local.js.disabled b/buttons/local.js.disabled
deleted file mode 100644
index 2a01408..0000000
--- a/buttons/local.js.disabled
+++ /dev/null
@@ -1,119 +0,0 @@
-const Airtable = require("airtable");
-const base = new Airtable({ apiKey: process.env.AIRTABLE_TOKEN }).base(
-  process.env.AIRTABLE_BASE,
-);
-const geolib = require("geolib");
-const { PrismaClient } = require("@prisma/client");
-const prisma = new PrismaClient();
-const geoIp2 = require("geoip-lite2");
-
-async function lookupCity(lat, lon) {
-  const response = await (
-    await fetch(
-      "https://nominatim.openstreetmap.org/reverse?" +
-        new URLSearchParams({
-          lat,
-          lon,
-          format: "jsonv2",
-        }),
-    )
-  ).json();
-  if (response.error) return "Unknown city";
-  else return response.display_name;
-}
-
-module.exports = {
-  title: "Find Local Hack Clubbers",
-  /**
-   * @param {{app: import('@slack/bolt').App}} param1
-   */
-  render: async function ({ app, body }) {
-    if (!body?.user?.id) return `this isn't good at all :(`;
-
-    const user = await app.client.users.info({
-      user: body?.user?.id,
-    });
-    if (!user.user.profile.email)
-      return `Sorry, I couldn't lookup your location. This appears to be an issue on our side. Tell an admin that the bot may not have been installed with the \`users:read.email\` scope.`;
-    const tableIds = process.env.AIRTABLE_TABLES.split(",");
-    var u = null;
-
-    for (const tableId of tableIds) {
-      const table = await base(tableId)
-        .select({
-          filterByFormula:
-            tableId == "tblLXcLHjzTy08IeK"
-              ? `fldwcOLKym9dRvKvW = "${user.user.profile.email}"`
-              : `fldFDUVB1h83LchKg = "${user.user.profile.email}"`,
-        })
-        .all();
-
-      u = table.find(
-        (record) =>
-          record.get("Email") == user.user.profile.email ||
-          record.get("Email Address") == user.user.profile.email,
-      );
-      if (u) {
-        break;
-      }
-    }
-
-    if (!u || !u?.get("IP"))
-      return `Sorry, I couldn't lookup your location. This appears to be an issue on our side. Tell an admin that Toriel or Arcadius may have failed to record user information.`;
-
-    var locations = [];
-    const channels = await prisma.channel.findMany({
-      where: {
-        optout: false,
-      },
-    });
-    const userRecord = await prisma.user.findFirst({
-      where: {
-        id: body.user.id,
-      },
-    });
-    var lookup = geoIp2.lookup(u.get("IP"));
-    var location = lookup.ll;
-
-    if (userRecord && userRecord.lat && userRecord.lon)
-      location = [userRecord.lat, userRecord.lon];
-
-    channels.forEach((channel) => {
-      if (!channel.lat || !channel.lon || channel.optout) return;
-      const distance = geolib.getPreciseDistance(
-        {
-          latitude: channel.lat,
-          longitude: channel.lon,
-        },
-        {
-          latitude: location[0],
-          longitude: location[1],
-        },
-      );
-      locations.push({
-        km: geolib.convertDistance(distance, "km"),
-        mi: geolib.convertDistance(distance, "mi"),
-        id: channel.id,
-      });
-    });
-    var filter = locations
-      .sort((a, b) => a.km - b.km)
-      .filter((a) => a.mi <= 350);
-    if (filter.length > 2) locations = filter;
-    else locations = locations.sort((a, b) => a.km - b.km).slice(0, 3);
-
-    var text = !userRecord
-      ? `I assumed you live in ${await lookupCity(location[0], location[1])} based on information based the IP address of when you joined Hack Club. If it's not correct, please set it manually using /setuserlocation [location]. Here are some channels with people near you:\n\n`
-      : `Showing channels near \`${await lookupCity(location[0], location[1])}\`:\n\n`;
-
-    locations.forEach(
-      (loc) =>
-        (text += `- <#${loc.id}> (${loc.mi.toFixed(2)} mi/${loc.km.toFixed(2)} km away)\n`),
-    );
-
-    if (locations.length < 1)
-      text +=
-        "There are no channels for Hack Clubbers near you. Go make one and invite people!";
-    return text;
-  },
-};

From 99a1807a1cdac5d573f9732109487c2361d014f0 Mon Sep 17 00:00:00 2001
From: David M <62346025+aboutdavid@users.noreply.github.com>
Date: Mon, 2 Sep 2024 00:47:43 -0400
Subject: [PATCH 4/4] every hour no power :(

---
 sections/20-featured.js | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sections/20-featured.js b/sections/20-featured.js
index 735a174..33af041 100644
--- a/sections/20-featured.js
+++ b/sections/20-featured.js
@@ -7,7 +7,6 @@ module.exports = {
   render: async function ({ app }) {
     return (text = `<#C75M7C0SY> - Introduce yourself to the community here
 <#C0266FRGV> - Meet new people here
-<#C06SBHMQU8G> - Every hour more power: Get rewarded with cool prizes for working on your own projects
 <#C056WDR3MQR> - Free, powerful, and versatile compute infrastructure for all high school hackers!
 <#C01504DCLVD> - Share awesome updates about your work-in-progess projects`);
   },