@bot.on.private_message(payload = {"cmd":"yeslvlup"})
async def yeslvlup(message: Message):
lvl = 1+base.output_lvl(message.peer_id)
base.input_lvl(message.peer_id,lvl)
if lvl == 2:
await bot.state_dispenser.set(message.peer_id, func.Data.SecondLvl)
elif lvl == 3:
await bot.state_dispenser.set(message.peer_id, func.Data.ThirdLvl)
elif lvl == 4:
await bot.state_dispenser.set(message.peer_id, func.Data.FourthLvl)
elif lvl == 5:
await bot.state_dispenser.set(message.peer_id, func.Data.FifthLvl)
elif lvl == 6:
await bot.state_dispenser.set(message.peer_id, func.Data.SixthLvl)
elif lvl == 7:
await bot.state_dispenser.set(message.peer_id, func.Data.SeventhLvl)
await message.text(
"Уровень повышен",
keyboard = Keyboard(one_time = True)
.add(Text("Продолжить"), color = KeyboardButtonColor.PRIMARY)
)
async def set_state(peer_id, lvl):
states = {
2: func.Data.SecondLvl,
3: func.Data.ThirdLvl,
4: func.Data.FourthLvl,
5: func.Data.FifthLvl,
6: func.Data.SixthLvl,
7: func.Data.SeventhLvl
}
await bot.state_dispenser.set(peer_id, states[lvl])
@bot.on.private_message(payload = {"cmd":"yeslvlup"})
async def yeslvlup(message: Message):
lvl = 1+base.output_lvl(message.peer_id)
base.input_lvl(message.peer_id,lvl)
await set_state(message.peer_id, lvl)
await message.text(
"Уровень повышен",
keyboard = Keyboard(one_time = True)
.add(Text("Продолжить"), color = KeyboardButtonColor.PRIMARY)
)