Pycord-Development / pycord-next

Go Build Apps - without worrying about speed, reliability, or simplicity.
https://v3-docs.pycord.dev
MIT License
92 stars 12 forks source link

CLI fit for a Framework #151

Open VincentRPS opened 1 year ago

VincentRPS commented 1 year ago

This is something still under consideration, and a wide variety of things will have to be asserted, generalized, and decided before any work or other such may be put into a PR for this.

The goal of v3 is to excel the reach of developers and allow them to reach higher goals. faster.

As with that, we will not only be giving a return to v2's CLI but expanding it and enhancing it to a degree never seen with Discord libraries before.

The CLI will expand Pycord from a library, to a framework for Discord bots.

This will be sectioning into commands, and some points may not be as detailed as to be fleshed out later.

pycord

The base command.

Returns the normal banner without bot information (unless inside a bot dir.)

pycord new

Create a new bot for the framework.

This will form something like the following:

.env - Environment Configuration
pyproject.toml - Configuration
bot.py - Main bot file
src / - Source code files of this bot
  gears/ - Gears which are automagically loaded
     ...

Configuration

# all shown here are defaults

[tool.pycord]
# allows deprecation and new versions of the config file without breaking developers' config.
edition = "2023.0.0"

[tool.pycord.bot]
# bot.py's bot variable
bot_var = "bot"
# the directory for gears to reside in
gears_dir = "gears"
# load environment variables before startup
load_env = true
# the name of the token's environment variable
token_name = "TOKEN"

[tool.pycord.cluster]
# whether clustering is disabled or not
enabled = false
# 0 means just use the amount of shards
total = 0
clusters = 1

[tool.pycord.dev]
# whether to cluster in dev mode or not
cluster = false

pycord start / pycord run

Starts the bot permanently either using .run, or .cluster.

NOTE: would not resync files on changes.

pycord dev

Starts the bot in a development mode. In this mode, files are watched and on any change the bot restarts that specific Gear.

Lulalaby commented 1 year ago

Interesting proposal!

BobDotCom commented 1 year ago

If we're supporting toml, we should allow pyproject.toml to be used for config

VincentRPS commented 1 year ago

If we're supporting toml, we should allow pyproject.toml to be used for config

Changed it to perform within pyproject standards

sairam4123 commented 1 year ago

Hey, I really think it's a better idea to use the toml library when dealing with pyproject.toml files instead of making your own. Creating your own pyproject.toml can cause some issues, especially if you're working with poetry projects. You see, when you create a poetry project, it generates its own pyproject.toml file, and deleting it can lead to some bad stuff happening. So, it's best to stick with the toml library for a smoother experience. Hope that clears things up!