Giter Club home page Giter Club logo

test-poker's Introduction

Discord Tournament Points Bot

Logo

This project is a Dockerized Discord bot written in Rust, designed to keep track of points won in tournaments.

To learn more about the technologies used in this project, you can check out the following documentation:

\SRC
│   auth.rs
│   data_structs.rs
│   main.rs
│
├───db
│   │   config.rs
│   │   mod.rs
│   │   utils.rs
│   │
│   └───commands
│           mod.rs
│           table_bounties.rs
│           table_reward.rs
│           table_tournaments.rs
│           table_users.rs
│
└───discord
    │   handler.rs
    │   mod.rs
    │   utils.rs
    │
    └───commands
            bosses.rs
            bounties.rs
            mod.rs
            points.rs
            poker.rs
            tournaments.rs

Deployment

Docker (need update)

To deploy this project run

  docker-compose up -d --build

Cargo

   cargo build
   source variables_env.sh
    cargo run

Discord msg handler

Write top 10 and pin msg

   !top

Discord Slash Commands

GET TOURNAMENTS

   /poker_get_tournaments

TOP 10 tournament

   /poker_top10

Tournament ID TOP 10

   /poker_top10_tournament ${fecha}
Parameter Type Description
fecha DD/MM/YYYY Required. Date of tournament

GET user (rank & points)

   /poker_search_user ${user}
Parameter Type Description
user string Required. ID/@Mention user

GET user_info (general data)

   /poker_info_user ${user}
Parameter Type Description
user string Required. ID/@Mention user

Guide verify bitmex

   /poker_verify

Verify twitch name

   /poker_verify_twitch

Verify bitmex user

   /poker_verify_bitmex ONLY DM

Owner server commands

Give verified bitmex manual

   /admin_verify_bitmex ${user} ${verify} ROLE NEEDED
Parameter Type Description
user string Required. ID/@Mention user
verify Bool Required. Checked on bitmex TRUE or not FALSE

Give verified twitch manual

   /admin_verify_twitch ${user} ${user_twitch} ROLE NEEDED
Parameter Type Description
user string Required. ID/@Mention user
verify string Required. Tag User

Create Tournament

  /admin_create_tournament ${fecha} ROLE NEEDED
Parameter Type Description
fecha DD/MM/YYYY Required. Date of tournament

Create guild_boss

  /admin_agree_boss ${user} ROLE NEEDED ONLY OWNER
Parameter Type Description
user string Required. ID/@Mention user

Sumarized Points

   /admin_sum_points ${points} ${user} ${fecha} ROLE NEEDED
Parameter Type Description
points INTEGER Required. Number of BB
user string Required. ID/@Mention user
fecha DD/MM/YYYY Required. Date of tournament

Substract points

   /admin_substract_points ${points} ${user} ${fecha} ROLE NEEDED
Parameter Type Description
points INTEGER Required. Number of BB
user string Required. ID/@Mention user
fecha DD/MM/YYYY Required. Date of tournament

Delete points

   /admin_delete_points ${user} ${fecha} ROLE NEEDED
Parameter Type Description
points INTEGER Required. Number of BB
user string Required. ID/@Mention user
fecha DD/MM/YYYY Required. Date of tournament

Give bounty

   /admin_give_bounty ${points} ${user} ${fecha} ${win} ROLE NEEDED
Parameter Type Description
points INTEGER Required. Number of BB
user string Required. ID/@Mention user
fecha DD/MM/YYYY Required. Date of tournament
win Bool Required. Win tournament TRUE, Bounty FALSE

SQL

CREATE TABLE IF NOT EXISTS users (
    id INTEGER PRIMARY KEY,
    user_name TEXT NOT NULL,
    user_id INTEGER NOT NULL UNIQUE,
    points INTEGER,
    bitmex BOOLEAN DEFAULT 0,
    created_at TIMESTAMP,
    wins INTEGER DEFAULT 0,
    bounties INTEGER DEFAULT 0,
    updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS tournaments (
    tournament_id INTEGER PRIMARY KEY,
    tournament_date DATE NOT NULL UNIQUE,
    bounties INTEGER
);

CREATE TABLE IF NOT EXISTS bounties (
    bounty_id INTEGER PRIMARY KEY,
    bounty_winner BOOLEAN DEFAULT 0,
    bounty_date TIMESTAMP,
    user_id INTEGER,
    tournament_id INTEGER,
    coins INTEGER,
    FOREIGN KEY(user_id) REFERENCES users(user_id),
    FOREIGN KEY(tournament_id) REFERENCES tournaments(tournament_date)
);

CREATE TABLE IF NOT EXISTS reward (
    id INTEGER PRIMARY KEY,
    tournament_id INTEGER,
    user_id INTEGER,
    points INTEGER,
    FOREIGN KEY(tournament_id) REFERENCES tournaments(tournament_date),
    FOREIGN KEY(user_id) REFERENCES users(user_id)
);

CREATE TABLE IF NOT EXISTS bosses (
   boss_id INTEGER PRIMARY KEY,
   user_id INTEGER,
   user_name TEXT NOT NULL,
   created_at TIMESTAMP,
   updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
   FOREIGN KEY(user_id) REFERENCES users(user_id)
);

CREATE UNIQUE INDEX idx_bounty_winner ON bounties (tournament_id) WHERE bounty_winner = 1;
CREATE UNIQUE INDEX idx_reward ON reward (tournament_id, user_id);

Tech Stack

CRATES

Weird shit

stuff

test-poker's People

Contributors

etaelith avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.