Sign inSign up

ptrfrll/dinnerbot

By ptrfrll

•Updated over 2 years ago

Discord bot to track PUBG wins

Image
0

1.5K

ptrfrll/dinnerbot repository overview

⁠DinnerBot - PUBG Win Tracker

Publish Docker image Run tests GitHub last commit Discord Status

Dinner Bot

DinnerBot is a Discord bot that listens on a specfic channel for PUBG win screenshots and responds with WINNER WINNER CHICKEN DINNER and some emoji 🐔 🏆 🍽 if the image is a winning screenshot. Useful for chicken-dinner-receipt channels where only winning screenshots are posted. Keeps track of win count for each tagged users.

⁠Image Comparison

Winning screenshots are determined by comparing the uploaded screenshot with a known win screenshot (base.png⁠). If the uploaded screenshot is within a certain similarity score to the base image, a win is awarded.

If the uploaded image is not within the specified threshold, the image will be OCRed and the bot looks for the text "WINNER WINNER CHICKEN DINNER"

⁠Image Hash

When a winning screenshot is added, dinnerbot will compute the SHA1 hash of the uploaded image and store it in the database. This is used to avoid someone uploading duplicate images.

Hash

⁠Getting Started

⁠Create Bot in Discord Dev portal

Create a new dev app on Discord here⁠.

Under the Bot section, click Add Bot and copy your bot's Token.

Add the bot to your server using bot authorization flow⁠:

Example link (note CLIENT_ID != TOKEN):

https://discordapp.com/api/oauth2/authorize?client_id=CLIENT_ID&scope=bot&permissions=75840
⁠Docker

The simplest way to run dinnerbot. You need to map the /config and /data volumes in order for it to run

docker pull ptrfrll/dinnerbot:latest
docker run -d -e BOT_TOKEN="BOT_TOKEN" -e CHANNEL_ID="CHANNEL_ID" -e PUBG_API_KEY="PUBG_API_KEY" -v path_on_local_machine:/data:rw -v path_on_local_machine:/config:rw ptrfrll/dinnerbot

Example:

docker run -d --name dinnerbot \
-e BOT_TOKEN="FAKETOKEN1234" \
-e CHANNEL_ID="1234567890" \
-e PUBG_API_KEY="abc123" \
-v C:\Users\ptrfrll\dinnerbot\data:/data:rw \
-v C:\Users\ptrfrll\dinnerbot\config:/config:rw \
ptrfrll/dinnerbot
⁠Run locally

Edit the config.js⁠ file with your discord bot token and the channel-id of the channel you want it to listen on.

Start the bot with:

$ npm install
$ npm run dev

⁠Commands

⁠!wins

Use !wins command to see current win count, you can tag users to show their count as well.

Ex. !wins @DericLee @Tarvis produces:

Win Count

⁠!help

Use !help or mention the bot to get a list of available commands

Help

⁠PUBG Stats

The bot can query the PUBG API for stats from the last win and lifetime stats. You'll need to get a PUBG API Key⁠ and add it via the PUBG_API_KEY environment variable/config file

stats

⁠Configuration

Edit the config.js⁠ to change these settings.

IMG_SCORE_THRESHOLD: 20000, //if the image score is below this number it's awared a win (20,000 is arbitrary based off my testing)
LOGMODE: 'prod', //prod or debug
AUTH_USERS: {
    //users/roles specified here can award wins that scored too high
    users: [''], //array of user ids
    roles: [''] //array of role names
},
BOT_RESPONSES_GOOD: good, //array of 'good' responses from bot, replied when AUTH_USER mentions bot
BOT_RESPONSES_BAD: bad //array of 'bad' responses from bot, replied when non-AUTH_USER mentions bot

⁠Built With

Tag summary

Content type

Image

Digest

sha256:feeb0a0cd…

Size

412.2 MB

Last updated

over 2 years ago

docker pull ptrfrll/dinnerbot