Exemplo n.º 1
0
def start(message):
    if message.chat.id == 197216910 and Main_classes.ruporready:
        Main_classes.ruporready = False
        list = datahandler.getallplayers()
        for x in list:
            try:
                bot.send_message(x[0], message.text)
            except:
                pass
    elif message.text == 'исправить' and message.chat.id == 197216910:
        datahandler.refresh_string()
    elif message.text[:15] == 'добавить оружие' and message.chat.id == 197216910:
        data = message.text.split(' ')
        if len(data) == 4:
            weapon_name = data[2]
            username = data[3]
        else:
            weapon_name = data[2] + ' ' + data[3]
            username = data[4]
        found = False
        for weapon in Weapon_list.fullweaponlist:
            if weapon.name == weapon_name:
                found = True
                break
        weapon_names = [x.name for x in Weapon_list.weaponlist]
        if weapon_name in weapon_names:
            found = False
        if found:
            check_if_exist = datahandler.add_unique_weapon(username, weapon_name)
            if check_if_exist:
                bot.send_message(message.from_user.id, 'Успешно')
            else:
                bot.send_message(message.from_user.id, 'Уже есть')
        else:
            bot.send_message(message.from_user.id, 'Не успешно')
    elif message.text[:14] == 'удалить оружие' and message.chat.id == 197216910:
        data = message.text.split(' ')
        if len(data) == 4:
            weapon_name = data[2]
            username = data[3]
        else:
            weapon_name = data[2] + ' ' + data[3]
            username = data[4]
        found = False
        weapon_names = [x.name for x in Weapon_list.fullweaponlist]
        if weapon_name in weapon_names:
            found = True
        if found:
            check_if_exist = datahandler.delete_unique_weapon(username, weapon_name)
            if check_if_exist:
                bot.send_message(message.from_user.id, 'Успешно')
            else:
                bot.send_message(message.from_user.id, 'Нету')
        else:
            bot.send_message(message.from_user.id, 'Не успешно')

    elif message.text[:8] == 'очистить' and message.chat.id == 197216910:
        data = message.text.split(' ')
        datahandler.delete_inventory(data[1])
Exemplo n.º 2
0
def end(fight, game):
    if not fight.Withbots:
        for p in game.players:
            datahandler.add_played_games(p.chat_id)
        if not fight.team1.actors and not fight.team2.actors:
            bot.send_message(game.cid, "Ikkala guruh ham mag`lub bo`ldi!")
        elif not fight.team1.actors:
            for p in game.pending_team2:
                datahandler.add_won_games(p.chat_id)
            bot.send_message(game.cid, "Guruh " + fight.team1.leader.name + " mag`lubiyatga uchradi!")
            try:
                pic = bot.get_user_profile_photos(fight.team2.leader.chat_id).photos[0][0].file_id
                bot.send_photo(game.cid, pic, "Guruh " + fight.team2.leader.name + " g`alaba qozondi!")
            except:
                bot.send_message(game.cid, "Guruh " + fight.team2.leader.name + " g`alaba qozondi!")
        elif not fight.team2.actors:
            bot.send_message(game.cid, "Guruh " + fight.team2.leader.name + " mag`lubiyatga uchradi!")
            for p in game.pending_team1:
                datahandler.add_won_games(p.chat_id)
            try:
                pic = bot.get_user_profile_photos(fight.team1.leader.chat_id).photos[0][0].file_id
                bot.send_photo(game.cid, pic, "Guruh " + fight.team1.leader.name + " g`alaba qildi!")
            except:
                bot.send_message(game.cid, "Guruh " + fight.team1.leader.name + " g`alaba qildi!")
    else:
        if not fight.team1.actors and not fight.team2.actors:
            bot.send_message(game.cid, "Ikkala guruh ham mag`lub bo`ldi!")
        elif not fight.team1.actors:
            bot.send_message(game.cid, "Guruh " + fight.team1.leader.name + " mag`lubiyatga uchradi!")
            try:
                pic = fight.team2.leader.wonpic
                bot.send_document(game.cid, pic, caption="Guruh " + fight.team2.leader.name + " g`alaba qozondi!")
            except:
                bot.send_message(game.cid, "Guruh " + fight.team2.leader.name + " g`alaba qozondi!")
        elif not fight.team2.actors:
            bot.send_message(game.cid, "Guruh " + fight.team2.leader.name + " mag`lubiyatga uchradi!")
            try:
                pic = bot.get_user_profile_photos(fight.team1.leader.chat_id).photos[0][0].file_id
                bot.send_photo(game.cid, pic, "Guruh " + fight.team1.leader.name + " g`alaba qozondi!")
            except:
                bot.send_message(game.cid, "Guruh " + fight.Team1.leader.name + " g`alaba qozondi!")
            for ai in fight.deadai:
                if ai.dropweapons:
                    for weapon in ai.dropweapons:
                        for player in fight.team1.players:
                            if player.username is not None:
                                if datahandler.add_unique_weapon(player.username, weapon.name):
                                    bot.send_message(player.chat_id,'Siz olayabsiz ' + weapon.name + '!')
