2021年3月9日星期二

How do I use schedule py and Discord py together?

Main goal: Send a message to a channel every Wednesday at 08:00

This is my current code:

import schedule  import time  import discord  import asyncio  from discord.ext import commands, tasks  from discord.ext.tasks import loop    client = discord.Client()    # IMPORTANT  channel =   botToken = ""    async def sendloop():    while True:      schedule.run_pending()      await asyncio.sleep(1)    @client.event  async def on_ready():          general_channel = client.get_channel(channel)          print('ready')          schedule.every(2).seconds.do(lambda:loop.create_task(general_channel.send('TEST')))    client.run(botToken)  

So far, there are no errors, just stuck on "ready". I am a beginner using VS Code.

https://stackoverflow.com/questions/66557347/how-do-i-use-schedule-py-and-discord-py-together March 10, 2021 at 10:01AM

没有评论:

发表评论