aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/backend
diff options
context:
space:
mode:
Diffstat (limited to 'bot/exts/backend')
-rw-r--r--bot/exts/backend/branding/_repository.py12
-rw-r--r--bot/exts/backend/error_handler.py4
2 files changed, 13 insertions, 3 deletions
diff --git a/bot/exts/backend/branding/_repository.py b/bot/exts/backend/branding/_repository.py
index db2061faa..20cad0a5d 100644
--- a/bot/exts/backend/branding/_repository.py
+++ b/bot/exts/backend/branding/_repository.py
@@ -230,7 +230,17 @@ class BrandingRepository:
for event in available_events:
meta = event.meta
- if not meta.is_fallback and (meta.start_date <= lookup_now <= meta.end_date):
+ if meta.is_fallback:
+ continue
+
+ start_date, end_date = meta.start_date, meta.end_date
+
+ # Case where the event starts and ends in the same year.
+ if start_date <= lookup_now <= end_date:
+ return event, available_events
+
+ # Case where the event spans across two years.
+ if start_date > end_date and (lookup_now >= start_date or lookup_now <= end_date):
return event, available_events
log.trace("No active event found. Looking for fallback event.")
diff --git a/bot/exts/backend/error_handler.py b/bot/exts/backend/error_handler.py
index 5cf07613d..352be313d 100644
--- a/bot/exts/backend/error_handler.py
+++ b/bot/exts/backend/error_handler.py
@@ -7,7 +7,7 @@ from discord.ext.commands import ChannelNotFound, Cog, Context, TextChannelConve
from pydis_core.site_api import ResponseCodeError
from pydis_core.utils.error_handling import handle_forbidden_from_block
from pydis_core.utils.interactions import DeleteMessageButton, ViewWithUserAndRoleCheck
-from sentry_sdk import push_scope
+from sentry_sdk import new_scope
from bot.bot import Bot
from bot.constants import Colours, Icons, MODERATION_ROLES
@@ -400,7 +400,7 @@ class ErrorHandler(Cog):
ctx.bot.stats.incr("errors.unexpected")
- with push_scope() as scope:
+ with new_scope() as scope:
scope.user = {
"id": ctx.author.id,
"username": str(ctx.author)