Skip to content

Commit

Permalink
added reminder clear
Browse files Browse the repository at this point in the history
  • Loading branch information
Mole1424 committed Jun 22, 2024
1 parent c496d55 commit fa03298
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions cogs/commands/reminders.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,20 @@ async def remove(self, ctx: Context, reminder_id: int):
else:
await ctx.send("I couldn't delete the reminder you asked for")

@reminder.command()
async def clear(self, ctx: Context):
"""
Removes all your reminders.
"""
author = utils.get_database_user(ctx.author)
reminders = (
db_session.query(Reminder)
.filter(Reminder.user_id == author.id)
.delete(synchronize_session=False)
)
db_session.commit()
await ctx.send(f"Deleted {reminders} reminders.")


async def setup(bot: Bot):
await bot.add_cog(Reminders(bot))
2 changes: 1 addition & 1 deletion docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Cogs are how Discord.py organizes commands, each file is a separate cog with sep
4. Check the newly created upgrade and downgrade is correct
5. Upgrade your database with `alembic upgrade head`
- If running in docker, the above is slightly different:
1. Run `docker compose up --build d` to start apollo and postgres in the background in a docker container
1. Run `docker compose up --build -d` to start apollo and postgres in the background in a docker container
2. Run `docker compose exec apollo alembic upgrade head` to bring the database up to date
3. Run `docker compose exec apollo alembic revision --autogenerate -m "<change description>"` to generate the migration within the container
4. Run `docker compose cp apollo:/app/migrations/versions/<name of migration generated> ./migrations/versions` this will copy the migration out of the container and into your local directory
Expand Down

0 comments on commit fa03298

Please sign in to comment.