Closes #241
Updates:
- Show if the user was kicked by [adding "Kicked" parameter to
MemberData](https://github.com/LabsDevelopment/Octobot/issues/241)
- Change `mctaylors-ru`'s `UserInfoBannedPermanently` string to be
different from `UserInfoBanned`
- Finally add `AppendPunishmentsInformation` method to avoid Cognitive
Complexity
- Use MemberData to check if the user was banned
- Rename variable `isMuted` to `wasMuted` to be consistent with other
variable names
---------
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
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>
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>
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>
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
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>
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.
This PR splits the extension methods contained in `Extensions.cs` into
separate classes in the `Octobot.Extensions` namespace. This was done
for multiple reasons:
1) The `Extensions.cs` violates SRP (Single Responsibility Principle) -
it takes upon itself every extension method for many types
2) Having a separate class for each extended type is a standard practice
- take a look at
[Remora.Discord](https://github.com/Remora/Remora.Discord/tree/main/Backend/Remora.Discord.Rest/Extensions)
or [osu!](https://github.com/ppy/osu/tree/master/osu.Game/Extensions)
3) Having all extension methods in one file makes it hard to find the
method you want
note: there are still instances of `IUser user` because I could not find
a better name for them
---------
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Updates in /random:
- Set default minimum number to 0.
- Show maximum & minimum numbers.
- Recolor & display a message when user tries to use exact same number in first and second fields for some reason.
- Mention user in small title.
- Automatically detect max & min numbers.
- Add `long` support.
- Show what default number is.
---------
Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
Signed-off-by: Apceniy <53149450+Apceniy@users.noreply.github.com>
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
Co-authored-by: Apceniy <53149450+Apceniy@users.noreply.github.com>
We're moving!
---------
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
- Added support for `MuteRole`, now if you add any role to this setting,
then try to mute a member, all his roles will be removed except for the
one you set in this setting.
- Fixed `/unmute`, that tried to set target's display name to unmute
reason.
---------
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
This PR closes #105
This PR fixes exceptions caused by changing a collection's contents
while it is being enumerated. This can often happen with Guild- and
MemberDatas. By using `ToArray()` on these global collections and using
it in the `foreach` loop, we create a new copy of the collection,
preventing any modification to it.
While this does introduce a lot of memory allocations, there is no
fixing that. Usually, the fix to these exceptions would be to convert
the `foreach` to a reverse-`for`. However, because indices cannot be
used on these collections, that is not possible.
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This PR adds autocomplete for setting keys in `/editsetting` slash
command. The usage of options provided by auto-complete is enforced
client-side.
Closes #97
Closes #95
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This PR renames commands `/settingslist` and `/settings` to
`/listsettings` and `/editsettings` respectively. This helps avoid
confusion and accidental use of the wrong command while conforming to a
common naming style, similar to remind commands.
cc @mctaylors wiki needs updating
---------
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Without this embed, if there are no reminders created by the user, the
bot will endlessly think because StringBuilder will be empty and normal
embed will not be shown.
This PR fixes EventEarlyNotification timestamp not displaying correctly
and also has some other changes:
- Add xmldocs for `/settingslist`'s `page` option in
SettingsCommandGroup.cs
- Add option description for `index` for `/delreminder`
- Some corrections of grammatical errors in Messages.tt-ru.resx
- Fix `ArgumentOutOfRangeException` in `/settingslist` that appears if
the user uses a negative integer in `page`
---------
Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
This PR closes #61.
This PR adds the `/listremind` command and the `/delremind` command. The
`/delremind` command requires an index to determine which reminder to
delete.
cc @mctaylors review embed design and feature experience
---------
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
GuildUpdateService is a service that contains way too many
responsibilities with everything strictly coupled to each other. The
code is buggy, hard to refactor and swallows errors. This prompted me to
make this PR, which splits it into three independant services:
- SongUpdateService (responsible for changing songs presence);
- MemberUpdateService (responsible for updating member datas: unbanning
users, adding the default role, sending reminders, filtering nicknames);
- ScheduledEventUpdateService (responsible for updating scheduled
events: sending notifications, automatically starting events).
All of these services and their methods use Results to push errors all
the way up in the stack, making sure no error is missed. To make logging
and debugging easier, an extension method for `ILogger` was created -
`LogResult`. The method checks if the result was successful or if its
failure was caused by a user or environment error before logging
anything - providing cleaner code and logs. `ExceptionError`s will also
have their exception stacktrace and type logged (except in Remora code).
This PR also fixes an issue that prevented banned users from being
unbanned when their punishment was over.
---------
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This PR backfills member data when a guild is loaded or a new member
joins it. The reason for that is some actions that happen on member tick
(default role grant, nickname filtering) would only occur if a member
had data related to them (due to being banned or setting a reminder). In
addition, the `.editorconfig` was updated with new inspections provided
by a new release of Rider, 2023.2
See explanations for some changes in comments.
---------
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>