Exemplo n.º 3
0
def end(fight, game):
    if not fight.Withbots:
        for p in game.players:
            datahandler.add_played_games(p.chat_id)
        if not fight.team1.actors and not fight.team2.actors:
            bot.send_message(game.cid, "Обе команды проиграли!")
        elif not fight.team1.actors:
            for p in game.pending_team2:
                datahandler.add_won_games(p.chat_id)
            bot.send_message(game.cid, "Команда " + fight.team1.leader.name + " потерпела поражение!")
            try:
                pic = bot.get_user_profile_photos(fight.team2.leader.chat_id).photos[0][0].file_id
                bot.send_photo(game.cid, pic, "Команда " + fight.team2.leader.name + " победила!")
            except:
                bot.send_message(game.cid, "Команда " + fight.team2.leader.name + " победила!")
        elif not fight.team2.actors:
            bot.send_message(game.cid, "Команда " + fight.team2.leader.name + " потерпела поражение!")
            for p in game.pending_team1:
                datahandler.add_won_games(p.chat_id)
            try:
                pic = bot.get_user_profile_photos(fight.team1.leader.chat_id).photos[0][0].file_id
                bot.send_photo(game.cid, pic, "Команда " + fight.team1.leader.name + " победила!")
            except:
                bot.send_message(game.cid, "Команда " + fight.team1.leader.name + " победила!")
    else:
        if not fight.team1.actors and not fight.team2.actors:
            bot.send_message(game.cid, "Обе команды проиграли!")
        elif not fight.team1.actors:
            bot.send_message(game.cid, "Команда " + fight.team1.leader.name + " потерпела поражение!")
            try:
                pic = fight.team2.leader.wonpic
                bot.send_document(game.cid, pic, caption="Команда " + fight.team2.leader.name + " победила!")
            except:
                bot.send_message(game.cid, "Команда " + fight.team2.leader.name + " победила!")
        elif not fight.team2.actors:
            bot.send_message(game.cid, "Команда " + fight.team2.leader.name + " потерпела поражение!")
            try:
                pic = bot.get_user_profile_photos(fight.team1.leader.chat_id).photos[0][0].file_id
                bot.send_photo(game.cid, pic, "Команда " + fight.team1.leader.name + " победила!")
            except:
                bot.send_message(game.cid, "Команда " + fight.Team1.leader.name + " победила!")
            for ai in fight.deadai:
                if ai.dropweapons:
                    for weapon in ai.dropweapons:
                        for player in fight.team1.players:
                            if player.username is not None:
                                if datahandler.add_unique_weapon(player.username, weapon.name):
                                    bot.send_message(player.chat_id,'Вы получаете ' + weapon.name + '!')
