Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker #53

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Docker Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build Docker image
run: docker build -t discord-badge .
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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 .

# Command to run the application in the production stage
CMD ["node", "index.js"]
54 changes: 33 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://discord.com/developers/active-developer> 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 <https://discord.com/developers/active-developer> 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 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.
Expand Down