Raiseku / Quiz-bot-Youtube

Bot for Telegram written in python that responds to some commands. It uses external APIs and CallbackQuery for button management.
15 stars 8 forks source link

Code not working #2

Closed MrSeccubus closed 9 months ago

MrSeccubus commented 9 months ago

Hi,

I tried you code, but this is what I got.

% python3 script.py
Traceback (most recent call last):
  File "/Users/fbreedijk/repos/piTelex/socket_clients/telegram/Quiz-bot-Youtube/script.py", line 27, in <module>
    @client.on(events.NewMessage(pattern='/(?i)start'))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/fbreedijk/repos/piTelex/venv/lib/python3.11/site-packages/telethon/events/newmessage.py", line 78, in __init__
    self.pattern = re.compile(pattern).match
                   ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/re/__init__.py", line 227, in compile
    return _compile(pattern, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/re/__init__.py", line 294, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/re/_compiler.py", line 743, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/re/_parser.py", line 982, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/re/_parser.py", line 457, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/re/_parser.py", line 843, in _parse
    raise source.error('global flags not at the start '
re.error: global flags not at the start of the expression at position 1

It seems to have problems with the way the patterns are defined.

Raiseku commented 9 months ago

Thank you for reporting the issue. I've merged the PR!