Skip to content

Switch to Commands for basic example #13

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

Open
wants to merge 7 commits into
base: 5.0.0
Choose a base branch
from
Open

Conversation

themonarchoftime
Copy link
Member

@themonarchoftime themonarchoftime commented Feb 1, 2024

i hate cnext.
basics done only for now, also updated dependencies for all projects for now

Copy link
Member

@OoLunar OoLunar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM, just a few updates to the conventions I used. Does this PR delete the CNext examples?

@themonarchoftime themonarchoftime changed the title Switch to Commands for examples Switch to Commands for basic example Feb 1, 2024
@themonarchoftime themonarchoftime marked this pull request as ready for review February 2, 2024 03:17
@themonarchoftime
Copy link
Member Author

Generally LGTM, just a few updates to the conventions I used. Does this PR delete the CNext examples?

now it does

public static async Task Main(string[] args)
{
ConfigurationBuilder configurationBuilder = new();
configurationBuilder.AddEnvironmentVariables("");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is, at a glance, rather questionable. we should also probably encourage a config file to at least be considered

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Config files... For an example bot? The purpose of an example bot is to demonstrate how to do XYZ while being easy to setup and run.

Also I think this might throw, if it hasn't been tested

{
DiscordClient client = new(new DiscordConfiguration()
{
Token = configuration.GetValue<string>("discord:token") ??
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider renaming "discord" in the eaxmples to "example-bot", to make clear what this identifier is

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's grabbing the discord token from the discord property:

{
   "discord":
   {
        "token": "invalid"
    }
}

});
IServiceProvider serviceProvider = serviceCollection.BuildServiceProvider();

DiscordClient client = await serviceProvider.GetRequiredService<Task<DiscordClient>>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this async

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asked by lunar in last review

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OoLunar why

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#13 (comment)
i think this comment is meant which was to a different part of the code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is intended. Adding processors is an asynchronous operation. Encouraging .GetAwaiter().GetResult() goes against everything I've worked on within the lib, especially when it's done on ValueTasks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would do the whole setup outside the AddSinglton and then add the client

@OoLunar
Copy link
Member

OoLunar commented Feb 2, 2024

Generally LGTM, just a few updates to the conventions I used. Does this PR delete the CNext examples?

now it does

Please revert. We'll delete when CNext is officially deprecated

@themonarchoftime
Copy link
Member Author

reverted

{
ConfigurationBuilder configurationBuilder = new();
// you can also use environment vars, just uncomment this
// configurationBuilder.AddEnvironmentVariables("");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// right click on config.json, click properties, and in Copy to Output Directory select Copy if newer

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

Successfully merging this pull request may close these issues.

5 participants