Add multilang: WIP

This commit is contained in:
sheychen 2019-04-22 20:48:32 +02:00
parent 777bfad879
commit ac448f8e33
4 changed files with 488 additions and 113 deletions

View File

@ -1,2 +1,5 @@
ACCESS_TOKEN= API_URL=test-url
API_URL= ACCESS_TOKEN=test
API_URL_FR=test-url1
ACCESS_TOKEN_FR=test1
ACCESS_TOKEN_EN=test2

View File

@ -1,102 +1,402 @@
[ [
"Youre that “Nothing” when people ask me what Im thinking about.", {
"You look great today.", "EN": "Youre that “Nothing” when people ask me what Im thinking about.",
"Youre a smart cookie.", "FR": "Quand on me demande à quoi je pense, je nose pas dire que je pense toujours à toi"
"I bet you make babies smile.", },
"You have impeccable manners.", {
"I like your style.", "EN": "You look great today.",
"You have the best laugh.", "FR": "Tu as lair en pleine forme aujourdhui."
"I appreciate you.", },
"You are the most perfect you there is.", {
"Our system of inside jokes is so advanced that only you and I get it. And I like that.", "EN": "Youre a smart cookie.",
"Youre strong.", "FR": "Tu es un vrai chou à la crème"
"Your perspective is refreshing.", },
"Youre an awesome friend.", {
"You light up the room.", "EN": "I bet you make babies smile.",
"You deserve a hug right now.", "FR": "Je parie que les bébés sourient en te voyant."
"You should be proud of yourself.", },
"Youre more helpful than you realize.", {
"You have a great sense of humor.", "EN": "You have impeccable manners.",
"Youve got all the right moves!", "FR": "Tu as un goût exquis."
"Is that your picture next to “charming” in the dictionary?", },
"Your kindness is a balm to all who encounter it.", {
"Youre all that and a super-size bag of chips.", "EN": "I like your style.",
"On a scale from 1 to 10, youre an 11.", "FR": "Jadore ton style."
"You are brave.", },
"Youre even more beautiful on the inside than you are on the outside.", {
"You have the courage of your convictions.", "EN": "You have the best laugh.",
"Aside from food. Youre my favorite.", "FR": "Tu as un rire charmant"
"If cartoon bluebirds were real, a bunch of them would be sitting on your shoulders singing right now.", },
"You are making a difference.", {
"Youre like sunshine on a rainy day.", "EN": "I appreciate you.",
"You bring out the best in other people.", "FR": "Jaime beaucoup ce que tu fais et ce que tu es."
"Your ability to recall random factoids at just the right time is impressive.", },
"Youre a great listener.", {
"How is it that you always look great, even in sweatpants?", "EN": "You are the most perfect you there is.",
"Everything would be better if more people were like you!", "FR": "Tu es la personne la plus parfaite que je connaisse"
"I bet you sweat glitter.", },
"You were cool way before hipsters were cool.", {
"That color is perfect on you.", "EN": "Our system of inside jokes is so advanced that only you and I get it. And I like that.",
"Hanging out with you is always a blast.", "FR": "Notre complicité est géniale, jadore les clins dœil que nous nous faisons."
"You always know — and say — exactly what I need to hear when I need to hear it.", },
"You smell really good.", {
"You may dance like no ones watching, but everyones watching because youre an amazing dancer!", "EN": "Youre strong.",
"Being around you makes everything better!", "FR": "Tu as de la personnalité, on peut te faire confiance."
"When you say, “I meant to do that,” I totally believe you.", },
"When youre not afraid to be yourself is when youre most incredible.", {
"Colors seem brighter when youre around.", "EN": "Your perspective is refreshing.",
"Youre more fun than a ball pit filled with candy. (And seriously, what could be more fun than that?)", "FR": "Quand on te croise, la journée est moins dure."
"That thing you dont like about yourself is what makes you so interesting.", },
"Youre wonderful.", {
"Everyday is just BLAH when I dont see you For reals! (awesome you are halfway through the list. Youre awesome!)", "EN": "Youre an awesome friend.",
"Jokes are funnier when you tell them.", "FR": "Ton amitié est précieuse."
"Youre better than a triple-scoop ice cream cone. With sprinkles.", },
"Your bellybutton is kind of adorable.", {
"Your hair looks stunning.", "EN": "You light up the room.",
"Youre one of a kind!", "FR": "Quand tu apparais, tu illumines tout."
"Youre inspiring.", },
"If you were a box of crayons, youd be the giant name-brand one with the built-in sharpener.", {
"You should be thanked more often. So thank you!!", "EN": "You deserve a hug right now.",
"Our community is better because youre in it.", "FR": "Tu mérites quon tembrasse dès maintenant."
"Someone is getting through something hard right now because youve got their back.", },
"You have the best ideas.", {
"You always know how to find that silver lining.", "EN": "You should be proud of yourself.",
"Everyone gets knocked down sometimes, but you always get back up and keep going.", "FR": "Tu peux être content⋅e de toi."
"Youre a candle in the darkness.", },
"Youre a great example to others.", {
"Being around you is like being on a happy little vacation.", "EN": "Youre more helpful than you realize.",
"You always know just what to say.", "FR": "Ton aide est précieuse plus encore que tu ne limagines."
"Youre always learning new things and trying to better yourself, which is awesome.", },
"If someone based an Internet meme on you, it would have impeccable grammar.", {
"You could survive a Zombie apocalypse.", "EN": "You have a great sense of humor.",
"Youre more fun than bubble wrap.", "FR": "Tu as un sacré sens de lhumour."
"When you make a mistake, you fix it.", },
"Who raised you? They deserve a medal for a job well done.", {
"Youre great at figuring stuff out.", "EN": "Youve got all the right moves!",
"Your voice is magnificent.", "FR": "Tu réussis tout ce que tu entreprends !"
"The people you love are lucky to have you in their lives.", },
"Youre like a breath of fresh air.", {
"Youre gorgeous — and thats the least interesting thing about you, too.", "EN": "Is that your picture next to “charming” in the dictionary?",
"Youre so thoughtful.", "FR": "Dans le dictionnaire, cest ton portrait qui illustre le mot 'charme'"
"Your creative potential seems limitless.", },
"Youre the coolest person I know. And I consider myself bet friends with like all celebrities, so. . . .", {
"Youre irresistible when you blush.", "EN": "Your kindness is a balm to all who encounter it.",
"Actions speak louder than words, and yours tell an incredible story.", "FR": "Ta gentillesse est un parfum qui embaume tous ceux qui tentourent."
"Somehow you make time stop and fly at the same time.", },
"When you make up your mind about something, nothing stands in your way.", {
"You seem to really know who you are.", "EN": "Youre all that and a super-size bag of chips.",
"Any team would be lucky to have you on it.", "FR": "Tu es tout pour nous et bien plus encore."
"In high school I bet you were voted “most likely to keep being awesome.”", },
"I bet you do the crossword puzzle in ink.", {
"Babies and small animals probably love you.", "EN": "On a scale from 1 to 10, youre an 11.",
"If you were a scented candle theyd call it Perfectly Imperfect (and it would smell like summer).", "FR": "Sur une échelle de 1 à 10, tu es à 11."
"Theres ordinary, and then theres you.", },
"Youre someones reason to smile.", {
"Youre even better than a unicorn, because youre real.", "EN": "You are brave.",
"How do you keep being so funny and making everyone laugh?", "FR": "Jadmire ton courage."
"You have a good head on your shoulders.", },
"Has anyone ever told you that you have great posture?", {
"The way you treasure your loved ones is incredible.", "EN": "Youre even more beautiful on the inside than you are on the outside.",
"Youre really something special.", "FR": "Tu es encore plus magnifique à lintérieur quà lextérieur."
"Youre a gift to those around you." },
{
"EN": "You have the courage of your convictions.",
"FR": "Tu as le courage de défendre tes convictions."
},
{
"EN": "Aside from food. Youre my favorite.",
"FR": "Après le tiramisu, cest toi que je préfère."
},
{
"EN": "If cartoon bluebirds were real, a bunch of them would be sitting on your shoulders singing right now.",
"FR": "Si les licornes existaient, elles te feraient une haie dhonneur chaque matin."
},
{
"EN": "You are making a difference.",
"FR": "Tu fais vraiment la différence quand tu arrives."
},
{
"EN": "Youre like sunshine on a rainy day.",
"FR": "Tu es comme un rayon de soleil après la pluie."
},
{
"EN": "You bring out the best in other people.",
"FR": "Avec toi, chacun donne le meilleur de soi-même."
},
{
"EN": "Your ability to recall random factoids at just the right time is impressive.",
"FR": "Ta mémoire est telle que tu noublies rien des moments heureux."
},
{
"EN": "Youre a great listener.",
"FR": "Tu sais écouter les autres avec une réelle attention."
},
{
"EN": "How is it that you always look great, even in sweatpants?",
"FR": "Comment se fait-il que tu aies toujours lair impeccable, même avec un vieux survèt ?"
},
{
"EN": "Everything would be better if more people were like you!",
"FR": "Le monde tournerait bien mieux si les autres étaient comme toi !"
},
{
"EN": "I bet you sweat glitter.",
"FR": "Je parie que tes gouttes de sueur sont des perles."
},
{
"EN": "You were cool way before hipsters were cool.",
"FR": "Tu étais déjà cool avant que la coolitude soit à la mode."
},
{
"EN": "That color is perfect on you.",
"FR": "Les couleurs que tu choisis te vont très bien."
},
{
"EN": "Hanging out with you is always a blast.",
"FR": "Se balader à tes côtés est une vraie partie de plaisir."
},
{
"EN": "You always know — and say — exactly what I need to hear when I need to hear it.",
"FR": "Tu sais toujours dire exactement ce que jai besoin dentendre."
},
{
"EN": "You smell really good.",
"FR": "Ton parfum est un enchantement."
},
{
"EN": "You may dance like no ones watching, but everyones watching because youre an amazing dancer!",
"FR": "Tu danses comme si personne ne te regardait, mais tu danses si bien que tout le monde te regarde !"
},
{
"EN": "Being around you makes everything better!",
"FR":
},
{
"EN": "When you say, “I meant to do that,” I totally believe you.",
"FR":
},
{
"EN": "When youre not afraid to be yourself is when youre most incredible.",
"FR":
},
{
"EN": "Colors seem brighter when youre around.",
"FR":
},
{
"EN": "Youre more fun than a ball pit filled with candy. (And seriously, what could be more fun than that?)",
"FR":
},
{
"EN": "That thing you dont like about yourself is what makes you so interesting.",
"FR":
},
{
"EN": "Youre wonderful.",
"FR":
},
{
"EN": "Everyday is just BLAH when I dont see you For reals! (awesome you are halfway through the list. Youre awesome!)",
"FR":
},
{
"EN": "Jokes are funnier when you tell them.",
"FR":
},
{
"EN": "Youre better than a triple-scoop ice cream cone. With sprinkles.",
"FR":
},
{
"EN": "Your bellybutton is kind of adorable.",
"FR":
},
{
"EN": "Your hair looks stunning.",
"FR":
},
{
"EN": "Youre one of a kind!",
"FR":
},
{
"EN": "Youre inspiring.",
"FR":
},
{
"EN": "If you were a box of crayons, youd be the giant name-brand one with the built-in sharpener.",
"FR":
},
{
"EN": "You should be thanked more often. So thank you!!",
"FR":
},
{
"EN": "Our community is better because youre in it.",
"FR":
},
{
"EN": "Someone is getting through something hard right now because youve got their back.",
"FR":
},
{
"EN": "You have the best ideas.",
"FR":
},
{
"EN": "You always know how to find that silver lining.",
"FR":
},
{
"EN": "Everyone gets knocked down sometimes, but you always get back up and keep going.",
"FR":
},
{
"EN": "Youre a candle in the darkness.",
"FR":
},
{
"EN": "Youre a great example to others.",
"FR":
},
{
"EN": "Being around you is like being on a happy little vacation.",
"FR":
},
{
"EN": "You always know just what to say.",
"FR":
},
{
"EN": "Youre always learning new things and trying to better yourself, which is awesome.",
"FR":
},
{
"EN": "If someone based an Internet meme on you, it would have impeccable grammar.",
"FR":
},
{
"EN": "You could survive a Zombie apocalypse.",
"FR":
},
{
"EN": "Youre more fun than bubble wrap.",
"FR":
},
{
"EN": "When you make a mistake, you fix it.",
"FR":
},
{
"EN": "Who raised you? They deserve a medal for a job well done.",
"FR":
},
{
"EN": "Youre great at figuring stuff out.",
"FR":
},
{
"EN": "Your voice is magnificent.",
"FR":
},
{
"EN": "The people you love are lucky to have you in their lives.",
"FR":
},
{
"EN": "Youre like a breath of fresh air.",
"FR":
},
{
"EN": "Youre gorgeous — and thats the least interesting thing about you, too.",
"FR":
},
{
"EN": "Youre so thoughtful.",
"FR":
},
{
"EN": "Your creative potential seems limitless.",
"FR":
},
{
"EN": "Youre the coolest person I know. And I consider myself bet friends with like all celebrities, so. . . .",
"FR":
},
{
"EN": "Youre irresistible when you blush.",
"FR":
},
{
"EN": "Actions speak louder than words, and yours tell an incredible story.",
"FR":
},
{
"EN": "Somehow you make time stop and fly at the same time.",
"FR":
},
{
"EN": "When you make up your mind about something, nothing stands in your way.",
"FR":
},
{
"EN": "You seem to really know who you are.",
"FR":
},
{
"EN": "Any team would be lucky to have you on it.",
"FR":
},
{
"EN": "In high school I bet you were voted “most likely to keep being awesome.”",
"FR":
},
{
"EN": "I bet you do the crossword puzzle in ink.",
"FR":
},
{
"EN": "Babies and small animals probably love you.",
"FR":
},
{
"EN": "If you were a scented candle theyd call it Perfectly Imperfect (and it would smell like summer).",
"FR":
},
{
"EN": "Theres ordinary, and then theres you.",
"FR":
},
{
"EN": "Youre someones reason to smile.",
"FR":
},
{
"EN": "Youre even better than a unicorn, because youre real.",
"FR":
},
{
"EN": "How do you keep being so funny and making everyone laugh?",
"FR":
},
{
"EN": "You have a good head on your shoulders.",
"FR":
},
{
"EN": "Has anyone ever told you that you have great posture?",
"FR":
},
{
"EN": "The way you treasure your loved ones is incredible.",
"FR":
},
{
"EN": "Youre really something special.",
"FR":
},
{
"EN": "Youre a gift to those around you.",
"FR":
}
] ]

