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

21 commits

Author SHA1 Message Date
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
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
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
4c50bdaff7
Bump .NET version to 8.0 (#207)
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2023-12-04 20:18:56 +05: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
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
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
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
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
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
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
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
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