// Name: Whatsapp Babe A Late Message// Description: Send your babe a whatsapp templated mesage to let em know you're running late!// Author: Taran "tearing it up" Bains// GitHub: @tearingitup786// Schedule: 0 14 * * *import "@johnlindquist/kit"; // ScriptKit imports// Import Twilio SDKconst twilio = await npm("twilio");const phoneNumbers = await env("TWILIO_PHONE_NUMBERS","comma separated list of numbers: 131-131-1313,787-787-7878",);try {const numbersToText = phoneNumbers.split(",");// Your Twilio Account SIDconst accountSid = await env("TWILIO_ACCOUNT_SID");// Your Twilio Auth Tokenconst authToken = await env("TWILIO_AUTH_TOKEN");// Your Twilio phone number/*** You'll have to set up a whatsapp/facebook business account* Twilio makes it pretty easy to do this so don't fret, it's pretty straightforward.** @docs https://www.twilio.com/docs/whatsapp/getting-started*/const fromNumber = await env("TWILIO_PHONE_NUMBER");/*** We opt for a message template so that the numbers we are messaging* don't need to have this particular number saved as a contact* We're able to start conversations with whatsapp users with message template* doing it via adhoc messaging doesn't really work!* @docs https://www.twilio.com/docs/whatsapp/tutorial/send-whatsapp-notification-messages-templates*/const contentSid = await env("TWILIO_CONTENT_SID");const workingLate = await arg("Are you working late", ["yes", "no"]);if (workingLate === "no") {console.log("Okay, won't text babe!");process.exit();}// Initialize Twilio clientconst client = twilio(accountSid, authToken);// Function to send a messageconst phoneNumber = await arg("Enter the recipient's phone number (e.g., +1234567890):",numbersToText,);const messageBody = await arg("Enter when you'll be free... He'll be free around <your message>",);console.log("Last time given", messageBody);client.messages.create({// body: messageBedy,contentVariables: JSON.stringify({ 1: `${messageBody}` }),from: `whatsapp:${fromNumber}`,contentSid,to: `whatsapp:+1${phoneNumber}`,}).then((message) => {notify(`Message sent to ${phoneNumber}! Message SID: ${message.sid}`);console.log(`Message SID: ${message.sid}`);}).catch((error) => {notify(`Error sending message: ${error.message}`);console.error("Error:", error);});} catch (err) {console.error("There was an error running the twilio script");console.error("Error", err);}
// Name: Chrome bookmarks (with folder support)// Author: Taran "tearing it up" Bains// Description: Navigate your chrome bookmarks (even if they are in folders)!// GitHub: @tearingitup786import "@johnlindquist/kit";// Reading the Chrome bookmarks file from the user's system// Maybe allow for a choice of different browsers?let bookmarks = await readFile(home("Library/Application Support/Google/Chrome/Default/Bookmarks"),);bookmarks = JSON.parse(bookmarks);bookmarks = bookmarks.roots.bookmark_bar.children;// Initializing an array to keep track of the navigation historylet historyStack = [];const CUSTOMSEPARATOR = "-CUSTOMSEPARATOR-";// Loop to handle user interaction and navigation within bookmarkswhile (true) {const getBookmark = ({ name, url, type }) => {if (type === "folder") {return {name: `🗂️ ${name}`,description: "⤵️ Select directory",value: `folder${CUSTOMSEPARATOR}${name}`, // Encoding type and name for folders};}return {name: `⛓️ ${name}`,description: url,type,value: `link${CUSTOMSEPARATOR}${url}`, // Encoding type and URL for links};};// Generating options based on current level of bookmarkslet options = bookmarks.map(getBookmark);// Adding a "go back" option if there is history in the stackif (historyStack.length > 0) {options = [{ name: "..", description: "Go back", value: "go-back" },...options,];}const lastSelection = await arg("Select A Bookmark!", options);if (lastSelection === "go-back") {bookmarks = historyStack.pop();continue;}// Splitting the value to determine the type and actual value (name or URL)const [type, value] = lastSelection.split(CUSTOMSEPARATOR);if (type === "folder") {// push the old bookmarks into the stackhistoryStack.push(bookmarks);bookmarks = bookmarks.find((bookmark) => bookmark.name === value).children;continue;}if (type === "link") {exec(`open "${value}"`);break;}console.log("Unknown type", type);}sh(bookmarks);bookmarks = bookmarks.find((bookmark) => bookmark.name === value).children;continue;}if (type === "link") {exec(`open "${value}"`);break;}console.log("Unknown type", type);}