60
database_fr_2.json Normal file
View File

@ -0,0 +1,60 @@
[
"Tout va mieux quand tu es tout près de moi !",
"Quand tu dis 'Voilà ce que je vais faire', jai envie de le faire avec toi.",
"Tu es incroyable quand tu nas pas peur dêtre toi-même.",
"Ta seule présence ravive les couleurs du quotidien.",
"Tu es plus chouette quun énorme paquet de chamallows.",
"Cest ce que tu naimes pas chez toi qui te rend une personne intéressante.",
"Tu es une merveille.",
"Chaque jour est tristounet quand je ne te vois pas en vrai !",
"Les blagues sont bien plus drôles quand cest toi qui les racontes.",
"Tu es un tel délice que les glaces à la framboise me paraissent fades.",
"Même ton nombril est tout à fait mignon.",
"Ta chevelure est magnifique.",
"Tu te distingues vraiment du lot !",
"Tu es pour tout le monde une source dinspiration.",
"Si tu étais un crayon de couleur, tu pourrais dessiner larc-en-ciel dun seul trait.",
"Tout le monde peut te remercier. Merci pour tout ce que tu es !",
"Notre communauté est bien meilleure grâce à toi.",
"En ce moment, une personne surmonte ses difficultés grâce à ton aide et ton soutien.",
"Tes idées sont les meilleures.",
"Tu tarranges toujours pour trouver le meilleur en chacun.",
"Tout le monde peut avoir un petit coup de blues, mais avec toi on surmonte cette épreuve.",
"Tu es comme une lumière dans lobscurité de nos vies.",
"Tu es un exemple pour tout le monde.",
"Quand on est près de toi, cest comme si on était en vacances.",
"Tu sais toujours quoi répondre face aux problèmes.",
"Tu as tellement soif dapprendre et tu progresses tellement que tu es formidable.",
"Si on devait faire un mème pour Internet avec toi, ce serait avec tes paroles de sagesse.",
"Tu peux survivre à toutes les apocalypses.",
"Tu es beaucoup plus drôle que les humoristes professionnels.",
"Tu sais reconnaître tes erreurs et apprendre à mieux faire.",
"Tes parents méritent dêtre récompensés de tavoir mis⋅e au monde.",
"Tu sais fort bien démêler les affaires compliquées.",
"Ta voix est mélodieuse.",
"Les personnes que tu aimes ont bien de la chance !",
"Ton souffle est une brise de printemps.",
"Tu es splendide, mais cest la moindre de tes qualités.",
"Tu es une personne réfléchie et fiable.",
"Ton potentiel créatif paraît sans limites.",
"Tu es la personne la plus géniale que je connaisse. Et je connais pourtant beaucoup de personnes très sympas…",
"Tu es irrésistible quand tu rougis.",
"Les actes valent mieux que les mots, et tes actes le prouvent chaque jour.",
"Avec toi le temps passe tellement vite quon ne sennuie jamais.",
"Quand tu as pris une décision, rien ne peut plus tarrêter.",
"Tu as lair de savoir vraiment ce que tu veux.",
"Toutes les associations et clubs voudraient bien que tu les rejoignes.",
"Tu étais sûrement la personne la plus populaire pendant tes études, tu les toujours aujourdhui.”",
"Je parie que tu termines les mots croisés en 5 minutes.",
"Je parie que les chiens et les chats viennent spontanément près de toi avec amour.",
"Si tu étais un parfum on tappellerait 'Fleurs dété'.",
"Il y a les gens ordinaires, et puis il y a toi.",
"Tu donnes envie de sourire quand on te voit.",
"Tu vaux bien mieux quune licorne parce que tu existes vraiment.",
"Comment tu fais pour être si drôle et faire rire autour de toi ?",
"Tu as la tête sur les épaules en toutes circonstances.",
"On ta déjà dit à quel point ton allure est impressionnante ?",
"Tu es incroyable avec les personnes que tu aimes.",
"Tu es vraiment une personne très spéciale.",
"Ta présence est un cadeau pour celles et ceux qui tentourent."
]

