Commit graph

129 commits

Author SHA1 Message Date
e6f53b13f0
Split extension methods into separate classes (#161)
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
2023-10-12 15:37:25 +00:00
4d526ad32f
Sanitize scheduled event names (#159)
In this PR, I added `Markdown.Sanitize` for every `scheduledEvent.Name`
and `eventData.Name`. That means, every title in scheduled event embeds
will be sanitized.

I did that because in scheduled event list event title displays only as
sanitized string.

Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
2023-10-12 10:56:24 +00:00
e21cefd79d
Use link button for created event message (#158)
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
2023-10-11 22:16:52 +03:00
8b659a6582
Rename Reminder message to Reminder text (#157)
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
2023-10-06 14:20:18 +00:00
d1e3558bc6
/remind: Switch away from zero-based numbering and rename index (#155)
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
2023-10-06 14:17:48 +00:00
a70c228bc4
Change reminders sorting in /listremind (#156)
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
2023-10-06 16:12:36 +03:00
4748c5de2c
Rename /showinfo to avoid confusion with /guildinfo (#153)
Depends on #152

Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
2023-10-06 15:35:08 +03:00
72f728323e
Add /guildinfo (#152)
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
2023-10-06 15:23:45 +03:00
6f1e543edb
Correct illegal nickname characters regex (#151)
Apparently there are non-letter characters in between A-Z and a-z
2023-10-04 21:55:39 +05:00
2ab020a2b4
Change IUser variable and parameter names to be less confusing (#149)
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>
2023-10-04 15:21:10 +00:00
f7b59c173f
Use one common method in /mute (#145)
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
2023-10-04 13:27:05 +00:00
395a656fc2
Edit log output in GuildLoadedResponder (#147)
Depends on #146

Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
2023-10-04 13:01:26 +00:00
68d1534b26
Unload guild datas when they become unavailable (#146)
Closes #120

---------

Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
2023-10-04 15:58:56 +03:00
777dbc6eec
Update /random (#138)
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>
2023-10-04 15:32:54 +03:00
7cf200d8de
Fix /unmute not checking if the target is muted (#143)
Closes #142

---------

Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
2023-10-03 17:25:28 +03:00
bae92fc84b
Remove unused messages (#144) 2023-10-03 13:27:27 +00:00
413b8a4781
Add /timestamp (#140)
Original idea from @Octol1ttle

---------

Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
2023-10-03 15:07:41 +03:00
d837745b11
Add string interpolation for SongUpdateService (#139)
I added a string interpolation for SongUpdateService for
better activity status configuration. So now you can add some characters
if you want, or even swap the song title and author.

Also songs are now displaying in Splatoon™ style.

---------

Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
2023-10-02 17:41:43 +03:00
186eb65eb1
Add MORE Splatoon™ songs that I liked (#135)
Song list:
- Off the Hook - Muck Warfare — [source](https://youtu.be/Se3AuyS-gTo)
- Off the Hook - Acid Hues — [source](https://youtu.be/RoBhJth2VZE)
- Off the Hook - Shark Bytes — [source](https://youtu.be/YrGSrxDRAXU)
- DJ Octavio feat. Squid Sisters & Deep Cut - Calamari Inkantation 3MIX
— [source](https://youtu.be/_TE22RCxCi4)
- Splatoon - Ink Me Up —
[source](https://www.youtube.com/watch?v=LrsAKUnb3Qg)

---------

Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
2023-10-01 10:57:25 +03:00
9323e891a1
Remove all non-Splatoon songs (#137) 2023-10-01 12:04:00 +05:00
6247a55a35
Use Snowflake#Empty extension method instead of '== 0' checks (#134) 2023-09-30 15:53:05 +00:00
e283ba5a6d
Don't forget to remove scheduled event data when notification channel is not set (#133)
This PR fixes an issue that caused data of completed/cancelled scheduled
events to never be collected if EventNotificationChannel wasn't set
2023-09-30 20:50:58 +05:00
f3da876d6d
Run scheduled event updates synchronously to avoid a rate limit error (#132)
This PR attempts to fix this error:
https://paste.gg/p/anonymous/358d5b1b80b44011b7afe5007270b175 based on
the assumption that the error is caused by a race condition affecting
the rate limit tracking code in Remora.Discord
2023-09-30 20:41:46 +05:00
e073c5a572
Synchronize events only on sch. event updates (#131)
This PR moves all code related to synchronization of scheduled events to
ScheduledEventUpdateService. Just like #130, this reduces possible
points of failures, maintenance burden and reliance on gateway events
2023-09-30 15:38:52 +00:00
d713b977f0
Synchronize roles only on member data updates (#130)
This PR makes it so that roles in MemberData are updated only in
MemberUpdateService. This reduces possible points of failures,
maintenance burden and reliance on gateway events
2023-09-30 20:36:55 +05:00
5d278883d5
Synchronize scheduled events on sch. events tick (#129)
Because the Discord API sucks at providing data when needed, this PR
makes it so that events are synchronized every tick instead of on
gateway events. This fixes an issue where the bot won't know about a
scheduled event if it was created before the bot was started
2023-09-30 20:25:22 +05:00
804bcd6e68
Rebrand to Octobot (#128)
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>
2023-09-30 18:58:32 +05:00
2e2f50908e
Add /random (#127)
It could have been a milestone PR, but of course I made a mistake
_somewhere_.

---------

Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
2023-09-29 16:22:44 +00:00
04897cab20
Redesign embeds (#123)
TODO before merging:

- [x] /about
- [x] /ban
- [x] /unban
- [x] /kick
- [x] /mute
- [x] /unmute
- [x] /remind
- [x] /listremind
- [x] MessageEditedResponder
- [x] MessageDeletedResponder

---------

Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
2023-09-29 18:36:16 +03:00
d5c4340210
Add some Splatoon™ songs that I liked (#125)
- Deep Cut - Big Betrayal —
[source](https://www.youtube.com/watch?v=BMy7gvl3bXE)
- Squid Sisters - Tommorrow's Nostalgia Today —
[source](https://www.youtube.com/watch?v=S8VYi2ODeF4)
- Deep Cut - Anarchy Rainbow —
[source](https://www.youtube.com/watch?v=DtMOAvOWTvY)
- Squid Sisters - Liquid Sunshine —
[source](https://www.youtube.com/watch?v=EZx61kSObTIg)
- Damp Socks feat. Off the Hook - Candy-Coated Rocks —
[source](https://youtube.com/watch?v=_-nyDSANZt4)
- H2Whoa - Aquasonic —
[source](https://www.youtube.com/watch?v=t2sNgpFgFC0)
- Yoko & the Gold Bazookas - Ska-Blam! —
[source](https://www.youtube.com/watch?v=9pHIwuTHcbc)

---------

Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
2023-09-29 15:50:15 +03:00
0f916d46de
Add /showinfo (#122)
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-09-29 15:31:45 +03:00
4e4e60f845
Fix mute role returning when rejoining server (#121)
Closes #117

---------

Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-09-28 14:26:58 +03:00
e907930623
Fix auto-unban and auto-unmute always triggering (#119)
Flipping `>` to `<=` changed null handling semantics within the
operator, causing the unban/unmute code to always run

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-09-28 00:07:46 +05:00
906bfd07e8
Skip refreshing roles if the member is role-muted (#118)
Closes #116
2023-09-27 18:27:28 +00:00
f2db7f016c
Fix UnknownMember warning flood (#115)
If a user was muted using the `MuteRole` method and then banned, the
UnknownMember warning will flood your logs when `DateTimeOffset.UtcNow >
data.MutedUntil` becomes true, because there is no user in the server to
unmute.

---------

Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
2023-09-27 21:25:49 +03:00
1ab5a640a9
Set MemberData.BannedUntil to null in /unban (#114)
Please keep `MemberData` clean of unnecessary values.

---------

Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
2023-09-27 12:47:43 +03:00
3a3865ba3d
Add /resetsettings (#111)
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-09-22 20:23:08 +03:00
d6e1468f3e
Disable the logging of SaveAsync due to spam in the logs (#113)
Closes #112

Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
2023-09-22 20:09:22 +03:00
81099fad4c
Move all GuildData to one folder (#110)
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>
2023-09-22 15:33:14 +03:00
1e8b7e5373
Add mute role support & fix /unmute (#109)
- 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>
2023-09-21 20:16:09 +03:00
b796b885a1
Change logo CDN (#108)
Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
2023-09-19 06:23:02 +05:00
1225ff83d4
Add MORE music to the bot (#107)
Music added:
- EDWXRDX - CONSCIENCE (2:16)
- dontleaveme - afterward (2:29)
- Clams Casino - I'm God (4:37)
- Jupyter - Starboy (2:35)
- VØJ, Narvent - Memory Reboot (3:29)

Timecode source: [Yandex.Music](https://music.yandex.ru)

---------

Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
2023-09-18 16:24:55 +05:00
438ecfb41b
Force enumeration of global collections before using them (#106)
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>
2023-09-12 16:28:46 +03:00
31968837e5
Fix JSON corruption when saving (#100)
This PR fixes an issue that caused guild data JSON files to be corrupted
upon saving. As it turns out `File.OpenWrite(string)` does not clear the
file before writing to it. That means, if a file contains `{"MyKey":
"MyValue"}` and I write `{}` to it using `File.OpenWrite(string)`, the
contents of the file will be `{}MyKey": "MyValue"}`. This is a malformed
JSON and will cause an error upon next bot startup.

In addition, this PR blacklists the `File.OpenWrite` method using
`CodeAnalysis/BannedSymbols.txt` to prevent its accidental use in the
future.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-08-22 07:46:57 +00:00
5831f5205c
Add autocomplete for /editsettings setting keys (#98)
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>
2023-08-22 07:45:46 +00:00
37ebf0ffa0
Add periodic guild data saving (every 5 minutes) (#99)
This PR adds a BackgroundGuildDataSaverService which will save all guild
data to disk every 5 minutes using a PeriodicTimer.

Closes #96

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-08-22 07:44:05 +00:00
324f455404
Rename settings commands (#94)
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>
2023-08-22 02:18:58 +03:00
5937fae552
Change organization name references from TeamOctolings to LabsDevelopment (#93)
we are moving!

(6 commits because I was too lazy to open the IDE)

---------

Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
2023-08-20 20:27:16 +00:00
0bf61ecf39
Add a JSON deserialization constructor for ScheduledEventData (#92)
This PR fixes an exception that would occur when deserialization of
ScheduledEventData would be attempted. The exception is fixed by
providing a constructor containing all properties and adding the
`[JsonConstructor]` attribute.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-08-15 05:23:58 +00:00
4252613dd3
Fix various issues with ScheduledEventUpdateService (#89)
This PR closes #85.

This PR fixes many issues related to scheduled events. Most importantly,
scheduled events that are no longer present in the guild, but still have
data related to them, won't be left rotting.

This requires deletion of `ScheduledEvents.json` files in all guilds.
Maybe I'll start writing datafixers one day...

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-08-14 13:24:22 +00:00
da2a88246c
Add failed embed for /listremind (#88)
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.
2023-08-14 07:45:56 +00:00
87dbb07dec
EventEarlyNotification timestamp bugfix and other changes (#84)
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>
2023-08-12 20:19:07 +00:00
d0d663d2bb
Fix a crash in scheduled event early notification (#83)
This PR fixes a fatal crash that occurs when the bot tries to send an
early notification for a scheduled event. An exception is thrown by
`string#Format` when the argument list provided doesn't match the
argument list in the template. This is fixed by correcting the template
and the argument list

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-08-12 14:18:30 +00:00
488a1eec0c
Add /listremind and /delremind (#82)
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>
2023-08-12 13:54:51 +00:00
cac3ee9bf7
Scheduled event update bugfixes (#81)
This PR fixes the following bugs in ScheduledEventUpdateService:
- When a scheduled event is first added into ScheduledEventData, its
status update code will be skipped. This results in some messages not
being sent to the EventNotificationChannel
- When the status update code returns an unsuccessful Result, the status
in ScheduledEventData will still be updated, meaning that the code will
not retry.

---------

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-08-12 13:47:14 +00:00
f260681b39
Split GuildUpdateService into separate services (#80)
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>
2023-08-05 18:02:40 +00:00
e9f7825e4a
Backfill member data when a guild is loaded or a new member joins it (#77)
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>
2023-08-04 13:52:54 +00:00
d023033ed4
Fix roles not returning on rejoin if welcome messages were disabled (#78)
This PR fixes an issue where, if the `PublicFeedbackChannel` wasn't set
or the welcome message was disabled, `GuildMemberJoinedResponder` would
`return` early, causing roles to not be granted back if
`ReturnRolesOnRejoin` was enabled, by moving the `if return` after the
code that grants back roles

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-08-03 20:34:01 +00:00
c9a7fb79ab
Log guild setting changes to PrivateFeedbackChannel (#79)
This PR makes the bot log guild settings to the Private Feedback
Channel. The functionality was present in pre-Remora Boyfriend, but was
missing afterwards, so I will call this a bug, making this PR a bugfix.

cc @mctaylors - embed design needs review

![image](https://github.com/TeamOctolings/Boyfriend/assets/61277953/5680f0d6-82fc-4c0e-b4f0-815b082997ec)

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-08-03 20:32:38 +00:00
84e730838b
Add a new .editorconfig and reformat code (#76)
*I'll start working on features and bugfixes after this PR, I promise*
very short summary:
- no more braceless statements
- braces are on new lines now
- `sealed` on everything that can be `sealed`
- no more awkwardly looking alignment of fields/parameters
- no more `Service` suffix on service fields. yeah.
- no more `else`s. who needs them?
- code style is now enforced by CI

---------

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-08-02 20:51:16 +00:00
4cb39a34b5
Add logging to file (#75)
This PR adds the package `Serilog.Extensions.Logging.File` to add
logging to file. I decided this was necessary after the bot unexpectedly
went down in a tmux session, leaving no traces behind.


![image](https://github.com/TeamOctolings/Boyfriend/assets/61277953/b6ff9e69-b370-4844-b552-db4a39933f62)

---------

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-08-02 13:25:41 +00:00
940f2e64a0
Add soundtracks from different games (#74)
This PR adds some soundtracks from five different games to the bot's
listening activity.

List of soundtracks added:
- Jukio Kallio, Daniel Hagström - Fall 'n' Roll (Fall Guys)
- SCATTLE - Hypertension (Super Meat Boy)
- KEYGEN CHURCH - Tenebre Rosso Sangue (ULTRAKILL)
- Chipzel - Swing Me Another 6 (Dicey Dungeons)
- ~Floex - The Glasshouse With Butterfly (Machinarium)~
- Noisecream - Mist of Rage (My Friend Pedro)
2023-07-30 09:29:08 +00:00
f47ebe81c5
Do not wrap result errors when returning them (#73)
This PR removes the wrapping of in-house created result errors with
`Result.FromError` (I did not know this was possible until today, lol),
which reduces code verbosity and makes it easier to read, and replaces
`ArgumentNullError` with `ArgumentInvalidError` when retrieving IDs from
a command context, which, in my opinion, is more correct.

---------

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-28 16:58:55 +00:00
a6df26af67
Resolving issues on #65 (#72)
Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
2023-07-26 18:07:05 +00:00
8f95e4cd2c
Replace "ToLower" with "ToLowerInvariant" to fix a missed warning (#71) 2023-07-25 16:20:09 +00:00
05fd343dce
Improved /settingslist + fixed /settings pt.1 (#65)
This PR is mainly aimed at improving /settingslist and fixing /settings

List of things to do before merging:
- [x] #62
- [x] Add the pages feature to /settingslist
- [x] Add bullets like these ->
![](https://github.com/TeamOctolings/Boyfriend/assets/95250141/fdf1a3b8-bb64-473d-9f57-bc6e34812811)

And since the development has already been taking more than 2 days, I
suggest splitting the PR into 2 parts.

List of other things that will be in the future PR:
- mctaylors#1
- Fix bot not answering when an invalid setting is specified in
/settings
- Options list for /settings

---------

Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
2023-07-25 19:53:11 +05:00
7b722a45cb
Rename users who attempt to hoist themselves (#53)
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Signed-off-by: mctaylors <95250141+mctaylors@users.noreply.github.com>
Co-authored-by: nrdk <neroduck@vk.com>
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-24 19:51:05 +03:00
dependabot[bot]
abce09f26d
Bump Remora.Discord.Interactivity from 4.5.0 to 4.5.1 (#68)
Bumps Remora.Discord.Interactivity from 4.5.0 to 4.5.1.

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-24 16:57:41 +05:00
b4748a18c5
Add Color and Public parameters to LogActionAsync (#64)
This PR adds the `color` and `isPublic` parameters to
`UtilityService#LogActionAsync`. Previously, all embeds would be sent in
both public and private feedback channels with the green embed color. It
is now possible to change these fields, allowing for usage of the red
color in punishment commands and allowing to hide the result of `/clear`
from public eyes.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-23 23:07:36 +03:00
e31a9f73fa
Remove non-numbers from SnowflakeOption inputs (#63)
This PR allows passing mentions as an input to SnowflakeOption by
removing non-number characters from the input string.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-23 23:06:00 +03:00
27b8f15e3b
Force maximum Cognitive Complexity via InspectCode (#60)
This PR uses a new feature of the InspectCode action: extensions. By
adding the `Cognitive Complexity` extension, InspectCode can provide
warnings and force the contributors to follow standards regarding
complex methods. This functionality was previously provided by
CodeFactor, but it is no longer used. Here's the full changelog of this
PR:
- Allowed Actions to run on push for any branch, not just `master`;
- Added `Cognitive Complexity` plugin for InspectCode;
- Significantly reduced complexity of KickCommandGroup, MuteCommandGroup
and GuildUpdateService

---------

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-21 08:54:52 +05:00
4624b59a8a
Reduce method complexity of /clear (#56)
Depends on #54

This PR reduces the method complexity of
`ClearCommandGroup#ClearMessagesAsync` by doing the following:
- Splitting the command method into 2 parts: ExecuteClear and
ClearMessagesAsync. The former will check all the needed results and
will pass the outputs into the latter;
- Using the recently extracted method `UtilityService#LogActionAsync` to
log deletion of messages.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-20 10:44:07 +03:00
daa1dd4184
General fixes (#54)
Depends on #55

These changes are really small and I don't know how to reasonably split
them into multiple PRs, but here's the changelog:
- The result of the `UtilityService#LogActionAsync` call in
`BanCommandGroup#BanUserAsync` is no longer ignored and it's errors will
now prevent feedback from being sent;
- Converted `if` statement to a `return` with ternary in
`LanguageOption`;
- Slightly decreased method complexity of
`MessageDeletedResponder#RespondAsync` by cleverly using Results;
- Changed the order of parameters for `UtilityService#LogActionAsync` to
flow better;
- Removed the exemption for `ConvertIfToReturnStatement` for
InspectCode.

---------

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-20 07:36:21 +00:00
685688bbe8
Reduce method complexity of UtilityService#CheckInteractionsAsync (#55)
This PR reduces method complexity in
`UtilityService#CheckInteractionsAsync` by splitting the method into two
parts, similar to `/ban` and `/unban`. Additionally, it converts the
last `if` statement to a `return` with ternary.

After this is merged, status checks on #54 should succeed and that PR
should be merged.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-20 07:25:03 +00:00
e2bf083189
Reduce method complexity in /ban, /unban and some other commands (#50)
This PR does numerous things to reduce method complexity:
- Created an extension method
`FeedbackService#SendContextualEmbedResultAsync`, which directly takes a
`Result<Embed>` and checks it once in the extension method instead of
multiple times in all commands;
- Split the command methods for `/ban` and `/unban` into 2 parts:
`Execute(Un)Ban` and `(Un)BanUserAsync`. The former will check all the
needed results and will pass the outputs into the latter;
- Extracted the method for logging an action into Private- and
PublicFeedbackChannels. It now resides in UtilityService. Right now,
only `/ban` and `/unban` make use of that method;
- Created an extension method `Snowflake#EmptyOrEqualTo`, that combines
the task of checking if a Snowflake is empty and checking if that
Snowflake is equal to another Snowflake.

Similar changes will be made to other command groups in future PRs. This
is not done here to make the reviewing process easier.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-19 21:08:44 +00:00
c825848d7e
Split error logging events into separate files (#51)
This PR splits `LoggingPreparationErrorEvent` and
`ErrorLoggingPostExecutionEvent` classes into separate files and puts
these files in a separate namespace: `Boyfriend.Commands.Events`. This
makes these classes easier to find and distinguish from commands groups.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-19 21:01:53 +00:00
f75926c604
Do not allow certain commands to be used in DMs (#49)
This PR prevents usage of `/about`, `/ping` and `/remind` inside DMs.
While it may look like these commands do not require a guild attached to
them, the language system depends on having a guild to fetch settings
from, so it is not possible to use these commands in DMs.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-18 14:18:35 +00:00
c6dd3727c3
The Milestone Commit (#48)
mctaylors:
- updated readme 7 times (and only adding new logo from /about)
-
[removed](aeeb3d4399)
bot footer from created event embed on the second try
-
[changed](4b9b91d9e4)
cdn from discord to upload.systems

Octol1ttle:
- Guild settings code has been overhauled. Instead of instances of a
`GuildConfiguration` class being (de-)serialized when used with listing
and setting options provided by reflection, there are now multiple
`Option` classes responsible for the type of option they are storing.
The classes support getting a value, validating and setting values with
Results, and getting a user-friendly representation of these values.
This makes use of polymorphism, providing clean and easier to use and
refactor code.
- Gateway event responders have been split into their own separate
files, which should make it easier to find and modify responders when
needed.
- Warning suppressions regarding unused and never instantiated classes
have been replaced by `[ImplicitUse]` annotations provided by
`JetBrains.Annotations`. This avoids hiding real issues and provides a
better way to suppress false warnings while being explicit.
- It is no longer possible to execute some slash commands if they are
run without the correct permissions
- Dependencies are now more explicitly defined

neroduckale:
 - Made easter eggs case-insensitive

---------

Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
Co-authored-by: nrdk <neroduck@vk.com>
2023-07-18 12:25:02 +00:00
3eb17b96c5
Tidy up project structure, fix bug with edit logging (#47)
The project structure has been changed because the previous one had
everything in 1 folder. From this PR onwards, the following is true:
- The source code is stored in `src/`
- `*.resx` and `Messages.Designer.cs` is stored in `locale/`
- Documentation is stored on the wiki and in `docs/`
- Miscellaneous files, such as dotfiles, are stored in the root folder
of the repository

This PR additionally fixes an issue that would cause logs of edited
messages to not be syntax highlighted. This happened because the
responder of edited messages was changed to use the universal
`InBlockCode` extension method which did not support syntax highlighting
until this PR

This PR additionally changes CODEOWNERS to be more reliable. Previously,
it would be possible for some PRs to be unable to be approved because
the only person who can approve them is the same person who opened the
PR.

---------

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-09 22:36:44 +05:00