miguelfs / gerador-ditos-populares

gerador inutil de ditos populares

Home Page:gerador-ditos-populares.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introdution

This is an exercise , using a dummy idea to produce a POC of a feature.

Check it out the Twitter bot

What is this POC

A few days ago , I saw this tweet

drawing

In this tweet , written in portuguese, is stated that a popular brazilian saying is easily created, following a set of rule:

  1. The phrase must start with a animal name
  2. Folowed by an adjective to the animal
  3. Add the word no
  4. Followed by a verb
  5. And finished with an adverb of time, place or mood.

This set of rules got me thinking and I've created this application , with hardcoded data to generate completely random strings for each rule.

Getting Started with twitter bot

Head over to Twitter engine directory

cd ./twitter-engine

You need to create a env file in order to generate the frases from OpenAI, and to create tweets:

touch .env

Add your key within the enviroment variable: OPENAI_API_KEY

Check how to create your own OpenAI key here

Add your Twitter keys as TWITTER_CONSUMER_KEY , TWITTER_CONSUMER_SECRET, TWITTER_ACCESS_TOKEN_KEY , TWITTER_ACCESS_TOKEN_SECRET

Check how to create your own keys here

Your file should have the variables as follow:

OPENAI_API_KEY="your key"
TWITTER_CONSUMER_KEY="your key"
TWITTER_CONSUMER_SECRET="your key"
TWITTER_ACCESS_TOKEN_KEY="your key"
TWITTER_ACCESS_TOKEN_SECRET="your key"

Instal packages

yarn

or

npm install

Run the development server:

npm run dev
# or
yarn dev

There you have it, the application will generate the image at ./src/public/images and try to send it to twitter according to node-cron schedule on ./src/app.ts

How it works

Screenshot 2022-01-03 at 15 30 12

Getting Started with nextJs

Head over to Nextjs engine directory

cd ./frontend-engine

Install with npm install or yarn

You need to create a env file in order to generate the frases from OpenAI:

touch .env.local

Add your key within the enviroment variable: NEXT_PUBLIC_OPENAI_API_KEY

Your file should have the variables as follow:

NEXT_PUBLIC_OPENAI_API_KEY="your key"

Check how to create your own OpenAI key here

Run the development server:

npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying pages/index.js. The page auto-updates as you edit the file.

The pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.

There you have it, the application will generate the image at http://localhost:3000

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

About

gerador inutil de ditos populares

gerador-ditos-populares.vercel.app


Languages

Language:TypeScript 47.8%Language:JavaScript 44.5%Language:CSS 7.7%