1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-01-31 09:09:00 +03:00
Commit graph

134 commits

Author SHA1 Message Date
2342116e87
Add GitInfo NuGet package (#268)
In this PR, I added a NuGet package called GitInfo. It can replace
Octobot.RepositoryUrl and display the bot version as the current branch
and commit.

---------

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
Signed-off-by: Macintxsh <95250141+mctaylors@users.noreply.github.com>
2024-03-19 20:51:32 +03:00
771750c922
Rename locale Sound to Loaded for clarity (#270)
If you go through the locales, sooner or later you will notice `Sound*`,
which is used in `GuildLoadedResponder.cs`. A new contributor (most
likely) will not understand what it is used for at once, because we use
`$"Loaded{i}".Localized()` instead of `Messages.Sound*` directly. Also,
if you change the locale's value, for example the same "Loaded!",
`Sound` will not fit anymore, because "Loaded!" is not a sound, but a
phrase.

Other suggestions are welcome.

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2024-03-18 21:27:35 +03:00
1894b063ae
Fix auto-unban log spam (#271)
Closes #255

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2024-03-18 21:26:04 +03:00
398abad277
Remove unused IDiscordRestChannelAPI in ToolsCommandGroup (#273)
Signed-off-by: Macintxsh <95250141+mctaylors@users.noreply.github.com>
2024-03-18 23:23:42 +05:00
5105b43eff
Add WelcomeMessagesChannel setting (#269)
Closes #232

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2024-03-18 11:42:37 +03:00
62709d927b
Add time format example to the description of commands that use TimeSpan. (#267)
This PR was made to help users who are trying /remind for the first time
by showing an example of the correct time format in the description.

---------

Signed-off-by: Macintxsh <95250141+mctaylors@users.noreply.github.com>
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2024-03-17 16:46:53 +03:00
8eed295fcd
Add /8ball command (#264)
@neroduckale was bored so I made this feature.

---------

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
Signed-off-by: Macintxsh <95250141+mctaylors@users.noreply.github.com>
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
2024-03-13 20:40:29 +03:00
d39303560d
Make LogAction return void (#261)
1) the method isn't actually async lulw
2) it always returns success, so might as well just be void

reduces complexity by a bit

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2024-02-06 18:39:20 +00:00
58bd439aa7
Revert "Add profiler base" (#260)
Reverts TeamOctolings/Octobot#235
See #244
2024-02-06 21:35:33 +03:00
dependabot[bot]
5483bbd203
Bump the remora group with 4 updates (#259) 2024-02-06 12:09:26 +00:00
290449077a
Use TimeSpanParser.TryParse instead of ParseTimeSpan (#257)
The ParseTimeSpan method is not needed because we no longer use the
quirky (IMO) and long
`Parser.TryParseAsync(from).AsTask().GetAwaiter().GetResult()` to parse
TimeSpan

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2024-01-28 21:36:29 +03:00
f034ede58d
Parry "лан" flooders (#256)
Signed-off-by: Macintxsh <95250141+mctaylors@users.noreply.github.com>
2024-01-28 15:27:21 +03:00
af84f8853a
Add /editremind (#247)
In this PR, I'm adding a command to modify existing reminders. This can
be useful if you, for example, got the name a bit wrong or set the wrong
reminder time. Just use /editremind and recreating the reminder from
scratch will no longer be necessary.

---------

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2024-01-27 15:50:27 +03:00
7e9c08cab7
Don't use Option attribute in ExecuteBanAsync method (#252)
https://github.com/TeamOctolings/Octobot/issues/246#issuecomment-1912579699
> The `Option` attribute also somehow affects the command update
behavior. I'll get rid of it then.

Closes #246

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2024-01-27 15:06:10 +03:00
83e2c5040e
Remove mctaylors.ru mentions (#251)
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2024-01-22 20:47:53 +05:00
e01fde83c6
Use custom TimeSpanParser (#223)
Closes #154

---------

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2023-12-31 12:27:00 +00:00
894e819865
Fix newline in LogResult (#245)
Fixes an issue on Windows that would cause the `ResultErrorMessage` to
be unindented.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-12-31 13:42:59 +03:00
285763d50d
/userinfo: Show if the user was kicked (#242)
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>
2023-12-21 20:35:10 +05:00
7d9a85d815
Add profiler base (#235)
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>
2023-12-20 22:59:17 +05:00
d4871bb23d
Use AddFromAssembly for responders and command groups (#240)
now we don't have to explicitly type out command groups woooo

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-12-20 20:48:32 +03:00
21f200c988
Merge BackgroundGuildDataSaverService into GuildDataService (#239)
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>
2023-12-20 20:08:56 +03:00
bd4c5b26da
Remove "extends IHostedService" from classes where it's not required (#236)
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>
2023-12-20 19:33:52 +03:00
6688481093
/about: Show Discord bot username instead of hardcoded one (#230)
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>
2023-12-20 16:25:13 +00:00
74e32dee9b
Use collection expressions in more places (#238)
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.
2023-12-20 19:23:37 +03:00
f79968fdc2
/about: Use Markdown.Hyperlink instead of custom extension (#229)
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2023-12-19 15:32:11 +05:00
c0b43c6a18
/about: Show link to GitHub profile if Discord member wasn't found (#226)
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>
2023-12-18 14:26:08 +05:00
4dc460a269
Add issue button w/ some button updates (#221)
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>
2023-12-17 21:35:09 +03:00
neroduckale
4581b402aa
Do not log messages edited by bots (#202)
If the author of the edited message is a bot, then Octobot won't log the edit
2023-12-17 22:02:50 +05:00
2dc5220f46
/about: Add repository link button (#218)
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>
2023-12-17 16:49:44 +00:00
541e18fff0
Add ChannelApiExtensions (#217)
This PR adds an extension method to make it easier to pass Result<Embed> to CreateMessageAsync

---------

Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-12-17 21:47:52 +05:00
9a23e1d533
FeedbackServiceExtensions: Add FeedbackMessageOptions support (#219)
Required for #218
2023-12-17 20:44:18 +05:00
neroduckale
59c2c5eada
Add link to original message for activated reminders and /listremind (#203) 2023-12-11 23:38:26 +03:00
eeaff23fb5
Rewrite music list (#210)
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>
2023-12-08 16:15:44 +05:00
42ab11d253
Rename "Event details" button to "Open Event Info" (#209)
The correct phrasing used by Discord is "Event Info"

![image](https://github.com/LabsDevelopment/Octobot/assets/95250141/8165b70d-4c81-4b85-8251-db2de6a7f4ca)

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2023-12-08 16:06:50 +05:00
neroduckale
bcd1db8c8e
Fix inspection warnings (#208)
Signed-off-by: neroduckale <100025711+neroduckale@users.noreply.github.com>
2023-12-06 00:24:55 +05:00
4c50bdaff7
Bump .NET version to 8.0 (#207)
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2023-12-04 20:18:56 +05:00
18cdc63883
Add StringBuilder & Markdown extensions (#206)
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>
2023-12-04 17:09:47 +03:00
dependabot[bot]
7e47c56015
Bump Microsoft.Extensions.Hosting from 7.0.1 to 8.0.0 (#187)
Bumps [Microsoft.Extensions.Hosting](https://github.com/dotnet/runtime)
from 7.0.1 to 8.0.0.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-11-22 14:27:55 +05:00
b166300642
Update CDN links for Octobot banner (#192)
Old CDN links are no longer working and they must be changed to new
links to display Octobot banner properly.
2023-11-22 08:34:40 +00:00
f908919ac9
Put edited message in cache if it's not in cache already (#196)
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
2023-11-22 08:29:27 +00:00
e65c7a469d
Use TryGetValue instead of ContainsKey + index access to avoid double lookup (#193)
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.
2023-11-22 11:19:45 +03:00
f785efcbc0
Add more information to guild loaded log message (#179)
This PR adds additional information in the log about guilds as they are
being loaded. The new information is the owner tag & ID and member count
2023-11-06 23:39:26 +05:00
f12d6d13c5
Check interactions in MemberUpdateService before operating on members (#177)
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.
2023-11-04 23:33:37 +05:00
5f0d806213
Use IFeedbackService interface instead of implementation (#178)
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
2023-11-04 23:28:22 +05:00
a4b009a26f
Disable text commands (#175)
This PR disables text commands as their presence was not intentional.
2023-10-30 09:37:16 +05:00
0ba357e4c7
Limit string argument length to avoid "embed description too long" errors (#174)
This PR fixes an error that would appear if a string that's way too long
was passed as a command argument by limiting the string's length

![image](https://github.com/LabsDevelopment/Octobot/assets/61277953/8f8267fd-d382-4a24-b92d-5f9966d7563b)
2023-10-28 23:10:16 +05:00
cf7007f269
Handle guild data load errors better (#172)
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>
2023-10-26 18:14:27 +03:00
fb3aebb1e0
Notify user when a command execution error occurs (#171)
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>
2023-10-26 14:54:15 +00:00
5b84c8d8d0
Add more info output to /delremind (#173)
_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>
2023-10-26 17:41:47 +03:00
fead92129d
Unschedule scheduled event status update only if last update was successful (#168)
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`
2023-10-17 12:25:15 +00:00