/soseramemes

Primary LanguageTypeScript

Só Será Memes

Só Será Memes logo.

How to setup soseramemes

  1. Create a bot and retrieve the token. How to Get a Discord Bot Token. It should have the following permissions:

    • Send Messages
    • Read Message History
  2. Add token to .env file with name DISCORD_TOKEN.

  3. Get memes channel id from Discord and add it to .env file with name DISCORD_MEMES_CHANNEL_ID.

  4. Go to Twitter developer portal and retrieve the tokens and save them to .env:

    • TWITTER_ACCESS_TOKEN
    • TWITTER_ACCESS_TOKEN_SECRET
    • TWITTER_API_KEY
    • TWITTER_API_KEY_SECRET
  1. Access AWS and retrieve the access key, secret, region, and bucket name. Save them to .env file with the following names:

    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
    • AWS_REGION
    • AWS_BUCKET_NAME

Once you have all the tokens, you can run the bot locally with npm run dev.

Development

To run the bot locally and watch for changes, run:

npm run dev

To run the bot locally without watching for changes, run:

npm run start

Test

To run the tests, run:

npm test

Server

We use PM2 to run and keep soseramemes online. Provisioning the server:

sudo apt update
sudo apt install curl
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.bashrc
nvm install node 20 # As of November 2023

Cloning the project via HTTPS:

git clone https://github.com/arantespp/soseramemes.git

Now, to start the server, run:

npm install
npm run server:start

To check the logs, run:

npm run server:logs

If you want to check only error logs, run:

npm run server:logs --err

To check PM2 status, run:

pm2 status

Deploy

To configure the deploy, add the following variable to the .env file on the server:

  • WEBHOOK_SECRET: The secret used to verify the webhook.