diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1bdd543..2ca470c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,4 +17,8 @@ jobs: uses: actions/checkout@v2 - name: Build Docker image +<<<<<<< HEAD run: docker build -t discord-badge . +======= + run: docker build -t discord-badge . +>>>>>>> dev diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9352058 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# Stage 1: Build stage +FROM node:16 AS builder + +# Set the working directory in the builder stage +WORKDIR /usr/src/app + +# Copy the package.json and package-lock.json files to the builder stage +COPY package*.json ./ + +# Install npm dependencies in the builder stage +RUN npm install + +# Copy the rest of the application code to the builder stage +COPY . . + +# Stage 2: Production stage +FROM node:16-alpine + +# Set the working directory in the production stage +WORKDIR /usr/src/app + +# Copy the built artifacts from the builder stage to the production stage +COPY --from=builder /usr/src/app . + +# Expose the port the app runs on +EXPOSE 3000 + +# Command to run the application in the production stage +CMD ["node", "index.js"] diff --git a/README.md b/README.md index 207ada7..2840c06 100644 --- a/README.md +++ b/README.md @@ -15,28 +15,40 @@ If you're still learning and want the badge, follow the instructions below! # Instructions - -- Go to https://discord.com/developers/applications, and create a new application on the account you want the badge on. -- Go to the bot tab and generate a bot account for the application. -- Click the "Reset Token" button to generate a token (if you have 2fa enabled, you'll need your code). -- Copy the token to your clipboard. -- Click this badge to clone this repo to a new repl in Replit -> [![Run on Repl.it](https://replit.com/badge/github/hackermondev/discord-active-developer-badge)](https://replit.com/new/github/hackermondev/discord-active-developer-badge) - - You will be redirected to Replit, you might have to create an account (you can Register with Google). +1. Go to https://discord.com/developers/applications, and create a new application on the account you want the badge on. +2. Go to the bot tab and generate a bot account for the application. +3. Click the "Reset Token" button to generate a token (if you have 2fa enabled, you'll need your code). +4. Copy the token to your clipboard. +5. Click this badge to clone this repo to a new repl in Replit -> [![Run on Repl.it](https://replit.com/badge/github/hackermondev/discord-active-developer-badge)](https://replit.com/new/github/hackermondev/discord-active-developer-badge) +6. You will be redirected to Replit, you might have to create an account (you can Register with Google). - Replit is a website, and does not run off your computer! -- Wait for the repo has finished cloning and the repl to fully connect. -- Click the green "Run" button at the top. -- Go to the console (big black square on the right) and paste in the token you copied earlier (**Note**: ``CTRL + V`` won't work, you'll need to do ``CTRL + Shift + V`` or right-click and click paste). -- Press the 'Enter' key. -- Wait for it to print 'DONE | Application/Bot is up and running. DO NOT CLOSE THIS TAB UNLESS YOU ARE FINISHED USING THE BOT, IT WILL PUT THE BOT OFFLINE.' in the console, **DON'T STOP THE PROGRAM OR CLOSE THE TAB YET OR THE BOT WILL CONSIDERED BY DISCORD AS 'UNRESPONSIVE'** -- Go back to the application page, go to the "General Information" tab, scroll down and copy application id. -- Create a new discord server (you can delete it at the end). -- Enable community on the server (you only need to do this if you don't own any other discord server with community enabled) -- Return back to https://discord.com/developers/applications. -- Copy the application id. -- Use this invite link to add the application to the server: (replace ``{applicationid}`` with what you copied) ``https://discord.com/oauth2/authorize?client_id={applicationid}&scope=bot%20applications.commands&permissions=105227086912`` -- In the server, go to a channel and use the ``/ping`` command on the bot. -- Go to the page and register everything (**if it says you're not eligible, it's because you're not registered in their system yet. you might have to wait up to 24 hours**). -- Congrats on that shiny new badge. +7. Wait for the repo has finished cloning and the repl to fully connect. +8. Click the green "Run" button at the top. +9. Go to the console (big black square on the right) and paste in the token you copied earlier (**Note**: ``CTRL + V`` won't work, you'll need to do ``CTRL + Shift + V`` or right-click and click paste). +10. Press the 'Enter' key. +11. Wait for it to print 'DONE | Application/Bot is up and running. DO NOT CLOSE THIS TAB UNLESS YOU ARE FINISHED USING THE BOT, IT WILL PUT THE BOT OFFLINE.' in the console, **DON'T STOP THE PROGRAM OR CLOSE THE TAB YET OR THE BOT WILL CONSIDERED BY DISCORD AS 'UNRESPONSIVE'** +12. Go back to the application page, go to the "General Information" tab, scroll down and copy application id. +13. Create a new discord server (you can delete it at the end). +14. Enable community on the server (you only need to do this if you don't own any other discord server with community enabled) +15. Return back to https://discord.com/developers/applications. +16. Copy the application id. +17. Use this invite link to add the application to the server: (replace ``{applicationid}`` with what you copied) ``https://discord.com/oauth2/authorize?client_id={applicationid}&scope=bot%20applications.commands&permissions=105227086912`` +18. In the server, go to a channel and use the ``/ping`` command on the bot. +19. Go to the page and register everything (**if it says you're not eligible, it's because you're not registered in their system yet. you might have to wait up to 24 hours**). +20. Congrats on that shiny new badge. + +## Instructions with Docker +### With Dockerfile +1. Follow step 1 to 4 from the main instruction above +2. Build the Dockerfile +```bash +docker build -t discord-badge . +``` +3. Run the container and insert your Discord bot token +```bash +docker run -it -p 3000:3000 discord-badge +``` +4. Jump directly to step 12 and follow the remaining steps from the main instruction **NOTE:** Make sure you have the “Use data to improve Discord” setting enabled under User Settings > Privacy & Safety otherwise you won't be able to be marked as eligible.