|
140 | 140 | dateParts = dateStr.split("، ") |
141 | 141 | dateMonth = dateParts[1] |
142 | 142 | dateDay = int(dateMonth.split(" ")[0]) |
143 | | - if datetime.now().date().day == dateDay: |
| 143 | + if dateDay == datetime.now().date().day: # In case today: |
144 | 144 | print(f"Founded match today: {date}") |
145 | 145 |
|
146 | 146 | matchDec = matchDates[date] |
|
152 | 152 | team2 = team1 |
153 | 153 |
|
154 | 154 | messageText = ( |
155 | | - f"<b>مباراة اليوم - الساعة {dateParts[2]}</b>\n\n" |
| 155 | + f"<b>تذكير بمباراة اليوم - الساعة {dateParts[2]}</b>\n\n" |
156 | 156 | f"<b>{team1}</b> و <b>{team2}</b> - علي ملعب {location}" |
157 | 157 | ) |
158 | 158 |
|
|
170 | 170 | print("Faild to send telegram message - Continue") |
171 | 171 | continue |
172 | 172 | print("Telegram message sended successfully") |
173 | | - print("✅ Work ended successfully - Exitting...") |
| 173 | + elif (dateDay - datetime.now().date().day) == 0: # In case tomorrow: |
| 174 | + matchDec = matchDates[date] |
| 175 | + team1 = matchDec["team1"] |
| 176 | + team2 = matchDec["team2"] |
| 177 | + location = matchDec["location"] |
| 178 | + if not team1 == "ريال مدريد": |
| 179 | + team1 = "ريال مدريد" |
| 180 | + team2 = team1 |
| 181 | + |
| 182 | + messageText = ( |
| 183 | + f"<b>توجد مباراة غداً - الساعة {dateParts[2]}</b>\n\n" |
| 184 | + f"<b>{team1}</b> و <b>{team2}</b> - علي ملعب {location}" |
| 185 | + ) |
| 186 | + |
| 187 | + print(f"Founded match tomorrow: {date}") |
| 188 | + print("Send to telegram - Sending") |
| 189 | + isSuccessSend = asyncio.run( |
| 190 | + send_text_message( |
| 191 | + token=TELEGRAM_TOKEN_REAL_MADRID, |
| 192 | + chat_id=TELEGRAM_CHAT_ID, |
| 193 | + text=messageText, |
| 194 | + source_url=MATCHES_URL, |
| 195 | + buttonText="الموقع الرسمي لريال مدريد", |
| 196 | + ) |
| 197 | + ) |
| 198 | + if not isSuccessSend: |
| 199 | + print("Faild to send telegram message - Continue") |
| 200 | + continue |
| 201 | + print("Telegram message sended successfully") |
| 202 | + |
| 203 | + print("\n✅ Work ended successfully - Exitting...") |
174 | 204 | else: |
175 | 205 | print("❗ No data avalibale - Existting") |
176 | 206 | else: |
|
0 commit comments