View File

@ -2,16 +2,28 @@ require('dotenv').config()
const database = require('./database.json') const database = require('./database.json')
const Mastodon = require('mastodon-api') const Mastodon = require('mastodon-api')
const M = new Mastodon({ const TOKEN = 'ACCESS_TOKEN'
access_token: process.env.ACCESS_TOKEN, const URL = 'API_URL'
timeout_ms: 60 * 1000,
api_url: `${process.env.API_URL}/api/v1/`,
})
M.get('accounts/verify_credentials').then( Object.entries(process.env)
me => M.get(`accounts/${me.data.id}/followers`, { limit: 9999 }).then(fol => { .filter(e => e[0].startsWith(TOKEN))
for (const follow of fol.data) { .forEach(e => {
M.post('statuses', { status: `@${follow.acct} ${database[Math.floor(Math.random() * database.length)]}`, visibility: 'unlisted' }) const lang = e[0].substring(TOKEN.length + 1)
}
const M = new Mastodon({
access_token: process.env[`${TOKEN}_${lang}`] || process.env[TOKEN],
api_url: `${process.env[`API_URL_${lang}`] || process.env[URL]}/api/v1/`,
timeout_ms: 60 * 1000
}) })
)
M.get('accounts/verify_credentials').then(
me => M.get(`accounts/${me.data.id}/followers`, { limit: 9999 }).then(fol => {
for (const follow of fol.data) {
const messages = database[Math.floor(Math.random() * database.length)]
const text = lang.length > 0 ? messages[lang] : '\n' + Object.entries(messages).map(m => `[${m[0]}] ${m[1]}`).join('\n\n')
M.post('statuses', { status: `@${follow.acct} ${text}`, visibility: 'unlisted' })
}
})
)
})