@@ -551,7 +551,7 @@ async def long_code_handling(update: Update, context: ContextTypes.DEFAULT_TYPE)
551551 will have to be in a lower group.
552552 """
553553 message = cast (Message , update .effective_message )
554- text = cast (str , message .text )
554+ message_text = cast (str , message .text )
555555 has_long_code = False
556556
557557 # We make some educated guesses about the message's content. This is nothing more than
@@ -564,12 +564,12 @@ async def long_code_handling(update: Update, context: ContextTypes.DEFAULT_TYPE)
564564 # if the text contains more than 5 import lines, we assume it's a long code snippet
565565 # regex from https://stackoverflow.com/a/44988666/10606962
566566 pattern = re .compile (r"(?m)^(?:from +(\S+) +)?import +(\S+)(?: +as +\S+)? *$" )
567- if not has_long_code and len (pattern .findall (text )) >= 5 :
567+ if not has_long_code and len (pattern .findall (message_text )) >= 5 :
568568 has_long_code = True
569569
570570 # if the text contains more than 3 class or function definitions, ...
571571 pattern = re .compile (r"(class|def) [a-zA-Z]+[a-zA-Z0-9_]*\(" )
572- if not has_long_code and len (pattern .findall (text )) >= 3 :
572+ if not has_long_code and len (pattern .findall (message_text )) >= 3 :
573573 has_long_code = True
574574
575575 if not has_long_code :
@@ -581,7 +581,7 @@ async def long_code_handling(update: Update, context: ContextTypes.DEFAULT_TYPE)
581581 # the leading ". " is important here since html_markup() splits on whitespaces!
582582 mention = f". { update .effective_user .mention_html ()} " if update .effective_user else None
583583
584- text = (
584+ reply_text = (
585585 f"Hi { hint .html_markup (mention )} , we like to keep our groups readable and thus"
586586 f" require long code to be in a pastebin. \n \n ⚠️ Your message will be deleted in 1 minute."
587587 )
@@ -593,12 +593,12 @@ async def long_code_handling(update: Update, context: ContextTypes.DEFAULT_TYPE)
593593 content = "\n \n " .join (parsed_entities .values ())
594594 beginning = "⚠️ The code snippet(s) in your message have"
595595 else :
596- content = text
596+ content = message_text
597597 beginning = "⚠️ Your message has"
598598 r = await pastebin_client .post (const .PASTEBIN_URL , content = content )
599599 # if the request was successful we put the link in the message
600600 if r .status_code == codes .OK :
601- text = (
601+ reply_text = (
602602 f"Hi { hint .html_markup (mention )} , we like to keep our groups readable and thus "
603603 f"require long code to be in a pastebin. \n \n { beginning } been moved to "
604604 f"{ const .PASTEBIN_URL } { r .text } .py. Your original message will be deleted in a "
@@ -615,7 +615,7 @@ async def long_code_handling(update: Update, context: ContextTypes.DEFAULT_TYPE)
615615 )
616616
617617 await message .reply_text (
618- text ,
618+ reply_text ,
619619 reply_markup = hint .inline_keyboard ,
620620 )
621621
0 commit comments