use the interval trigger keyword

This commit is contained in:
deflax 2024-01-16 19:35:35 +02:00
parent 03968df87b
commit 4ab45cd8bc

View file

@ -5,7 +5,6 @@ import discord
from discord.ext import commands, tasks
from datetime import datetime
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from apscheduler.triggers import IntervalTrigger
# Read env variables
bot_token = os.environ.get('DISCORDBOT_TOKEN', 'token')
@ -67,7 +66,7 @@ async def time(ctx):
@bot.command(name='start')
async def start_task(ctx):
# Schedule a task to run every 5 seconds
scheduler.add_job(func=my_task, trigger=IntervalTrigger(seconds=5), id='my_task_id')
scheduler.add_job(func=my_task, trigger='interval', seconds=5, id='my_task_id')
#scheduler.add_job(func=tick, id='tick_id', args=(ctx))
#channel = bot.get_channel(channel_id)
#if channel: