-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
39 lines (33 loc) · 1.4 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import logging
import asyncio
from aiogram.enums import ParseMode
import sys
from aiogram import Bot, Dispatcher, types, Router, F
from aiogram.filters.command import Command
from aiogram.methods.delete_webhook import DeleteWebhook
from aiogram.utils.markdown import hlink
from aiogram.client.bot import DefaultBotProperties
from plyer import notification
from config import *
from keyboards import Markups
# Initialize Bot instance with a default parse mode which will be passed to all API calls
bot = Bot(TOKEN, default=DefaultBotProperties(parse_mode=ParseMode.HTML))
dp = Dispatcher()
router = Router()
# insert a list with the id of users who can set reminders
allowed_id = [1223353442]
@dp.message()
async def remind(message: types.Message):
if message.from_user.id in allowed_id:
notification.notify(title="mbutsk's reminder", message=message.text)
await message.reply(f'You should have received a reminder with the message "{message.text}"')
sys.exit()
else:
await message.reply(f'The message "{message.text}" has not arrived. You do not have permission to send reminders to this user.',
reply_markup=await Markups.github())
async def main() -> None:
await bot(DeleteWebhook(drop_pending_updates=False))
await dp.start_polling(bot)
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
asyncio.run(main())