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

CLI fit for a Framework #151

Open
VincentRPS opened this issue Mar 5, 2023 · 4 comments
Open

CLI fit for a Framework #151

VincentRPS opened this issue Mar 5, 2023 · 4 comments

Comments

@VincentRPS
Copy link
Member

VincentRPS commented Mar 5, 2023

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
Copy link
Member

Lulalaby commented Mar 5, 2023

Interesting proposal!

@BobDotCom
Copy link
Member

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

@VincentRPS
Copy link
Member Author

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

Changed it to perform within pyproject standards

@sairam4123
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants