Skip to content

Commit

Permalink
stop firing the headsup job in weekend days
Browse files Browse the repository at this point in the history
  • Loading branch information
mhewedy committed May 17, 2024
1 parent 6a0e04f commit 217ae71
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging
import os
import random
from datetime import datetime

from telebot import BotApp
from telegram import Update
Expand Down Expand Up @@ -74,11 +75,11 @@ async def yalla_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> N

@bot.command(name="clear", desc="مسح جميع الطلبات")
async def clear_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
global orders
if not await is_admin(update, context):
await update.message.reply_text("هذه الخاصية متاحة فقط للأدمن")
return

global orders
orders = {}
await update.message.reply_text("تم مسح جميع الطلبات بنجاح")

Expand All @@ -102,6 +103,10 @@ async def about_command(update: Update, context: ContextTypes.DEFAULT_TYPE):

@bot.job(time=os.getenv("HEADS_UP_TIME", "08:00"))
async def send_lunch_headsup(context: ContextTypes.DEFAULT_TYPE, chat_id):
if datetime.today().weekday() in [4, 5]:
logging.info('today is weekend, job will be suspended')
return

global orders
orders = {}
await context.bot.send_message(chat_id, text="يلا يا شباب أبدأو ضيفو طلابتكم")
Expand Down

0 comments on commit 217ae71

Please sign in to comment.