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

103 commits

Author SHA1 Message Date
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
580cd24810
Do not try to send messages in empty EventNotificationChannels (#167)
This PR fixes an error that would occur if an event was created, was
about to start or started and the EventNotificationChannel was empty.
2023-10-17 12:23:14 +00:00
b30d690113
Add filtering by message author to /clear (#169)
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.
2023-10-17 12:20:58 +00:00
687883bbf8
Use MemberData to determine a subscriber's role list (#165)
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)
2023-10-17 12:07:01 +00:00
a326adb680
Fix Reminder serialization/deserialization (#166)
Closes #124 

Before we dive into this PR, let's explain a few rules of serialization
and deserialization in System.Text.Json (often referred as STJ).

The important rule of serialization is that fields are ***not***
serialized unless the serializer gets passed an instance of
`JsonSerializerOptions` that explicitly tells it to include fields.
However, properties are serialized by default.

The important rule of ***de***serialization is that class members are
only deserialized if:
1) In case of properties, they must have a setter
2) If they do not have a setter, the constructor must have an argument,
required or optional, that will act as the setter for that property.

Unfortunately, both of these rules were ignored in some commit that
refactored reminders. This PR is here to fix that issue by:
1) Converting fields in `Reminder.cs` to properties
2) Adding an optional argument to the `MemberData` constructor
2023-10-17 17:01:24 +05:00
67d44ff835
Sanitize input text in message edit log (#162)
This PR fixes an issue that caused syntax highlighting to be applied to
incorrect lines in the message edit log. The fix is to prepend a
zero-width space before every line of input text. This prevents Discord
from highlighting the line when it wasn't edited
2023-10-12 21:51:51 +05:00
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