GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Switch to Commands for basic example by inftord · Pull Request #13 · DSharpPlus/Example-Bots Conversation
|
now it does |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| public static async Task Main(string[] args) | ||
| { | ||
| ConfigurationBuilder configurationBuilder = new(); | ||
| configurationBuilder.AddEnvironmentVariables(""); |
There was a problem 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
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| { | ||
| DiscordClient client = new(new DiscordConfiguration() | ||
| { | ||
| Token = configuration.GetValue<string>("discord:token") ?? |
There was a problem 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
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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"
}
}
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| }); | ||
| IServiceProvider serviceProvider = serviceCollection.BuildServiceProvider(); | ||
|
|
||
| DiscordClient client = await serviceProvider.GetRequiredService<Task<DiscordClient>>(); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
why is this async
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
asked by lunar in last review
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@OoLunar why
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Please revert. We'll delete when CNext is officially deprecated |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This reverts commit c3aa229.
|
reverted |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| { | ||
| ConfigurationBuilder configurationBuilder = new(); | ||
| // you can also use environment vars, just uncomment this | ||
| // configurationBuilder.AddEnvironmentVariables(""); |
There was a problem 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
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.