This PR adds the base classes required for profiling code inside of
Octobot. The implementation of the profiler is similar to Minecraft,
however it is more detailed and provides per-event logs for each event.
This PR does not change any code to be profiled and this is intentional.
Changes required for profiling will come as separate PRs, one for
commands, one for responders, and one for background services.
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Title. idk why I didn't think of this before.
Also, GuildDataService is now properly registered as an IHostedService,
so it receives start & shutdown events. So this PR gets rid of the
workaround that was needed for save-on-shutdown to function
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Originally, these classes were services because I thought that all
DI-resolvable classes need to be services. However, this is not true, so
we can make these classes (notably Utility and GuildDataService) not
extend anything. `UtilityService` was renamed to `Utility` for
simplicity
---------
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
In this PR, I made it so that in the Author field instead of the
hardcoded name was the name of the Discord bot. This was done to match
the icon next to it in the same field.
Replaces #224
---------
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
ReSharper inspections have been updated, causing new warnings to appear
in the codebase. This time, the "Use collection expressions" inspection
has been enabled for usecases where the collection is not empty. This PR
fixes the check failures caused by this inspection.
In this PR, the behavior of the developer list display in /about has
been changed. Now, if a developer is not on the same server where the
/about command was executed, their username will have a link to their
GitHub profile.
---------
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
Bumps [DiffPlex](https://github.com/mmanela/diffplex) from 1.7.1 to
1.7.2.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/mmanela/diffplex/commits">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=DiffPlex&package-manager=nuget&previous-version=1.7.1&new-version=1.7.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
In this PR, I've added a "Report an issue" button and a few more
button-related changes:
- Add "Report an issue" button
- Add icon for "Octobot's source code"
- Rename `AboutTitleRepository` to `ButtonOpenRepository`
- Rename `OpenEventInfoButton` to `ButtonOpenEventInfo` to be consistent
with other language string names
- Rename `ColorsList.cs` to `Miscellaneous.cs`
- Add public const strings in `Octobot.cs` to get repository & issues links
---------
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
In this PR, I moved the repository link from the embed to a button in
/about command for better UI/UX
---------
Signed-off-by: Macintxsh <95250141+mctaylors@users.noreply.github.com>
This PR adds an extension method to make it easier to pass Result<Embed> to CreateMessageAsync
---------
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
Me and other .NET developers hold the stance that primary constructors
are not ready for production use, particularly with dependency
injection. There are debates regarding the styling of primary
constructors, but the bigger issue is that a primary constructor
parameter cannot be made `readonly` (which is crucial with dependency
injection). The inspection "Convert to Primary Constructor" was disabled
in ReSharper CLI when we updated to .NET 8, but the warning is still
present for ReSharper and Rider users. This PR disables this warning to
avoid developers accidentally using a primary constructor.
Changes:
- Use timestamps from
[Splatunes](https://splatoonwiki.org/wiki/Splatune_(Splatoon_Original_Soundtrack))
- Increase track count to 20
- Replace Calamari Inkantation 3MIX with OG Calamari Inkantation due to long
duration
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
In this PR, I have added StringBuilder extensions to avoid `.Append`
reuse such as `.Append("- ").AppendLine()`
Closes #205
---------
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
Closes #183
In addition to the fix, now no error will be returned if the message
doesn't exist in the cache as that is a (relatively) normal occurrence
and isn't an indicator of an issue with the bot or its configuration
Closes #184
This PR makes issue templates less annoying by removing some unnecessary
text boxes and allowing issues to be created without the use of a
template.
In the Bug Report template, `Expected Behavior` and `Actual Behavior`
were combined into one, and the `Known Workarounds` section was removed
In the Feature Request template, `Considered Alternatives` was also
removed.
This PR fixes an issue that is currently causing CI to fail in all pull
requests:
`Notice: "[CA1854] Prefer a 'TryGetValue' call over a Dictionary indexer
access guarded by a 'ContainsKey' check to avoid double lookup" on
/home/runner/work/Octobot/Octobot/src/Services/Update/ScheduledEventUpdateService.cs(107,4168)`
The issue is resolved by following the advice mentioned in the notice.
Bumps
[JetBrains.Annotations](https://github.com/JetBrains/JetBrains.Annotations)
from 2023.2.0 to 2023.3.0.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="e00a7e4a16"><code>e00a7e4</code></a>
2023.3</li>
<li><a
href="c2392bcd88"><code>c2392bc</code></a>
2023.3-eap4</li>
<li><a
href="a37383560a"><code>a373835</code></a>
Merge pull request <a
href="https://redirect.github.com/JetBrains/JetBrains.Annotations/issues/24">#24</a>
from estrizhok/main</li>
<li><a
href="938031843a"><code>9380318</code></a>
Allow NoReorderAttribute to be used for partial classes to indicate
which par...</li>
<li><a
href="0dea5ba41c"><code>0dea5ba</code></a>
Merge pull request <a
href="https://redirect.github.com/JetBrains/JetBrains.Annotations/issues/23">#23</a>
from mr146/main</li>
<li><a
href="6565d31d95"><code>6565d31</code></a>
fixes</li>
<li><a
href="a3284206c7"><code>a328420</code></a>
Added IgnoreSpellingAndGrammarErrorsAttribute and
AspMinimalApiImplicitEndpoi...</li>
<li><a
href="53cd720d72"><code>53cd720</code></a>
2023.3.0-eap2</li>
<li><a
href="0a43548b16"><code>0a43548</code></a>
Merge pull request <a
href="https://redirect.github.com/JetBrains/JetBrains.Annotations/issues/22">#22</a>
from tutushkin/main</li>
<li><a
href="802aa5f772"><code>802aa5f</code></a>
Fixed after review,</li>
<li>Additional commits viewable in <a
href="https://github.com/JetBrains/JetBrains.Annotations/compare/v2023.2.0...2023.3">compare
view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=JetBrains.Annotations&package-manager=nuget&previous-version=2023.2.0&new-version=2023.3.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This PR fixes an issue that caused REST errors to occur in
MemberUpdateService if the bot tries to interact with a member it can't
interact with. The issue is fixed by returning from TickMemberDataAsync
early if the member cannot be interacted with. An error message was
planned, but it requires adding a lot of services and severely
increasing the complexity. Contributors may feel free to add one if they
deem so necessary.
This PR replaces usages of the `FeedbackService` implementation with the
`IFeedbackService` interface. Using concrete implementations breaks the
whole point of dependency injection, so it doesn't make sense to use
them
Previously, any errors in guild data load will cause the bot to be
unusable in that guild. It didn't help that the end users had no
information that something was wrong! Now, any errors will be logged
better (with the full path to the file that couldn't be loaded), and the
users will receive a message saying that functionality is degraded
The old way to save objects was to serialize them directly into streams
opened by `File#Create`. This can cause problems if the serialization
isn't completed, because `File#Create` overwrites the file with an empty
one on the spot. Now, objects are first deserialized into a temporary
file, then the original is replaced by the temporary, then the temporary
is deleted.
Errors during guild data load would sometimes cause the bot to replace
the corrupted file with a default one whenever a save is triggered. Now,
guilds with load errors won't have their data saved to aid in debugging
---------
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Signed-off-by: mctaylors <mctaylxrs@outlook.com>
With this PR, whenever command execution fails, the user will get an
error message with details of the error that can be passed on to
developers
An unrelated minor change: errors caused by task cancellations will no
longer be logged
---------
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Signed-off-by: mctaylors <mctaylxrs@outlook.com>
_There are times when you want to be sure of what you've destroyed._
Therefore, in this PR I added the output of the text of the deleted
reminder along with its position in the list, because you can make a
mistake with deleting a reminder and forget about what you needed to be
reminded about.
---------
Signed-off-by: mctaylors <mctaylxrs@outlook.com>
This PR fixes an issue that prevented scheduled event status updates
from running again if they failed. This happened because, before each
update, the events would be synchronized. The `ScheduleOnStatusUpdated`
field would be set even if it's already `true`, which will cause it to
be set to `false` for unsuccessful updates. The issue is fixed by
surrounding the field set call with a condition that will prevent
setting the field from `true` to `false`
Closes #164
This PR adds an optional argument to `/clear` - `author` of type User.
If the user is specified, only messages sent by that user will be
cleared. Simple as that.
Closes #163
Discord's API sucks a lot. You ask it for a member, but it won't give
you a member. This is why this PR updates the
`GetEventNotificationMentions` method used to determine what roles and
users should get pinged for a scheduled event. Previously, the bot asked
Discord to provide the member for each subscriber to determine whether
or not they have the event notification role (to avoid pinging people
personally when the role would already ping them). With this pull
request, the bot uses MemberData, it's own member storage, for that
purpose (if you're wondering why, refer to the first two sentences)