Skip to content

Instantly share code, notes, and snippets.

View druv5319's full-sized avatar

Dhruv Patel druv5319

View GitHub Profile
@druv5319
druv5319 / index.js
Created August 8, 2022 19:39
Send and Receive SMS Messages via Discord with Twilio and Node.js
require('dotenv').config();
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent, , GatewayIntentBits.GuildMembers] });
const twilio = require('twilio')(process.env.TWILIO_ACCOUNT_SID, process.env.TWILIO_AUTH_TOKEN);
const friendsChannelId = 'XXXXXX';
const myUserId = 'XXXXXX';
const express = require('express')
const app = express();
app.use(express.urlencoded({
@druv5319
druv5319 / contact-representative.json
Last active June 21, 2022 15:22
Twilio Studio SMS flow to find and contact your local representatives with a given address.
{
"description": "SMS flow to find and contact your local representatives with a given address.",
"states": [
{
"name": "Trigger",
"type": "trigger",
"transitions": [
{
"next": "main_menu",
"event": "incomingMessage"
@druv5319
druv5319 / index.js
Created March 2, 2022 18:50
SendGrid Newsletter App
require('dotenv').config();
const sgMail = require('@sendgrid/mail');
const sgClient = require('@sendgrid/client');
const express = require('express')
const expressFileUpload = require('express-fileupload');
const app = express();
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
sgClient.setApiKey(process.env.SENDGRID_API_KEY);
app.use(express.urlencoded({
@druv5319
druv5319 / index.js
Last active December 8, 2021 01:08
Sneaker price tracker using SendGrid and Node.js
require('dotenv').config()
const SneaksAPI = require('sneaks-api');
const fs = require("fs");
const schedule = require('node-schedule');
const sneaks = new SneaksAPI();
const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const jsonString = fs.readFileSync("./subscribers.json");
const subscribers = JSON.parse(jsonString);
require('dotenv').config();
const OpenAI = require('openai-api');
const openai = new OpenAI(process.env.OPENAI_API_KEY);
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
let prompt ='Marv is a chatbot that reluctantly answers questions.\n\
You: How many pounds are in a kilogram?\n\
Marv: This again? There are 2.2 pounds in a kilogram. Please make a note of this.\n\
You: What does HTML stand for?\n\
const express = require('express');
const request = require('request');
const cheerio = require('cheerio');
const axios = require('axios')
const app = express();
app.get('/', function(req, res){
let shoe =req.query.shoe;
let url = 'https://stockx.com/api/products/nike-daybreak-undercover-black?includes=market'
request(url, function(error, response, html) {