for d in data['result']:
await ctx.send('[{}] {} — {}'.format(*(d[i] for i in ['clan_tag','nickname','score'])))
message = "\n".join(f"[{elem['clan_tag']}] {elem['nickname']} - {elem['score']}" for elem in data['result'])
await ctx.send(message)
retcode = os.system("echo 'foo' &> /dev/null")
import time
import telebot
import schedule
from threading import Thread
API_TOKEN = ""
bot = telebot.TeleBot(API_TOKEN)
@bot.message_handler(commands=["start"])
def main(message):
bot.send_message(message.chat.id, text="WELCOME")
def send_notify(user_id, text):
bot.send_message(user_id, text)
def schedule_jobs():
while True:
schedule.run_pending()
time.sleep(1)
if __name__ == "__main__":
schedule.every(10).seconds.do(send_notify, user_id="534905", text="DRINK WATER")
t_schedule = Thread(target=schedule_jobs).start()
try:
bot.polling(none_stop=True)
except Exception as e:
print(e)
Вот наглядное видео - https://blog.jetbrains.com/pycharm/2020/06/visual-...