Compare commits
	
		
			3 Commits
		
	
	
		
			master
			...
			auto-sched
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 8cf9208a29 | |||
| 1ea0ab35e3 | |||
| 91748be435 | 
							
								
								
									
										4
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.py
									
									
									
									
									
								
							@ -1,4 +1,5 @@
 | 
				
			|||||||
from telegram.ext import Updater, MessageHandler, Filters
 | 
					from telegram.ext import Updater, MessageHandler, Filters
 | 
				
			||||||
 | 
					from telegram.constants import ParseMode
 | 
				
			||||||
import datetime
 | 
					import datetime
 | 
				
			||||||
import codecs
 | 
					import codecs
 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
@ -192,7 +193,8 @@ def queue_processor():
 | 
				
			|||||||
                            responce = mod.process(msg)
 | 
					                            responce = mod.process(msg)
 | 
				
			||||||
                            if responce:
 | 
					                            if responce:
 | 
				
			||||||
                                updater.bot.send_message(chat_id=msg.chat.id, text=responce,
 | 
					                                updater.bot.send_message(chat_id=msg.chat.id, text=responce,
 | 
				
			||||||
                                                         disable_web_page_preview=True)
 | 
					                                                         disable_web_page_preview=True,
 | 
				
			||||||
 | 
					                                                         parse_mode=ParseMode.MARKDOWN_V2)
 | 
				
			||||||
                                print(f"Responded using module {mod.path} ({mod.alias}) with text: {responce}")
 | 
					                                print(f"Responded using module {mod.path} ({mod.alias}) with text: {responce}")
 | 
				
			||||||
                                break
 | 
					                                break
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@ def readfile(filename):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# global constants
 | 
					# global constants
 | 
				
			||||||
# Accusative - znahidnyj
 | 
					# Accusative - znahidnyj
 | 
				
			||||||
WEEKDAYS_ACCUSATIVE = ["понеділок", "вівторок", "середу", "четвер", "п'ятницю", "суботу", "неділю"]
 | 
					WEEKDAYS_ACCUSATIVE = ["в понеділок", "у вівторок", "в середу", "в четвер", "в п'ятницю", "в суботу", "в неділю"]
 | 
				
			||||||
# Genitive - rodovyj
 | 
					# Genitive - rodovyj
 | 
				
			||||||
WEEKDAYS_GENITIVE_NEXT = ["наступного понеділка", "наступного вівторка", "наступної середи", "наступного четверга",
 | 
					WEEKDAYS_GENITIVE_NEXT = ["наступного понеділка", "наступного вівторка", "наступної середи", "наступного четверга",
 | 
				
			||||||
                          "наступної п'ятниці", "наступної суботи", "наступної неділі"]
 | 
					                          "наступної п'ятниці", "наступної суботи", "наступної неділі"]
 | 
				
			||||||
@ -55,13 +55,13 @@ def generate_lesson_description(lesson, start_datetime, end_datetime, current_da
 | 
				
			|||||||
    if output_settings['date']:
 | 
					    if output_settings['date']:
 | 
				
			||||||
        human_readable_date = get_human_readable_date(start_datetime, end_datetime,
 | 
					        human_readable_date = get_human_readable_date(start_datetime, end_datetime,
 | 
				
			||||||
                                                      current_day, current_week)
 | 
					                                                      current_day, current_week)
 | 
				
			||||||
        result += f"Дата: {human_readable_date}\n"
 | 
					        result += f"*Дата*: {human_readable_date}\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if output_settings['teacher']:
 | 
					    if output_settings['teacher']:
 | 
				
			||||||
        result += f"Викладач: {lesson['teacher']}\n"
 | 
					        result += f"*Викладач*: {lesson['teacher']}\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if output_settings['link']:
 | 
					    if output_settings['link']:
 | 
				
			||||||
        result += f"Посилання на пару: {lesson['link']}"
 | 
					        result += f"*Посилання*: {lesson['link']}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return result
 | 
					    return result
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -151,8 +151,8 @@ def process(message, path):
 | 
				
			|||||||
        else:
 | 
					        else:
 | 
				
			||||||
            closest_lesson_time = min(schedule)
 | 
					            closest_lesson_time = min(schedule)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return "Актуальна пара: " + get_lesson_description(schedule, reference_time, closest_lesson_time, current_day,
 | 
					        return "*Актуальна пара*: " + get_lesson_description(schedule, reference_time, closest_lesson_time, current_day,
 | 
				
			||||||
                                                           current_week)
 | 
					                                                             current_week)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    elif base_command == "!пари":
 | 
					    elif base_command == "!пари":
 | 
				
			||||||
        base_day = current_week * 7 + current_day
 | 
					        base_day = current_week * 7 + current_day
 | 
				
			||||||
@ -166,8 +166,9 @@ def process(message, path):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        lesson_list = [i for i in schedule if selected_day * 86400 <= i < (selected_day + 1) * 86400]
 | 
					        lesson_list = [i for i in schedule if selected_day * 86400 <= i < (selected_day + 1) * 86400]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        lesson_descriptions_list = ["Назва: " + get_lesson_description(schedule, reference_time, lesson_time,
 | 
					        lesson_descriptions_list = ["*Назва*: " + get_lesson_description(schedule, reference_time, lesson_time,
 | 
				
			||||||
                                                                       current_day, current_week, overrides=preferences)
 | 
					                                                                         current_day, current_week,
 | 
				
			||||||
 | 
					                                                                         overrides=preferences)
 | 
				
			||||||
                                    for lesson_time in lesson_list]
 | 
					                                    for lesson_time in lesson_list]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return f"Пари у {WEEKDAYS_ACCUSATIVE[selected_day % 7]}:\n" + "\n\n".join(lesson_descriptions_list)
 | 
					        return f"__Пари {WEEKDAYS_ACCUSATIVE[selected_day % 7]}__\n" + "\n\n".join(lesson_descriptions_list)
 | 
				
			||||||
 | 
				
			|||||||
@ -25,7 +25,7 @@ if (command[0] in self.aliases) and (1 <= command_length <= 3):
 | 
				
			|||||||
                decoded_text = decoded_text.replace(i[0].capitalize(), i[1].capitalize())
 | 
					                decoded_text = decoded_text.replace(i[0].capitalize(), i[1].capitalize())
 | 
				
			||||||
                decoded_text = decoded_text.replace(i[0].upper(), i[1].upper())
 | 
					                decoded_text = decoded_text.replace(i[0].upper(), i[1].upper())
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
            self.RESPONSE = f"Результат: {decoded_text}"
 | 
					            self.RESPONSE = f"__Результат__\n{decoded_text}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    except Exception as e:
 | 
					    except Exception as e:
 | 
				
			||||||
        print(f"[translit-decoder] Got exception: {e}")
 | 
					        print(f"[translit-decoder] Got exception: {e}")
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user