Commit graph

125 commits

Author SHA1 Message Date
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
397bb83ba8
Add code analysis to prohibit using bad methods and properties (#70)
This PR adds the package `Microsoft.CodeAnalysis.BannedApiAnalyzers` to
scan for banned code (defined by `CodeAnalysis/BannedSymbols.txt`) and
provide warnings if it is used. The list of banned symbols is borrowed
from osu! and other projects

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-24 20:35:45 +03: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]
fbe772406d
Bump Remora.Discord.Extensions from 5.3.1 to 5.3.2 (#67)
Bumps Remora.Discord.Extensions from 5.3.1 to 5.3.2.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 17:00:24 +05: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
dependabot[bot]
f752ebf101
Bump Remora.Discord.Caching from 36.0.0 to 37.0.0 (#69)
Bumps Remora.Discord.Caching from 36.0.0 to 37.0.0.
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 16:46:17 +05:00
dependabot[bot]
40527dad06
Bump Remora.Discord.Hosting from 6.0.6 to 6.0.7 (#66)
Bumps Remora.Discord.Hosting from 6.0.6 to 6.0.7.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 16:43:38 +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
8c72dc663e
Do not assign Octol1ttle for Dependabot PRs (#59)
This PR disables automatic assignation of all PRs created by Dependabot
to me. There are now more people working on Boyfriend than just me. In
fact, this project, in theory, can live without me as there are other
members working on it.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-20 23:20:25 +03:00
dependabot[bot]
0938f518f8
Bump muno92/resharper_inspectcode from 1.7.1 to 1.8.0 (#58)
Bumps muno92/resharper_inspectcode from 1.7.1 to 1.8.0.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-20 18:44:10 +05:00
d43ee59099
Remove "code quality" badge (#57)
https://github.com/TeamOctolings/Boyfriend/assets/95250141/efdb0bef-930f-43e5-bba8-6554473f3580

Signed-off-by: Macintosh II <95250141+mctaylors@users.noreply.github.com>
2023-07-20 07:55:02 +00: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
f97e99d82b
Increase thresholds for size labels (#52)
This PR adds a `labels.yml` file to configure the `pull-request-size`
bot. The new thresholds are:
- 0-9 lines for XS
- 10-49 lines for S
- 50-99 lines for M
- 100-499 lines for L
- 500-999 lines for XL
- \>1000 for XXL

In the file, these thresholds are doubled to accomodate for the fact
that both additions and deletions are counted (e.g. editing 10 lines
will result in 10 additions and 10 deletions, 20 in total)

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-19 21:00:11 +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
2dd9f023ef
Fix some issues with slash commands & add missing docs (#46)
mctaylors: "but I use Rider too..."
2023-07-09 20:15:39 +05:00
abbb58f801
Switch to Remora.Discord (#41)
result checks go brrr

this also involves switching to using Discord's modern stuff like embeds
and interactions

and using brand-new for me programming concepts (dependency injection,
results)

---------

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
Signed-off-by: mctaylors <95250141+mctaylors@users.noreply.github.com>
Co-authored-by: mctaylors <95250141+mctaylors@users.noreply.github.com>
Co-authored-by: nrdk <neroduck@vk.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-09 16:32:14 +03:00
2ab7a07784
Update README.md (#39) 2023-05-17 13:41:23 +03:00
8d740e1c52
Update CODEOWNERS
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-05-17 13:16:42 +05:00
c83a458633
Rearrange commands in !help (#37) 2023-05-16 10:58:35 +05:00
e80ced2d54
Update mctaylors' Language (#36)
coolest pull request fr
2023-05-15 15:30:58 +00:00
02949656bf
Change audit output if a message was deleted because of '!clear' (#34) 2023-05-12 19:56:14 +05:00
b0fd49fea2
Remove pointless PropertyGroups
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-04-27 22:55:18 +05:00
926dc0f1b7
Make sure the audit log enumerable is not empty when determining message deleter
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-04-27 22:53:28 +05:00
e35db12ab3
Merge remote-tracking branch 'origin/master' 2023-04-27 22:51:15 +05:00
cdfa0e11f7
Use DateTimeOffset#UtcNow instead of DateTimeOffset#Now (UtcNow is actually faster lol)
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-04-27 22:14:30 +05:00
dependabot[bot]
6dbfc1bfae
Bump muno92/resharper_inspectcode from 1.6.11 to 1.6.13 (#30)
Signed-off-by: dependabot[bot] <support@github.com>
2023-04-24 06:09:22 +00:00
dependabot[bot]
f01ce4fe1c
Bump muno92/resharper_inspectcode from 1.6.6 to 1.6.11 (#27)
Bumps
[muno92/resharper_inspectcode](https://github.com/muno92/resharper_inspectcode)
from 1.6.6 to 1.6.11.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-03 11:19:01 +05:00
41958deb0a
Fixed a memory leak caused by hitting rate limits, caused by attempts to add unset starter roles
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-03-28 22:47:01 +05:00
05ce680373
Bump Discord.Net from 3.9.0 to 3.10.0
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-03-28 15:28:34 +05:00
cac0bdc801
Fix calling commands with @mentions
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-03-20 12:33:54 +05:00
a2e0707ade
we do a little trolling (#26) 2023-03-20 11:19:17 +05:00
4cc00e01da
Bugfixes:
- Do not call RemoveUnbanAsync in guild tick loop if the user is not banned
- Fix !clear message logs being reversed
- Do not process MessageReceivedEvents by webhooks

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-02-14 23:17:20 +05:00
f6f5543972
Use modern Tuple syntax
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-02-14 22:32:29 +05:00
30a4a94f1b
Edit reminder message & add "!pardon" alias for "!unban" (#25) 2023-02-14 19:44:29 +05:00
f2e337153f
Fix bulk message deleting logs being public
bruh

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-02-02 23:11:17 +05:00
3105229ad4
Include bots for storage in MemberData, download users when populating MemberData
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-02-02 23:05:28 +05:00
7f0fd6ffb5
Fix removed roles store being overwritten
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-02-02 23:04:29 +05:00