Immortal
Is this the correct way to replace to replace a discord bot background service logger with Serilog?
https://paste.mod.gg/dblzdkrlozuv/0
I did see that there is an example of doing this on github however the example uses a console app instead of a worker service. And while this method seems to work from the messages that are in the console, it is doesn't allow me to use the Serilog methods so I have:
_logger.LogInformation("Bot starting...");
Instead of using the Serilog methods like so:
_logger.Information("Bot starting...");
Which makes me think this isn't the correct way to do this.6 replies
✅ Best practices regarding non-nullable property warnings?
Hi, In my Discord Bot project I get some warnings for example:
Non-nullable property 'Config' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
I understand what it means and why I get it but not sure if it's ok for me to ignore it or if it indicates bad practices so I should learn to write it better.
Here is my Program.cs file:
And I've attached the Bot.cs file contents because it's too long to be put in this message.
The warning also shows with the Client and Slash properties.
From looking online the best way would either be to use lazy initialization or a constructor but I have no clue which is best for my project so would like advice from more experienced people.
Thanks
45 replies
❔ Need help with discord command to toggle a task
So I'm trying to make a command that takes a user as an input and toggles a task that uses that user as an input parameter for the toggled task. So you do something like:
/ToggleTest user1
Then anytime user1 sends a message the bot will respond with "Test success"
Then you can do /ToggleTest user1 to toggle it off.
133 replies