Database changes, new translations #32
@ -1,5 +1,6 @@
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from pymongo.errors import OperationFailure
|
||||
from pyrogram import filters
|
||||
from pyrogram.types import Message
|
||||
from pytz import timezone as pytz_timezone
|
||||
@ -33,6 +34,7 @@ async def command_upcoming(app: PyroClient, message: Message):
|
||||
+ timedelta(days=30)
|
||||
).replace(tzinfo=timezone.utc)
|
||||
|
||||
try:
|
||||
entries = [
|
||||
await GarbageEntry.from_record(entry)
|
||||
async for entry in col_entries.find(
|
||||
@ -42,6 +44,13 @@ async def command_upcoming(app: PyroClient, message: Message):
|
||||
}
|
||||
)
|
||||
]
|
||||
except OperationFailure:
|
||||
await message.reply_text(
|
||||
app._("upcoming_empty", "messages", locale=user.locale).format(
|
||||
name=user.location.name
|
||||
)
|
||||
)
|
||||
return
|
||||
|
||||
entries_text = "\n\n".join(
|
||||
[
|
||||
|
Reference in New Issue
Block a user