Answer the question
In order to leave comments, you need to log in
How to call the command correctly?
import telebot
from telebot import types
import time
import random
from random import randint
from datetime import datetime, date
bot = telebot.TeleBot('токен')
x = 0
counter = 0
@bot.message_handler(content_types=['text'])
def get_text_messages(message):
def schet():
global counter
counter == 0
schet.config()
while 1:
x = random.randint(0, 15)
counter = counter + x
bot.send_message(message.chat.id,"Тебе выпало " + x + " теперь у тебя " + counter + " счёт")
time.sleep(86400)
if message.text == "/schet":
schet(command == schet)
if message.text == "/start":
bot.reply_to(message, "Привет! Я отчим бот\nМоя суть заключается именно в развлекательных целях\nпропиши команду /schet\n что бы рандомно выбить число от 0 до 15\nэто число ваш счёт!")
bot.remove_webhook()
if __name__ == "__main__":
bot.polling(none_stop=True)
Answer the question
In order to leave comments, you need to log in
async def schet():
global counter
counter == 0
schet.config()
while 1:
x = random.randint(0, 15)
counter = counter + x
bot.send_message(message.chat.id,"Тебе выпало " + x + " теперь у тебя " + counter + " счёт")
time.sleep(86400)
if message.text == "/schet":
await schet()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question