Compare commits
No commits in common. "3a06464c2961c2dccb8c48f16ca4c6b3151f7fe6" and "c064c6bade3175b289d4d73f012b7c593253955e" have entirely different histories.
3a06464c29
...
c064c6bade
@ -21,5 +21,4 @@ six==1.16.0
|
|||||||
sniffio==1.3.1
|
sniffio==1.3.1
|
||||||
tomli==2.0.1
|
tomli==2.0.1
|
||||||
typing_extensions==4.12.2
|
typing_extensions==4.12.2
|
||||||
uvloop==0.21.0
|
|
||||||
yarl==1.9.4
|
yarl==1.9.4
|
||||||
|
@ -25,7 +25,7 @@ class HistoryManager:
|
|||||||
high_fidelity_history = await self._tdb.history(flavor, region, self.HIGH_FIDELITY_PERIOD)
|
high_fidelity_history = await self._tdb.history(flavor, region, self.HIGH_FIDELITY_PERIOD)
|
||||||
final_response = []
|
final_response = []
|
||||||
|
|
||||||
def _convert_to_datetime(data: Tuple[str, int]) -> Tuple[datetime.datetime, int]:
|
def _convert_to_datetime(data: Tuple[str, int]):
|
||||||
return datetime.datetime.fromisoformat(data[0]), data[1]
|
return datetime.datetime.fromisoformat(data[0]), data[1]
|
||||||
|
|
||||||
for data_point in all_history:
|
for data_point in all_history:
|
||||||
|
@ -157,7 +157,7 @@ class Tracker(Extension):
|
|||||||
|
|
||||||
@slash_command(
|
@slash_command(
|
||||||
name="add-alert",
|
name="add-alert",
|
||||||
description="Add an alert listener"
|
description="List all alerts you have signed up for"
|
||||||
)
|
)
|
||||||
async def add_alert(self, ctx: SlashContext):
|
async def add_alert(self, ctx: SlashContext):
|
||||||
if not await self._users.exists(ctx.user.id):
|
if not await self._users.exists(ctx.user.id):
|
||||||
@ -184,10 +184,8 @@ class Tracker(Extension):
|
|||||||
else:
|
else:
|
||||||
alert = Alert(alert_type, flavor, user.region)
|
alert = Alert(alert_type, flavor, user.region)
|
||||||
if not await self._users.is_subscribed(user, alert):
|
if not await self._users.is_subscribed(user, alert):
|
||||||
await asyncio.gather(
|
await self._users.add_alert(user, alert)
|
||||||
self._users.add_alert(user, alert),
|
await self._alerts.add_user(alert, user)
|
||||||
self._alerts.add_user(alert, user)
|
|
||||||
)
|
|
||||||
await ctx.send("Successfully added alert", ephemeral=True)
|
await ctx.send("Successfully added alert", ephemeral=True)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -199,26 +197,14 @@ class Tracker(Extension):
|
|||||||
description="Remove an alert you have signed up for"
|
description="Remove an alert you have signed up for"
|
||||||
)
|
)
|
||||||
async def remove_alert(self, ctx: SlashContext):
|
async def remove_alert(self, ctx: SlashContext):
|
||||||
if not await self._users.exists(ctx.user.id):
|
|
||||||
await ctx.send("You are not registered with any region\n"
|
|
||||||
"Please register with /register before adding alerts",
|
|
||||||
ephemeral=True)
|
|
||||||
return
|
|
||||||
user = await self._users.get(ctx.user.id)
|
user = await self._users.get(ctx.user.id)
|
||||||
alerts = await self._users.list_alerts(user)
|
|
||||||
if len(alerts) == 0:
|
|
||||||
await ctx.send("You do not have any alerts registered", ephemeral=True)
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
alert = await self.remove_alert_select_menu(ctx, user)
|
alert = await self.remove_alert_select_menu(ctx, user)
|
||||||
except TimeoutError:
|
except TimeoutError:
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
await asyncio.gather(
|
await self._users.remove_alert(user, alert)
|
||||||
self._users.remove_alert(user, alert),
|
await self._alerts.remove_user(alert, user)
|
||||||
self._alerts.remove_user(alert, user)
|
|
||||||
)
|
|
||||||
await ctx.send("Successfully removed alert", ephemeral=True)
|
await ctx.send("Successfully removed alert", ephemeral=True)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user