Exemplo n.º 4
0
def end(fight, game):
    if not fight.Withbots:
        for p in game.players:
            datahandler.add_played_games(p.chat_id)
        if not fight.team1.actors and not fight.team2.actors:
            bot.send_message(game.cid, "Обе команды проиграли!")
        elif not fight.team1.actors:
            for p in game.pending_team2:
                datahandler.add_won_games(p.chat_id)
            bot.send_message(
                game.cid,
                "Команда " + fight.team1.leader.name + " потерпела поражение!")
            try:
                pic = bot.get_user_profile_photos(
                    fight.team2.leader.chat_id).photos[0][0].file_id
                bot.send_photo(
                    game.cid, pic,
                    "Команда " + fight.team2.leader.name + " победила!")
            except:
                bot.send_message(
                    game.cid,
                    "Команда " + fight.team2.leader.name + " победила!")
        elif not fight.team2.actors:
            bot.send_message(
                game.cid,
                "Команда " + fight.team2.leader.name + " потерпела поражение!")
            for p in game.pending_team1:
                datahandler.add_won_games(p.chat_id)
            try:
                pic = bot.get_user_profile_photos(
                    fight.team1.leader.chat_id).photos[0][0].file_id
                bot.send_photo(
                    game.cid, pic,
                    "Команда " + fight.team1.leader.name + " победила!")
            except:
                bot.send_message(
                    game.cid,
                    "Команда " + fight.team1.leader.name + " победила!")
    else:
        if not fight.team1.actors and not fight.team2.actors:
            bot.send_message(game.cid, "Обе команды проиграли!")
        elif not fight.team1.actors:
            bot.send_message(
                game.cid,
                "Команда " + fight.team1.leader.name + " потерпела поражение!")
            try:
                pic = fight.team2.leader.wonpic
                bot.send_document(game.cid,
                                  pic,
                                  caption="Команда " +
                                  fight.team2.leader.name + " победила!")
            except:
                bot.send_message(
                    game.cid,
                    "Команда " + fight.team2.leader.name + " победила!")
        elif not fight.team2.actors:
            bot.send_message(
                game.cid,
                "Команда " + fight.team2.leader.name + " потерпела поражение!")
            try:
                pic = bot.get_user_profile_photos(
                    fight.team1.leader.chat_id).photos[0][0].file_id
                bot.send_photo(
                    game.cid, pic,
                    "Команда " + fight.team1.leader.name + " победила!")
            except:
                bot.send_message(
                    game.cid,
                    "Команда " + fight.Team1.leader.name + " победила!")
            for ai in fight.deadai:
                if ai.dropweapons:
                    for weapon in ai.dropweapons:
                        for player in fight.team1.players:
                            if player.username is not None:
                                if datahandler.add_unique_weapon(
                                        player.username, weapon.name):
                                    bot.send_message(
                                        player.chat_id,
                                        'Вы получаете ' + weapon.name + '!')
Exemplo n.º 5
0
def start(message):
    if message.chat.id in config.admins and Main_classes.ruporready:
        Main_classes.ruporready = False
        players = datahandler.getallplayers()
        for x in players:
            try:
                bot.send_message(x, message.text)
            except:
                pass
    elif message.text == 'исправить' and message.chat.id in config.admins:
        datahandler.refresh_string()
    elif message.text[:
                      15] == 'добавить оружие' and message.chat.id in config.admins:
        data = message.text.split(' ')
        if len(data) == 4:
            weapon_name = data[2]
            username = data[3]
        else:
            weapon_name = data[2] + ' ' + data[3]
            username = data[4]
        found = False
        for weapon in Weapon_list.fullweaponlist:
            if weapon.name == weapon_name:
                found = True
                break
        weapon_names = [x.name for x in Weapon_list.weaponlist]
        if weapon_name in weapon_names:
            found = False
        if found:
            check_if_exist = datahandler.add_unique_weapon(
                username, weapon_name)
            if check_if_exist:
                bot.send_message(message.from_user.id, 'Успешно')
            else:
                bot.send_message(message.from_user.id, 'Уже есть')
        else:
            bot.send_message(message.from_user.id, 'Не успешно')
    elif message.text[:
                      14] == 'удалить оружие' and message.chat.id in config.admins:
        data = message.text.split(' ')
        if len(data) == 4:
            weapon_name = data[2]
            username = data[3]
        else:
            weapon_name = data[2] + ' ' + data[3]
            username = data[4]
        found = False
        weapon_names = [x.name for x in Weapon_list.fullweaponlist]
        if weapon_name in weapon_names:
            found = True
        if found:
            check_if_exist = datahandler.delete_unique_weapon(
                username, weapon_name)
            if check_if_exist:
                bot.send_message(message.from_user.id, 'Успешно')
            else:
                bot.send_message(message.from_user.id, 'Нету')
        else:
            bot.send_message(message.from_user.id, 'Не успешно')

    elif message.text[:8] == 'очистить' and message.chat.id in config.admins:
        data = message.text.split(' ')
        datahandler.delete_inventory(data[1])