-
Notifications
You must be signed in to change notification settings - Fork 34
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
base: 5.0.0
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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?
now it does |
public static async Task Main(string[] args) | ||
{ | ||
ConfigurationBuilder configurationBuilder = new(); | ||
configurationBuilder.AddEnvironmentVariables(""); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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") ?? |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this async
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OoLunar why
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ValueTask
s.
There was a problem hiding this comment.
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
Please revert. We'll delete when CNext is officially deprecated |
This reverts commit c3aa229.
reverted |
{ | ||
ConfigurationBuilder configurationBuilder = new(); | ||
// you can also use environment vars, just uncomment this | ||
// configurationBuilder.AddEnvironmentVariables(""); |
There was a problem hiding this comment.
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
i hate cnext.
basics done only for now, also updated dependencies for all projects for now