示例#1
0
def create_poll(message):
    new_poll = PollData()
    poll_dict[message.chat.id] = new_poll
    about_poll = message.text
    poll = poll_dict[message.chat.id]
    poll.about_poll = about_poll
    bot.reply_to(message, "Give your question for poll!")
    bot.register_next_step_handler(message, get_poll_question)
示例#2
0
文件: admin.py 项目: shivamhw/ZeNo
def get_msg(message):
    global broadcast_msg
    broadcast_msg = message.text
    bot.reply_to(message, "Preview of message:")
    bot.send_message(message.chat.id, broadcast_msg)
    markup = InlineKeyboardMarkup()
    markup.row_width = 2
    markup.add(InlineKeyboardButton("sure", callback_data="broadcast_yes"),
               InlineKeyboardButton("Cancel", callback_data="no_a"))
    bot.send_message(message.chat.id, "Please select", reply_markup=markup)
示例#3
0
def get_number_of_options(message):
    try:
        number_of_options = int(message.text)
        poll = poll_dict[message.chat.id]
        poll.no_of_options = number_of_options
        poll.current_option_no = 1
        response = {}
        for i in range(1, poll.no_of_options + 1):
            response["Option " + str(i)] = 0
        poll.response = response
        bot.reply_to(message, "Give option " + str(poll.current_option_no))
        bot.register_next_step_handler(message, get_options)
    except ValueError:
        bot.reply_to(message, "Give a valid input")
        bot.register_next_step_handler(message, get_number_of_options)
示例#4
0
def get_options(message):
    current_option = message.text
    poll = poll_dict[message.chat.id]
    options = poll.options
    if not options:
        poll.options = {
            "Option " + str(poll.current_option_no): current_option
        }
    else:
        options["Option " + str(poll.current_option_no)] = current_option
        poll.options = options
    poll.current_option_no += 1
    if poll.current_option_no <= poll.no_of_options:
        bot.reply_to(message, "Give option " + str(poll.current_option_no))
        bot.register_next_step_handler(message, get_options)
    else:
        bot.send_message(message.chat.id, "Poll has been created")
示例#5
0
文件: login.py 项目: shivamhw/ZeNo
def get_username(message):
    username = message.text.lower()
    bot.reply_to(message, "please enter you login pass")
    bot.register_next_step_handler(message, get_password, username)
示例#6
0
def get_poll_question(message):
    question = message.text
    poll = poll_dict[message.chat.id]
    poll.question = question
    bot.reply_to(message, "How many options you want?")
    bot.register_next_step_handler(message, get_number_of_options)