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=
API_URL=test-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.",
"Youre a smart cookie.",
"I bet you make babies smile.",
"You have impeccable manners.",
"I like your style.",
"You have the best laugh.",
"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.",
"Youre strong.",
"Your perspective is refreshing.",
"Youre an awesome friend.",
"You light up the room.",
"You deserve a hug right now.",
"You should be proud of yourself.",
"Youre more helpful than you realize.",
"You have a great sense of humor.",
"Youve got all the right moves!",
"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.",
"On a scale from 1 to 10, youre an 11.",
"You are brave.",
"Youre even more beautiful on the inside than you are on the outside.",
"You have the courage of your convictions.",
"Aside from food. Youre my favorite.",
"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.",
"You bring out the best in other people.",
"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?",
"Everything would be better if more people were like you!",
"I bet you sweat glitter.",
"You were cool way before hipsters were cool.",
"That color is perfect on you.",
"Hanging out with you is always a blast.",
"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!",
"Being around you makes everything better!",
"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.",
"Youre more fun than a ball pit filled with candy. (And seriously, what could be more fun than that?)",
"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!)",
"Jokes are funnier when you tell them.",
"Youre better than a triple-scoop ice cream cone. With sprinkles.",
"Your bellybutton is kind of adorable.",
"Your hair looks stunning.",
"Youre one of a kind!",
"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!!",
"Our community is better because youre in it.",
"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.",
"Everyone gets knocked down sometimes, but you always get back up and keep going.",
"Youre a candle in the darkness.",
"Youre a great example to others.",
"Being around you is like being on a happy little vacation.",
"You always know just what to say.",
"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.",
"Youre more fun than bubble wrap.",
"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.",
"Your voice is magnificent.",
"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.",
"Youre so thoughtful.",
"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.",
"Actions speak louder than words, and yours tell an incredible story.",
"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.",
"Any team would be lucky to have you on it.",
"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.",
"If you were a scented candle theyd call it Perfectly Imperfect (and it would smell like summer).",
"Theres ordinary, and then theres you.",
"Youre someones reason to smile.",
"Youre even better than a unicorn, because youre real.",
"How do you keep being so funny and making everyone laugh?",
"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.",
"Youre really something special.",
"Youre a gift to those around you."
{
"EN": "Youre that “Nothing” when people ask me what Im thinking about.",
"FR": "Quand on me demande à quoi je pense, je nose pas dire que je pense toujours à toi"
},
{
"EN": "You look great today.",
"FR": "Tu as lair en pleine forme aujourdhui."
},
{
"EN": "Youre a smart cookie.",
"FR": "Tu es un vrai chou à la crème"
},
{
"EN": "I bet you make babies smile.",
"FR": "Je parie que les bébés sourient en te voyant."
},
{
"EN": "You have impeccable manners.",
"FR": "Tu as un goût exquis."
},
{
"EN": "I like your style.",
"FR": "Jadore ton style."
},
{
"EN": "You have the best laugh.",
"FR": "Tu as un rire charmant"
},
{
"EN": "I appreciate you.",
"FR": "Jaime beaucoup ce que tu fais et ce que tu es."
},
{
"EN": "You are the most perfect you there is.",
"FR": "Tu es la personne la plus parfaite que je connaisse"
},
{
"EN": "Our system of inside jokes is so advanced that only you and I get it. And I like that.",
"FR": "Notre complicité est géniale, jadore les clins dœil que nous nous faisons."
},
{
"EN": "Youre strong.",
"FR": "Tu as de la personnalité, on peut te faire confiance."
},
{
"EN": "Your perspective is refreshing.",
"FR": "Quand on te croise, la journée est moins dure."
},
{
"EN": "Youre an awesome friend.",
"FR": "Ton amitié est précieuse."
},
{
"EN": "You light up the room.",
"FR": "Quand tu apparais, tu illumines tout."
},
{
"EN": "You deserve a hug right now.",
"FR": "Tu mérites quon tembrasse dès maintenant."
},
{
"EN": "You should be proud of yourself.",
"FR": "Tu peux être content⋅e de toi."
},
{
"EN": "Youre more helpful than you realize.",
"FR": "Ton aide est précieuse plus encore que tu ne limagines."
},
{
"EN": "You have a great sense of humor.",
"FR": "Tu as un sacré sens de lhumour."
},
{
"EN": "Youve got all the right moves!",
"FR": "Tu réussis tout ce que tu entreprends !"
},
{
"EN": "Is that your picture next to “charming” in the dictionary?",
"FR": "Dans le dictionnaire, cest ton portrait qui illustre le mot 'charme'"
},
{
"EN": "Your kindness is a balm to all who encounter it.",
"FR": "Ta gentillesse est un parfum qui embaume tous ceux qui tentourent."
},
{
"EN": "Youre all that and a super-size bag of chips.",
"FR": "Tu es tout pour nous et bien plus encore."
},
{
"EN": "On a scale from 1 to 10, youre an 11.",
"FR": "Sur une échelle de 1 à 10, tu es à 11."
},
{
"EN": "You are brave.",
"FR": "Jadmire ton courage."
},
{
"EN": "Youre even more beautiful on the inside than you are on the outside.",
"FR": "Tu es encore plus magnifique à lintérieur quà lextérieur."
},
{
"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 Mastodon = require('mastodon-api')
const M = new Mastodon({
access_token: process.env.ACCESS_TOKEN,
timeout_ms: 60 * 1000,
api_url: `${process.env.API_URL}/api/v1/`,
})
const TOKEN = 'ACCESS_TOKEN'
const URL = 'API_URL'
M.get('accounts/verify_credentials').then(
me => M.get(`accounts/${me.data.id}/followers`, { limit: 9999 }).then(fol => {
for (const follow of fol.data) {
M.post('statuses', { status: `@${follow.acct} ${database[Math.floor(Math.random() * database.length)]}`, visibility: 'unlisted' })
}
Object.entries(process.env)
.filter(e => e[0].startsWith(TOKEN))
.forEach(e => {
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' })
}
})
)
})