Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c71d24fe3 | ||
|
|
cdc335936c | ||
|
|
303f0aa804 | ||
|
|
bc743cbb1a | ||
|
|
ed0895056d | ||
|
|
985e253954 |
@@ -54,14 +54,14 @@ class RemoveCog(commands.Cog, name="Remove Commands"):
|
|||||||
"""
|
"""
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
stmt = select(Presences)
|
stmt = select(Presences)
|
||||||
presences_dict: "dict[str,str]" = {pres.Presence: str(pres.Id) for pres in session.scalars(stmt)}
|
presences_dict: dict[str,str] = {pres.Presence: str(pres.Id) for pres in session.scalars(stmt)}
|
||||||
|
|
||||||
# if empty compare string
|
# if empty compare string
|
||||||
if not presence_str:
|
if not presence_str:
|
||||||
await interaction.response.send_autocomplete(dict(list(presences_dict.items())[:25]))
|
await interaction.response.send_autocomplete(dict(list(presences_dict.items())[:25]))
|
||||||
return
|
return
|
||||||
|
|
||||||
autofilled_presences: "dict[str,str]" = {
|
autofilled_presences: dict[str,str] = {
|
||||||
pres: pres_id for pres, pres_id in presences_dict.items() if presence_str.lower() in pres.lower()
|
pres: pres_id for pres, pres_id in presences_dict.items() if presence_str.lower() in pres.lower()
|
||||||
}
|
}
|
||||||
await interaction.response.send_autocomplete(autofilled_presences[:25])
|
await interaction.response.send_autocomplete(autofilled_presences[:25])
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ class ViewCog(commands.Cog, name="View Commands"):
|
|||||||
await interaction.response.send_autocomplete(list(elections)[:25])
|
await interaction.response.send_autocomplete(list(elections)[:25])
|
||||||
return
|
return
|
||||||
|
|
||||||
autofilled_elections: "list[str]" = [
|
autofilled_elections: list[str] = [
|
||||||
election for election in elections if election.lower().startswith(election_name.lower())
|
election for election in elections if election.lower().startswith(election_name.lower())
|
||||||
]
|
]
|
||||||
await interaction.response.send_autocomplete(autofilled_elections[:25])
|
await interaction.response.send_autocomplete(autofilled_elections[:25])
|
||||||
@@ -207,7 +207,7 @@ class ViewCog(commands.Cog, name="View Commands"):
|
|||||||
await interaction.response.send_autocomplete(list(quarters)[:25])
|
await interaction.response.send_autocomplete(list(quarters)[:25])
|
||||||
return
|
return
|
||||||
|
|
||||||
autofilled_quarters: "list[str]" = [
|
autofilled_quarters: list[str] = [
|
||||||
quarter for quarter in quarters if quarter.lower().startswith(quarter_name.lower())
|
quarter for quarter in quarters if quarter.lower().startswith(quarter_name.lower())
|
||||||
]
|
]
|
||||||
await interaction.response.send_autocomplete(autofilled_quarters[:25])
|
await interaction.response.send_autocomplete(autofilled_quarters[:25])
|
||||||
|
|||||||
+15
-10
@@ -4,20 +4,25 @@ version = "0.1.0"
|
|||||||
description = "Dakiny's Discord Bot."
|
description = "Dakiny's Discord Bot."
|
||||||
authors = ["imcompiling <[email protected]>"]
|
authors = ["imcompiling <[email protected]>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
package-mode = false
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.11"
|
python = "^3.12"
|
||||||
gitpython = "3.1.43"
|
gitpython = "^3.1.43"
|
||||||
fastapi = "0.111.0"
|
fastapi = "^0.111.0"
|
||||||
hydra-core = "1.3.2"
|
hydra-core = "^1.3.2"
|
||||||
nextcord = "2.4.2"
|
nextcord = "^2.6.0"
|
||||||
pandas = "1.5.2"
|
pandas = "^2.2.2"
|
||||||
python-dotenv = "1.0.0"
|
python-dotenv = "^1.0.1"
|
||||||
pytz = "2022.7.1"
|
pytz = "^2024.1"
|
||||||
sqlalchemy = "1.4.46"
|
sqlalchemy = "^2.0.30"
|
||||||
aiofiles = "^23.2.1"
|
aiofiles = "^23.2.1"
|
||||||
|
setuptools = "^70.0.0"
|
||||||
|
|
||||||
|
|
||||||
|
[tool.poetry.group.dev.dependencies]
|
||||||
|
ruff = "^0.4.5"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
@@ -59,7 +64,7 @@ line-length = 120
|
|||||||
indent-width = 4
|
indent-width = 4
|
||||||
|
|
||||||
# Assume Python 3.8
|
# Assume Python 3.8
|
||||||
target-version = "py311"
|
target-version = "py312"
|
||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
python-3.10.4
|
|
||||||
@@ -47,12 +47,10 @@ def get_datetime(day: str) -> datetime:
|
|||||||
day = int(day.split("/")[1])
|
day = int(day.split("/")[1])
|
||||||
|
|
||||||
# ensure that year rolls over if current month is December and the next month is less than 12.
|
# ensure that year rolls over if current month is December and the next month is less than 12.
|
||||||
# TODO(imcompiling): replace with Calendar.DECEMBER when updating to python 3.12
|
if today.month == calendar.DECEMBER and month < calendar.DECEMBER:
|
||||||
# https://gitea.cheezers.org/imcompiling/dakiny-bot/issues/52
|
|
||||||
if today.month == 12 and month < 12:
|
|
||||||
year += 1
|
year += 1
|
||||||
|
|
||||||
if today.month == 1 and month > 1:
|
if today.month == calendar.JANUARY and month > calendar.JANUARY:
|
||||||
year -= 1
|
year -= 1
|
||||||
|
|
||||||
return datetime(year, month, day, tzinfo=UTC)
|
return datetime(year, month, day, tzinfo=UTC)
|
||||||
|
|||||||
Reference in New Issue
Block a user