15 Commits

Author SHA1 Message Date
a5a513cb82 Merge pull request 'Update dependency aiohttp to ~=3.10.0' (#65) from renovate/aiohttp-3.x into dev
Reviewed-on: #65
2024-07-31 02:13:51 +03:00
3fef2eb028 Update dependency aiohttp to ~=3.10.0 2024-07-31 00:47:50 +03:00
11ca3223ab Merge pull request 'Update dependency libbot to v3.2.3' (#64) from renovate/libbot-3.x into dev
Reviewed-on: #64
2024-07-10 08:12:59 +03:00
6b138126c1 Update dependency libbot to v3.2.3 2024-07-10 00:43:50 +03:00
e6adb03f61 Merge pull request 'Update dependency async_pymongo to v0.1.6' (#63) from renovate/async_pymongo-0.x into dev
Reviewed-on: #63
2024-06-23 14:33:51 +03:00
d51fa1e04c Update dependency async_pymongo to v0.1.6 2024-06-23 13:30:14 +03:00
8b2456c2fd Merge pull request 'Update dependency async_pymongo to v0.1.5' (#62) from renovate/async_pymongo-0.x into dev
Reviewed-on: #62
2024-06-02 12:57:32 +03:00
6a6b4cd6cd Selected async_pymongo from PyPi 2024-06-02 12:56:46 +03:00
852f4307f8 Update dependency async_pymongo to v0.1.5 2024-06-01 15:32:20 +03:00
e73797d819 Replaced "source code" with "learn more" 2024-05-31 00:03:24 +02:00
d078ab37d8 Changed pytz<=2024.1 to pytz>=2024.1 2024-05-31 00:55:07 +03:00
04ee8e9c60 Improved docstrings and set some logging events to INFO level instead of DEBUG 2024-05-30 23:41:52 +02:00
2c15bbb4d2 Merge pull request 'Update dependency pytz to v2024' (#59) from renovate/pytz-2024.x into dev
Reviewed-on: #59
2024-05-31 00:31:01 +03:00
99d621d90f Update dependency pytz to v2024 2024-05-31 00:28:46 +03:00
dc389ac1b7 Merge pull request 'Possibly fixed #8' (#57) from profitroll/timezones-fix into dev
Reviewed-on: #57
2024-05-31 00:25:53 +03:00
7 changed files with 65 additions and 21 deletions

View File

@@ -91,6 +91,7 @@ class PyroClient(LibPyroClient):
]
async def check_updates(self) -> None:
"""Check for updates and send a message to the owner if newer version was found"""
if await self.updater.check_updates(
self.__version__, self.config["strings"]["url_updater"]
):

View File

@@ -88,8 +88,7 @@ class PyroUser:
### Args:
* locale (`Union[str, None]`): New locale to be set.
"""
logger.debug("%s's locale has been set to %s", self.id, locale)
logger.info("%s's locale has been set to %s", self.id, locale)
await col_users.update_one({"_id": self._id}, {"$set": {"locale": locale}})
@@ -98,7 +97,15 @@ class PyroUser:
return self.locale
async def update_state(self, enabled: bool = False) -> bool:
logger.debug("%s's state has been set to %s", self.id, enabled)
"""Update user's state (enabled/disabled)
### Args:
* enabled (`bool`, *optional*): Whether the user is enabled. Defaults to `False`.
### Returns:
* `bool`: User's current state
"""
logger.info("%s's state has been set to %s", self.id, enabled)
await col_users.update_one({"_id": self._id}, {"$set": {"enabled": enabled}})
@@ -106,8 +113,16 @@ class PyroUser:
return self.enabled
async def update_location(self, location_id: int = 0) -> Location:
logger.debug("%s's location has been set to %s", self.id, location_id)
async def update_location(self, location_id: int) -> Location:
"""Update user's location and move their time to the new timezone (if the user had a location set previously)
### Args:
* location_id (`int`): ID of the location
### Returns:
`Location`: New location
"""
logger.info("%s's location has been set to %s", self.id, location_id)
await col_users.update_one(
{"_id": self._id}, {"$set": {"location": location_id}}
@@ -136,7 +151,15 @@ class PyroUser:
return self.location
async def update_offset(self, offset: int = 1) -> int:
logger.debug("%s's offset has been set to %s", self.id, offset)
"""Update the offset of the reminder (in days)
### Args:
* offset (`int`, *optional*): Offset in days. Defaults to `1`.
### Returns:
* `int`: Offset in days
"""
logger.info("%s's offset has been set to %s", self.id, offset)
await col_users.update_one({"_id": self._id}, {"$set": {"offset": offset}})
@@ -145,7 +168,16 @@ class PyroUser:
return offset
async def update_time(self, hour: int = 16, minute: int = 0) -> Tuple[int, int]:
logger.debug("%s's time has been set to %s h. %s m.", self.id, hour, minute)
"""Update the time of the reminder (hour and minute, for UTC timezone)
### Args:
* hour (`int`, *optional*): Hour of the reminder. Defaults to `16`.
* minute (`int`, *optional*): Minute of the reminder. Defaults to `0`.
### Returns:
* `Tuple[int, int]`: Hour and minute of the reminder
"""
logger.info("%s's time has been set to %s h. %s m.", self.id, hour, minute)
await col_users.update_one(
{"_id": self._id}, {"$set": {"time_hour": hour, "time_minute": minute}}
@@ -157,16 +189,27 @@ class PyroUser:
return self.time_hour, self.time_minute
async def delete(self) -> None:
logger.debug("%s's data has been deleted", self.id)
"""Delete the database record of the user"""
logger.info("%s's data has been deleted", self.id)
await col_users.delete_one({"_id": self._id})
async def checkout(self) -> Mapping[str, Any]:
logger.debug("%s's data has been checked out", self.id)
"""Checkout the user's database record
### Raises:
* `KeyError`: Database record of the user was not found
### Returns:
* `Mapping[str, Any]`: Database record
"""
logger.info("%s's data has been checked out", self.id)
db_entry = await col_users.find_one({"_id": self._id})
if db_entry is None:
raise KeyError(
f"DB record with id {self._id} of user {self.id} is not found"
f"DB record with id {self._id} of user {self.id} was not found"
)
del db_entry["_id"] # type: ignore

View File

@@ -8,7 +8,7 @@
},
"bot": {
"name": "Garbage Reminder",
"about": "Nie wieder Müllabfuhrtermin verpassen. Quellcode: https://garbagebot.eu",
"about": "Nie wieder Müllabfuhrtermin verpassen. Mehr erfahren: https://garbagebot.eu",
"description": "Sie können Erinnerungen an die Müllabfuhr für Orte Ihrer Wahl erhalten.\n\nVerwenden Sie /help, um die Funktionsweise des Bots besser zu verstehen, oder verwenden Sie /setup, um Ihre Erinnerungen zu konfigurieren."
},
"formats": {
@@ -100,4 +100,4 @@
"callbacks": {
"locale_set": "Ihre Sprache ist jetzt: {locale}"
}
}
}

View File

@@ -8,7 +8,7 @@
},
"bot": {
"name": "Garbage Reminder",
"about": "Never forget about garbage collection again. Source code: https://garbagebot.eu",
"about": "Never forget about garbage collection again. Learn more: https://garbagebot.eu",
"description": "You can receive reminders about garbage collection for locations of your choice.\n\nUse /help to better understand how the bot works or use /setup to configure your reminders."
},
"formats": {

View File

@@ -8,7 +8,7 @@
},
"bot": {
"name": "Garbage Reminder 🇺🇦",
"about": "Більше ніколи не забувайте про вивезення сміття. Вихідний код: https://garbagebot.eu",
"about": "Більше ніколи не забувайте про вивезення сміття. Дізнатись більше: https://garbagebot.eu",
"description": "Ви можете отримувати нагадування про вивезення сміття для обраних вами місць.\n\nВикористовуйте /help, щоб краще зрозуміти, як працює бот, або /setup, щоб налаштувати нагадування."
},
"formats": {
@@ -100,4 +100,4 @@
"set_offset": "Кількість днів",
"set_time": "Час у вигляді ГГ:ХХ"
}
}
}

View File

@@ -8,7 +8,7 @@
},
"bot": {
"name": "Garbage Reminder 🇺🇦",
"about": "Більше ніколи не забувайте про вивезення сміття. Вихідний код: https://garbagebot.eu",
"about": "Більше ніколи не забувайте про вивезення сміття. Дізнатись більше: https://garbagebot.eu",
"description": "Ви можете отримувати нагадування про вивезення сміття для обраних вами місць.\n\nВикористовуйте /help, щоб краще зрозуміти, як працює бот, або /setup, щоб налаштувати нагадування."
},
"formats": {
@@ -100,4 +100,4 @@
"set_offset": "Кількість днів",
"set_time": "Час у вигляді ГГ:ХХ"
}
}
}

View File

@@ -1,12 +1,12 @@
aiohttp~=3.9.5
aiohttp~=3.10.0
apscheduler~=3.10.4
async_pymongo==0.1.6
convopyro==0.5
mongodb-migrations==1.3.1
pytz<=2023.2
pytz>=2024.1
tgcrypto==1.2.5
ujson>=5.0.0
uvloop==0.19.0
--extra-index-url https://git.end-play.xyz/api/packages/profitroll/pypi/simple
async_pymongo==0.1.4
libbot[speed,pyrogram]==3.2.2
libbot[speed,pyrogram]==3.2.3
pykeyboard==0.1.7