Answer the question
In order to leave comments, you need to log in
How to send messages to a text channel by timing?
Hi friends! For personal purposes, I'm trying to create a discord bot in python. I downloaded the discord py library, created the bot itself on the server. Essence of the question: It is
necessary that the bot sends messages to the text channel on the server according to the timing (without user intervention).
I want to say right away that I am a complete noob in python programming, and I have trouble with English. As a result, at the moment, studying the documentation for the library is not possible.
Please help me to sort out this issue.
Answer the question
In order to leave comments, you need to log in
Use the datetime module
import datetime
import time
starttime=time.time()
while True:
now = datetime.datetime.now()
now = now.strftime('%H:%M')
if now == '13:00':
pass
#отсылка сообщения
time.sleep(60 - ((time.time() - starttime) % 60))
Probably the easiest way is to schedule a file to run.
That is, you have a .py file that sends a message to a channel, schedule this file to run.
Google the task scheduler in Windows, it's very simple there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question