Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

JobQueue.run_repeating didnt work after installing#4660

Unanswered
vakhrushevgp asked this question inQ&A
Discussion options

after installing the package, the terminal continues to offer to install it and crashes with an error that it is an empty type. when reinstalling, it says that the version is already the latest

You must be logged in to vote

Replies: 1 comment 5 replies

Comment options

image
You must be logged in to vote
5 replies
@vakhrushevgp
Comment options

mac os sequoia 15 .0 apple m1

@vakhrushevgp
Comment options

it is the only one enviroment

@Poolitzer
Comment options

Why do you think the job_queue attribute is callable?

@vakhrushevgp
Comment options

def job_queue(self) -> Optional["JobQueue[CCT]"]:
JobQueue has methods like run_repeating
def run_repeating(
self,
callback: JobCallback[CCT],
interval: Union[float, datetime.timedelta],
first: Optional[Union[float, datetime.timedelta, datetime.datetime, datetime.time]] = None,
last: Optional[Union[float, datetime.timedelta, datetime.datetime, datetime.time]] = None,
data: Optional[object] = None,
name: Optional[str] = None,
chat_id: Optional[int] = None,
user_id: Optional[int] = None,
job_kwargs: Optional[JSONDict] = None,
) -> "Job[CCT]":
"""Creates a new :class:Job instance that runs at specified intervals and adds it to the
queue.

    Note:        For a note about DST, please see the documentation of `APScheduler`_.    .. _`APScheduler`: https://apscheduler.readthedocs.io/en/stable/modules/triggers/cron.html                       #daylight-saving-time-behavior    Args:        callback (:term:`coroutine function`): The callback function that should be executed by            the new job. Callback signature::                async def callback(context: CallbackContext)        interval (:obj:`int` | :obj:`float` | :obj:`datetime.timedelta`): The interval in which            the job will run. If it is an :obj:`int` or a :obj:`float`, it will be interpreted            as seconds.        first (:obj:`int` | :obj:`float` | :obj:`datetime.timedelta` |                        \               :obj:`datetime.datetime` | :obj:`datetime.time`, optional):            Time in or at which the job should run. This parameter will be interpreted            depending on its type.            * :obj:`int` or :obj:`float` will be interpreted as "seconds from now" in which the              job should run.            * :obj:`datetime.timedelta` will be interpreted as "time from now" in which the              job should run.            * :obj:`datetime.datetime` will be interpreted as a specific date and time at              which the job should run. If the timezone (:attr:`datetime.datetime.tzinfo`) is              :obj:`None`, the default timezone of the bot will be used.            * :obj:`datetime.time` will be interpreted as a specific time of day at which the              job should run. This could be either today or, if the time has already passed,              tomorrow. If the timezone (:attr:`datetime.time.tzinfo`) is :obj:`None`, the              default timezone of the bot will be used, which is UTC unless              :attr:`telegram.ext.Defaults.tzinfo` is used.            Defaults to :paramref:`interval`            Note:                Setting :paramref:`first` to ``0``, ``datetime.datetime.now()`` or another                value that indicates that the job should run immediately will not work due                to how the APScheduler library works. If you want to run a job immediately,                we recommend to use an approach along the lines of::                    job = context.job_queue.run_repeating(callback, interval=5)                    await job.run(context.application)                .. seealso:: :meth:`telegram.ext.Job.run`        last (:obj:`int` | :obj:`float` | :obj:`datetime.timedelta` |                        \               :obj:`datetime.datetime` | :obj:`datetime.time`, optional):            Latest possible time for the job to run. This parameter will be interpreted            depending on its type. See :paramref:`first` for details.            If :paramref:`last` is :obj:`datetime.datetime` or :obj:`datetime.time` type            and ``last.tzinfo`` is :obj:`None`, the default timezone of the bot will be            assumed, which is UTC unless :attr:`telegram.ext.Defaults.tzinfo` is used.            Defaults to :obj:`None`.        data (:obj:`object`, optional): Additional data needed for the callback function.            Can be accessed through :attr:`Job.data` in the callback. Defaults to            :obj:`None`.            .. versionchanged:: 20.0                Renamed the parameter ``context`` to :paramref:`data`.        name (:obj:`str`, optional): The name of the new job. Defaults to            :external:attr:`callback.__name__ <definition.__name__>`.        chat_id (:obj:`int`, optional): Chat id of the chat associated with this job. If            passed, the corresponding :attr:`~telegram.ext.CallbackContext.chat_data` will            be available in the callback.            .. versionadded:: 20.0        user_id (:obj:`int`, optional): User id of the user associated with this job. If            passed, the corresponding :attr:`~telegram.ext.CallbackContext.user_data` will            be available in the callback.            .. versionadded:: 20.0        job_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to pass to the            :meth:`apscheduler.schedulers.base.BaseScheduler.add_job()`.    Returns:        :class:`telegram.ext.Job`: The new :class:`Job` instance that has been added to the job        queue.    """
@Poolitzer
Comment options

Not sure where you got this from, but if you for some reason actually want to read the source code instead of our docs/wiki/examples, you'd see the job_queue function in application has a property decorator above it. Hence no need to call it. Its just an attribute.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@vakhrushevgp@Poolitzer

[8]ページ先頭

©2009-2025 Movatter.jp