This PR fixes an issue where the `LogResultStackTrace` method would log
stack traces for results that encountered an error due to a cancelled
operation/task. The `LoggerExtensions` class already skipped
`TaskCanceledException`s, but didn't skip `OperationCanceledException`s
(which is a parent of `TaskCanceledException`).
The patch specifically does not affect *inner* results which are
canceled. Skipping logging these could hide the true cause of an error
which appears important
This PR makes sure that a cancellation token is never *required* to use
an `async` method. This does not affect user experience in any way, only
code quality.
---------
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
In order to determine who deleted a message, Octobot fetches the audit
log with a filter on the action "Message Delete", gets the latest entry
and uses its author if the timestamps roughly match. However, if the
filter returns no entries (as in, no message deletions are present in
the audit log), `Single()` will throw an exception with the message
`Sequence contains no elements`. To fix this, this PR replaces
`Single()` with `SingleOrDefault()` and adds a null-check on `auditLog`
in the form of a pattern access
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Closes #311
This change fixes unexpected behavior when a member's Discord roles get
desynchronized with their MemberData roles (e.g. when a member gets
role-muted). In addition this results in less API requests being made
when there are cache misses (commands should execute faster)
---------
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Apparently the `[UsedImplicitly]` annotation suppresses the "Class has
no inheritors and can be marked sealed" warning. Cool to know.
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
who tf thought that putting 1234915912 methods responsible for 23981
commands in a single class was a good idea???????
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
1. The root namespace was changed from `Octobot` to
`TeamOctolings.Octobot`:
> DO prefix namespace names with a company name to prevent namespaces
from different companies from having the same name.
2. `Octobot.cs` was renamed to `Program.cs`:
> DO NOT use the same name for a namespace and a type in that namespace.
3. `IOption`, `Option` were renamed to `IGuildOption` and `GuildOption`
respectively:
> DO NOT introduce generic type names such as Element, Node, Log, and
Message.
4. `Utility` was moved out of the `Services` namespace. It didn't belong
there anyway
5. `Program` static fields were moved to `Utility`
6. Localisation files were moved back to the project source files. Looks
like this fixed `Message.Designer.cs` code generation
---------
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>