Пример #1
0
def mainmenu():
    print("~~ Swin Virtual Run ~~\n")
    print("[1] Single Registration")
    print("[2] Couple Registration")
    print("[3] Group Registration")
    print("[4] Calculate and Quit\n\n")
    print("[0] Summary\n")
    choice = input("Choice:")
    if int(choice) == 1:
        ticket = input("How many single ticket?")
        print("Registration for " + str(ticket) + " runner is successful")
        calculatepurchase.cal1(ticket)
        print("")
        menu.mainmenu()
    elif int(choice) == 2:
        couple = input("How many couple?")
        print("Registration for " + str(couple) + " couple is successful")
        calculatepurchase.cal2(couple)
        print("")
        menu.mainmenu()
    elif int(choice) == 3:
        menu.groupmenu()
        print("")
        menu.mainmenu()
    elif int(choice) == 4:
        displaypurchase.displaybuy()
    elif int(choice) == 0:
        summary.summary()
        menu.mainmenu()
    else:
        print("Please select correct choice menu !!!")
        menu.mainmenu()
Пример #2
0
def messages_sendgroup(userid,message):
	methods.messages.send(user_id=userid,random_id=0,message=message,keyboard=menu.groupmenu())
Пример #3
0
def runbot():
    while True:
        try:
            for event in longpoll.listen():
                if event.type == VkBotEventType.MESSAGE_NEW:
                    userid = event.object.from_id
                    roomid = event.object.peer_id
                    text = event.object.text.lower()
                    print(roomid)
                    print(text)
                    if event.object.action != None:
                        if event.object.action[
                                'type'] == 'chat_invite_user_by_link':
                            sql.UserReg(userid, get_username(userid), 'None')
                    if (text == '[club193803197|@winwheelcoronacoin] банк'
                            or text
                            == '[club193803197|win wheel corona coin] банк'):
                        sql.GetBank(roomid)
                    elif (text == '[club193803197|@winwheelcoronacoin] баланс'
                          or text
                          == '[club193803197|win wheel corona coin] баланс'):
                        message = sql.GetBalance(userid)
                        messages_send(roomid, message, menu.main())
                    elif (text == '[club193803197|@winwheelcoronacoin] чётное'
                          or text
                          == '[club193803197|win wheel corona coin] чётное'):
                        sql.SetChoice(userid, roomid, 'even', 'чётное')
                    elif (text
                          == '[club193803197|@winwheelcoronacoin] нечётное'
                          or text
                          == '[club193803197|win wheel corona coin] нечётное'):
                        sql.SetChoice(userid, roomid, 'odd', 'нечётное')
                    elif (text == '[club193803197|@winwheelcoronacoin] красное'
                          or text
                          == '[club193803197|win wheel corona coin] красное'):
                        sql.SetChoice(userid, roomid, 'red', 'красное')
                    elif (text == '[club193803197|@winwheelcoronacoin] чёрное'
                          or text
                          == '[club193803197|win wheel corona coin] чёрное'):
                        sql.SetChoice(userid, roomid, 'black', 'чёрное')
                    elif (text == '[club193803197|@winwheelcoronacoin] 1-12'
                          or text
                          == '[club193803197|win wheel corona coin] 1-12'):
                        sql.SetChoice(userid, roomid, 'first_gap',
                                      'промежуток 1-12')
                    elif (text == '[club193803197|@winwheelcoronacoin] 13-24'
                          or text
                          == '[club193803197|win wheel corona coin] 13-24'):
                        sql.SetChoice(userid, roomid, 'second_gap',
                                      'промежуток 13-24')
                    elif (text == '[club193803197|@winwheelcoronacoin] 25-36'
                          or text
                          == '[club193803197|win wheel corona coin] 25-36'):
                        sql.SetChoice(userid, roomid, 'third_gap',
                                      'промежуток 25-36')
                    elif (text
                          == '[club193803197|@winwheelcoronacoin] на число'
                          or text
                          == '[club193803197|win wheel corona coin] на число'):
                        sql.SetChoiceNumber(userid)
                        messages_send(
                            roomid,
                            F"{get_username(userid).split()[0]}, на какое число ты ставишь?",
                            menu.main())
                    elif (text == '[club193803197|@winwheelcoronacoin] вывод'
                          or text
                          == '[club193803197|win wheel corona coin] вывод'):
                        sql.withdraw(roomid, userid)
                    elif text == 'adminpanel':
                        if userid == 387159377:
                            messages_send(387159377, 'Админка',
                                          menu.adminpanel())
                    elif 'addbonusbalance' in text:
                        if userid == 387159377:
                            try:
                                text = text.split()
                                userid = int(text[1])
                                value = int(text[2])
                                kek = "{:,}".format(value).replace(',', ' ')
                                messages_send(
                                    387159377,
                                    F"userid: {userid}\nВыдан бонусный баланс: {kek}",
                                    menu.adminpanel())
                                sql.addbonus_balance(userid, value)
                            except:
                                print('bag')
                    elif 'addbalance' in text:
                        if userid == 387159377:
                            try:
                                text = text.split()
                                userid = int(text[1])
                                value = int(text[2])
                                kek = "{:,}".format(value).replace(',', ' ')
                                messages_send(
                                    387159377,
                                    F"userid: {userid}\nВыдан баланс: {kek}",
                                    menu.adminpanel())
                                sql.addbalance(userid, value)
                            except:
                                print('bag')
                    elif text == 'обновить топ':
                        if userid == 387159377:
                            sql.admin_updatetop()
                            messages_send(387159377, 'Топ обнулён',
                                          menu.adminpanel())
                    elif text == 'обновить репосты':
                        if userid == 387159377:
                            sql.admin_updaterepost()
                            messages_send(387159377, 'Репосты обновлены',
                                          menu.adminpanel())
                    elif text == 'выдать баланс':
                        if userid == 387159377:
                            messages_send(
                                387159377,
                                'Выдать баланс:\naddbalance userid value\nВыдать бонусный баланс:\naddbonusbalance userid value',
                                menu.adminpanel())
                    elif text.isdigit():
                        bet = int(text)
                        sql.acceptbet(userid, roomid, bet)
                    elif text[36:].isdigit():
                        bet = int(text[36:])
                        sql.acceptbet(userid, roomid, bet)
                    elif text[38:].isdigit():
                        bet = int(text[38:])
                        sql.acceptbet(userid, roomid, bet)
                    elif text == 'начать':
                        try:  #Если перешёл по реф ссылк
                            invited_from = event.object.ref
                            sql.UserReg(userid, get_username(userid),
                                        invited_from)
                        except:
                            sql.UserReg(userid, get_username(userid), 'None')
                        messages_send(userid, 'Добро пожаловать',
                                      menu.groupmenu())
                    elif text == 'найти беседу':
                        messages_send(userid, random.choice(rooms_choicez),
                                      menu.groupmenu())
                    elif text == 'профиль':
                        messages_send(userid, sql.getprofile(userid),
                                      menu.groupmenu())
                    elif text == 'топ игроков':
                        messages_send(userid, sql.get_top(), menu.groupmenu())

                elif event.type == VkBotEventType.WALL_REPOST:
                    try:
                        userid = event.object.from_id
                        getsub = methods.groups.isMember(group_id=193803197,
                                                         user_id=userid)
                        if getsub == 1:
                            sql.repost(userid)
                    except Exception:
                        traceback.print_exc()
        except Exception:
            sql.UserReg(userid, get_username(userid), 'None')
            traceback.print_exc()