问题
This is what I have so far... is does work for the amount delay seconds I want, but how to I add the time module or shedule module to make it work.. Just in case I want the bot to send the message every 24hrs
import discord
import asyncio
from discord.ext import commands
import schedule
import time
TOKEN = 'xxxxx'
client = commands.Bot(command_prefix = '.')
channel_id = '515994xxxxx5036697'
@client.event
async def on_ready():
print('Bot Online.')
async def alarm_message():
await client.wait_until_ready()
while not client.is_closed:
channel = client.get_channel(channel_id)
messages = ('test')
await client.send_message(channel, messages)
await asyncio.sleep(5) #runs every 5 seconds
client.loop.create_task(alarm_message())
client.run(TOKEN)
来源:https://stackoverflow.com/questions/53662781/discord-py-schedule