🎨 Add return types
This commit is contained in:
parent
011c28b579
commit
f14dc1f239
1 changed files with 9 additions and 8 deletions
|
@ -3,6 +3,7 @@ import requests
|
|||
import datetime
|
||||
import asyncio
|
||||
import pytz
|
||||
from typing import Dict
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
|
@ -24,7 +25,7 @@ user_room_ids: dict = {}
|
|||
|
||||
|
||||
@bot.listener.on_message_event
|
||||
async def echo(room, message):
|
||||
async def echo(room, message) -> None:
|
||||
match = botlib.MessageMatch(room, message, bot, PREFIX)
|
||||
|
||||
if match.is_not_from_this_bot() and match.prefix() and match.command("echo"):
|
||||
|
@ -35,7 +36,7 @@ async def echo(room, message):
|
|||
|
||||
|
||||
@bot.listener.on_message_event
|
||||
async def times(room, message):
|
||||
async def times(room, message) -> None:
|
||||
match = botlib.MessageMatch(room, message, bot, PREFIX)
|
||||
username = str(message).split(': ')[0]
|
||||
response = ""
|
||||
|
@ -53,7 +54,7 @@ async def times(room, message):
|
|||
|
||||
|
||||
@bot.listener.on_message_event
|
||||
async def usage(room, message):
|
||||
async def usage(room, message) -> None:
|
||||
match = botlib.MessageMatch(room, message, bot, PREFIX)
|
||||
|
||||
response = """usage:
|
||||
|
@ -67,7 +68,7 @@ async def usage(room, message):
|
|||
|
||||
|
||||
@bot.listener.on_message_event
|
||||
async def set_location(room, message):
|
||||
async def set_location(room, message) -> None:
|
||||
match = botlib.MessageMatch(room, message, bot, PREFIX)
|
||||
|
||||
response = ""
|
||||
|
@ -81,7 +82,7 @@ async def set_location(room, message):
|
|||
|
||||
|
||||
@bot.listener.on_message_event
|
||||
async def set_reminder(room, message):
|
||||
async def set_reminder(room, message) -> None:
|
||||
match = botlib.MessageMatch(room, message, bot, PREFIX)
|
||||
|
||||
response = ""
|
||||
|
@ -101,7 +102,7 @@ async def set_reminder(room, message):
|
|||
await bot.api.send_markdown_message(room.room_id, response)
|
||||
|
||||
|
||||
def get_praying_times(date: datetime.date, username):
|
||||
def get_praying_times(date: datetime.date, username) -> Dict[str, str]:
|
||||
day = date.day
|
||||
month = date.month
|
||||
year = date.year
|
||||
|
@ -111,7 +112,7 @@ def get_praying_times(date: datetime.date, username):
|
|||
return times
|
||||
|
||||
|
||||
def schedule_reminder(username):
|
||||
def schedule_reminder(username) -> None:
|
||||
# TODO: add peristence for reminders
|
||||
times = get_praying_times(datetime.date.today(), username)
|
||||
now = datetime.datetime.now(datetime.UTC)
|
||||
|
@ -123,7 +124,7 @@ def schedule_reminder(username):
|
|||
asyncio.ensure_future(remind(username, message, seconds - user_reminders[username] * 60))
|
||||
|
||||
|
||||
async def remind(username, message, seconds):
|
||||
async def remind(username, message, seconds) -> None:
|
||||
await asyncio.sleep(seconds)
|
||||
await bot.api.send_markdown_message(user_room_ids[username], message)
|
||||
|
||||
|
|
Loading…
Reference in a new issue