Esempio n. 1
0
async def delete_reminder(_, message: Message):
    cmd = message.command
    reminder_id = ""
    if len(cmd) > 1:
        reminder_id = " ".join(cmd[1:])
    elif message.reply_to_message and len(cmd) == 1:
        reminder_id = message.reply_to_message.text
    elif not message.reply_to_message and len(cmd) == 1:
        await message.edit(f"I need the reminder ID to delete it {Emoji.CRYING_FACE}")
        sleep(2)
        await message.delete()
        return

    if Reminders().find_reminder(reminder_id) is not None:
        Reminders().delete_reminder(reminder_id)
        await message.edit("```Reminder deleted```")
        sleep(2)
        await message.delete()
    else:
        await message.edit(f"```Reminder {reminder_id} not found```")
        sleep(2)
        await message.delete()
Esempio n. 2
0
async def show_all_reminders(bot: UserBot, message: Message):
    reminders = Reminders().get_all_reminders()
    if len(reminders) != 0:
        send_text = "**==== My Reminders ====** \n"
        for reminder in reminders:
            send_text = send_text + f"{reminder[0]} | **{reminder[1]}**\n"

        await message.edit(send_text, disable_web_page_preview=True)
        sleep(20)
        await message.delete()
    else:
        send_text = "__You do not have any reminders__"
        await message.edit(send_text, disable_web_page_preview=True)
        sleep(5)
        await message.delete()
Esempio n. 3
0
async def remind(_, message: Message):
    cmd = message.command
    remind_text = ""
    if len(cmd) > 1:
        remind_text = " ".join(cmd[1:])
    elif message.reply_to_message and len(cmd) == 1:
        remind_text = message.reply_to_message.text
    elif not message.reply_to_message and len(cmd) == 1:
        await message.edit(f"__I need something to remind you about {Emoji.CRYING_FACE}__")
        sleep(2)
        await message.delete()
        return

    Reminders().add_reminder(remind_text)
    await message.edit("`Reminder added`")
    sleep(2)
    await message.delete()