Q
Q
Qvint012020-02-05 15:45:46
css
Qvint01, 2020-02-05 15:45:46

How to activate several functions at once?

Greetings, I need several functions to work at once with a certain command (but so that they also work separately from each other)

Example code

@bot.message_handler(commands=['hellofirst'])
def hellofirst(message):
    bot.send_message(message.chat.id, 'Hello1')

@bot.message_handler(commands=['hellosecond'])
def hellosecond(message):
    bot.send_message(message.chat.id, 'Hello2')

@bot.message_handler(commands=['hellothird'])
def hellothird(message):
    bot.send_message(message.chat.id, '{0} and {1}'.format(hellofirst,hellosecond)

Thanks in advance.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vitaliy Pershin, 2019-05-20
@Shlop

Flex container inside which block with dots occupies all free space. In this case, you can set any properties and background for it:

D
DanKud, 2019-05-20
@DanKud

If you set the default border to a dot ( dotted) then you can simply do this with this border:<hr>

hr {
  border: none;
  border-top: 3px dotted #dbdbdb;
}

0
0ralo, 2020-02-05
@Qvint01

Create another function in which the rest of the functions will go into threads:

from threading import Thread
def l1():
   pass
def l2():
   pass
def go():
   Thread(target=l1).start()
   Thread(target=l2).start()

O
Oleg Pariyev, 2020-02-05
@DgDays

Good afternoon! I once assigned 4 functions to one button and wrote the same command 4 times, but with different functions. There is also an option to shove all these functions into another. I don’t know how this will affect the robotic ability, but it’s worth a try)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question