Skip to content

Commit

Permalink
inform poeple being rung that they can disable this feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mralext20 committed Apr 28, 2024
1 parent 2d96d64 commit d0c49c6
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions alexBot/cogs/ringing.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,24 @@ async def ring(self, interaction: discord.Interaction, target: discord.Member):
session.add(uc)
await session.commit()

if not uc.ringable:
await interaction.response.send_message("cannot ring: they do not want to be rung", ephemeral=True)
return

ringRate = RING_RATES[target.status]
task = asyncio.create_task(self.doRing(interaction.user, target, interaction.channel, ringRate))
await interaction.response.send_message("ringing...", view=self.CancelableTaskView(task))
try:
await task
except asyncio.CancelledError:
pass
await (await interaction.original_response()).edit(view=None)
if not uc.ringable:
await interaction.response.send_message("cannot ring: they do not want to be rung", ephemeral=True)
return

ringRate = RING_RATES[target.status]
await
task = asyncio.create_task(self.doRing(interaction.user, target, interaction.channel, ringRate))
msg = "ringing..." if uc.hasBeenRung else "ringing... use `/config user set ringable false` to disallow this feature"
await interaction.response.send_message(msg, view=self.CancelableTaskView(task))
if not uc.hasBeenRung:
uc.hasBeenRung = True
session.add(uc)
await session.commit()
try:
await task
except asyncio.CancelledError:
pass
await (await interaction.original_response()).edit(view=None)

async def doRing(
self,
Expand Down

0 comments on commit d0c49c6

Please sign in to comment.