Giter VIP home page Giter VIP logo

ticketeer's Introduction

Ticketeer

A basic open-source Discord ticket bot made in Python

Ticketeer is a Discord ticket bot made with Pycord in Python. It uses Tortoise ORM and SQLite as a database, and Poetry as a package manager. While not exactly being for beginners, this open sourced project could help some people understand how to use Tortoise ORM and Pycord.

To do:

  • Create tickets:
    • Forum Private
    • Forum Public
    • Text Private Thread
    • Text Public Thread
    • Text Private Channel
    • Text Public Channel
  • Record Ticket messages
  • Close tickets
    • Process data on thread delete
    • Process data with close command
    • Create, format, and send ticket transcripts to a channel
  • Config settings
    • Ticket channel
    • Ticket handler role
    • Ticket type
    • Transcript channel
    • Automatically add ticket handlers to channel
    • Auto archive settings
    • Ticket channel category
  • Ticket Categories
    • Create, Manage, and Delete ticket categories
    • Different handlers for category
    • Add tags to forum channel thread
    • Add tickets with categories to corresponding channel categories

Setup

To run the bot, you'll need to clone this repository and install the packages with Poetry. If you don't have Poetry installed, you can get it here.

git clone https://github.com/ConchDev/ticketeer
cd ticketeer
poetry install

Then, clone .env.example as .env, and populate the environment variables to be specific to you.

cp .env.example .env

After all that, you can finally run the bot. You can run it in prod mode or in dev mode.

poetry run dev
poetry run prod

At the moment, they're basically the same, with differences in the logger.

Changing the Database

Thanks to Tortoise, swapping out databases from the default SQLite is relatively easy. All you need to do is add the Tortoise extra in pyproject.toml and swap around the config.

Here's an example with PostgreSQL:

pyproject.toml:

tortoise-orm = { extras = ["asyncpg"], version = "^0.19.2" }

ticketeer/objects/bot.py DB_CONFIG:

DB_CONFIG = {
    "connections": {
        "ticketeer": {
            "engine": "tortoise.backends.asyncpg",
            "credentials": {
                "host": os.getenv("HOST"),
                "port": os.getenv("PORT"),
                "user": os.getenv("USER"),
                "password": os.getenv("PASS"),
                "database": os.getenv("DB")
            },
        },
    },
    "apps": {
        "ticketeer": {
            "models": ["ticketeer.database.models", "aerich.models"],
            "default_connection": "ticketeer",
        }
    }
}

and just like that, the bot will now be configured to use PostgreSQL. If you need to use a different database, please take a look at the official Tortoise ORM Documentation

ticketeer's People

Contributors

whoisconch 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.