Last active
August 20, 2017 23:31
-
-
Save Nexuist/9923ceff5892f129db920a44919fbddd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const text = "Congratulations! You won the Unreplied giveaway! Here's your promo code: PROMO. Thanks for participating! Make sure you tell all of your Mac friends about it too, they might like it as well!" | |
const codes = fs.readFileSync("promo_codes.txt", "utf8").split("\n"); // A text file with a promo code on each line | |
function generateLine(user) { | |
let encodedText = encodeURIComponent(text).replace(/'/g, "%27").replace("PROMO", codes.pop()); | |
let link = `https://twitter.com/messages/compose?recipient_id=${user.id}&text=${encodedText}`; | |
return `${user.name} (@${user.screen_name}) - ${link}`; | |
} | |
var lines = luckyUsers.map(generateLine); | |
fs.writeFileSync("list.json", lines.join("\n"), "utf8"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment