Python 如何让这个循环从命令开始

Python 如何让这个循环从命令开始,python,discord,discord.py,Python,Discord,Discord.py,我知道ctx.Test\u lol.start是个问题,但我不确定如何用命令启动循环,所以我尝试了ctx。如果有人能就如何手动启动循环提供一些见解,我们将不胜感激。为什么ctx.Test\u lol.start()?你从哪儿弄来的?为什么不简单地Test\u lol.start()?我对如何使用ctx感到非常困惑,我知道类似async def ping(ctx)的东西:wait ctx.send(f'Pong!)将与.ping一起运行,并在那里返回字符串,我想我可以尝试使用这样的命令以这种方式执

我知道
ctx.Test\u lol.start
是个问题,但我不确定如何用命令启动循环,所以我尝试了
ctx
。如果有人能就如何手动启动循环提供一些见解,我们将不胜感激。

为什么
ctx.Test\u lol.start()
?你从哪儿弄来的?为什么不简单地
Test\u lol.start()
?我对如何使用ctx感到非常困惑,我知道类似async def ping(ctx)的东西:wait ctx.send(f'Pong!)将与.ping一起运行,并在那里返回字符串,我想我可以尝试使用这样的命令以这种方式执行循环,同样感谢您的澄清-当等待
任务.start
时,您正在等待它完成,如果您只想启动它并在后台运行它,您不应该等待它,即
测试\u lol.start()
而不是
等待测试\u lol.start()
ctx没有名为
测试\u lol
的属性。拆下ctx,它就会工作
import discord
from discord.ext import commands, tasks
from itertools import cycle
import random
#these imports are for the other parts of the code, I only pasted the parts that keep the code below working

client = commands.Bot(command_prefix = ".")

@client.event
async def on_ready():
    change_status.start()
    print("bot is ready. ")

@tasks.loop(hours=24)
async def Test_lol():
    channel = client.get_channel(CHANNELID)
    await channel.send("Test")
    #test two
@client.command()
async def timer_start(ctx):
    await ctx.Test_lol.start

client.run('MY TOKEN')
@client.command()
async def timer_start(ctx):
    Test_lol.start()