Skip to content

Commit

Permalink
buttons name
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhuchkaTriplesix committed Oct 25, 2023
1 parent ec8c3cb commit a9cab36
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 20 deletions.
10 changes: 5 additions & 5 deletions handlers/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
json_data = "user_list.json"


@router.message(F.text == '/cases')
@router.message(F.text == '💵CASES💵')
async def cases(message: Message):
x = ''
user_id = f"{message.from_user.id}"
Expand All @@ -27,7 +27,7 @@ async def cases(message: Message):
await message.answer("Вы не добавили кейсы.")


@router.message(F.text == "/add_case")
@router.message(F.text == "➕ADD CASE➕")
async def item_list(message: Message):
models.LogBase.add(message.from_user.id, message.from_user.username, "/add_case")
await message.answer("Какой кейс вы хотите добавить?:", reply_markup=kb.cases)
Expand Down Expand Up @@ -55,7 +55,7 @@ async def answer(callback: CallbackQuery):
pass


@router.message(F.text == '/clear')
@router.message(F.text == '🗑CLEAR🗑')
async def clear(message: Message):
models.LogBase.add(message.from_user.id, message.from_user.username, "/clear")
data = json_support.read_inf(json_data)
Expand All @@ -75,10 +75,10 @@ async def start(message: Message):
@router.message(F.text == "/help")
async def help_func(message: Message):
models.LogBase.add(message.from_user.id, message.from_user.username, "/help")
await message.answer("Помогите...")
await message.answer("А кнопки я зачем называл?")


@router.message(F.text == "/vip")
@router.message(F.text == "💎VIP💎")
async def get_vip(message: Message):
models.LogBase.add(message.from_user.id, message.from_user.username, "/vip")
if models.Users.check_vip(message.from_user.id) is True:
Expand Down
27 changes: 23 additions & 4 deletions handlers/vip.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

class AddInventory(StatesGroup):
add_item_state = State()
delete_item_state = State()


@router.message(F.text == "/support")
@router.message(F.text == "⁉️SUPPORT⁉️")
async def support(message: Message):
models.LogBase.add(message.from_user.id, message.from_user.username, "/support")
if models.Users.check_vip(message.from_user.id) is True:
Expand All @@ -24,15 +25,15 @@ async def support(message: Message):
await message.answer("У вас нет доступа к этой команде")


@router.message(F.text == "/vip_help")
@router.message(F.text == "❓VIP HELP❓")
async def vip_help(message: Message):
models.LogBase.add(message.from_user.id, message.from_user.username, "/vip_help")
await message.answer(
"Команды для Vip пользователей:\n/support - Персональная помощь с ботом\n/add_item - Добавить предметы\n/my_items - Ваши предметы")


# noinspection PyTypeChecker
@router.message(F.text == "/my_items")
@router.message(F.text == "📈MY ITEMS📈")
async def my_cases(message: Message):
models.LogBase.add(message.from_user.id, message.from_user.username, "/my_items")
if models.Users.check_vip(message.from_user.id) is True:
Expand Down Expand Up @@ -63,7 +64,7 @@ async def items_price(callback: CallbackQuery):
await callback.message.answer(answer)


@router.message(F.text == "/add_item")
@router.message(F.text == "➕ADD ITEM➕")
async def add_item(message: Message, state: FSMContext):
models.LogBase.add(message.from_user.id, message.from_user.username, "/add_item")
await message.answer(
Expand All @@ -74,6 +75,7 @@ async def add_item(message: Message, state: FSMContext):
@router.message(AddInventory.add_item_state, F.text)
async def add_item_bd(message: Message, state: FSMContext):
mes = message.text.split(".")
print(mes)
hash_name = mes[0]
try:
item_count = int(mes[1])
Expand All @@ -84,3 +86,20 @@ async def add_item_bd(message: Message, state: FSMContext):
except ValueError:
await message.answer("Ошибка ввода")
await state.clear()


@router.message(F.text == "❌DELETE❌")
async def delete_item(message: Message, state: FSMContext):
models.LogBase.add(message.from_user.id, message.from_user.username, "/delete")
if models.Users.check_vip(message.from_user.id) is True:
await message.answer("Введите название предмета.")
await state.set_state(AddInventory.delete_item_state)
else:
await message.answer("У вас недостаточно прав.")


@router.message(AddInventory.delete_item_state, F.text)
async def delete_item_state(message: Message, state: FSMContext):
models.Items.delete_item(message.from_user.id, message.text)
await message.answer(f"Вы успешно удалили {message.text}")
await state.clear()
17 changes: 9 additions & 8 deletions keyboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
InlineKeyboardMarkup, InlineKeyboardButton)

main = [
[KeyboardButton(text="/cases"),
KeyboardButton(text="/add_case")],
[KeyboardButton(text="💵CASES💵"),
KeyboardButton(text="➕ADD CASE➕")],
[
KeyboardButton(text="/clear"),
KeyboardButton(text="/vip")]
KeyboardButton(text="🗑CLEAR🗑"),
KeyboardButton(text="💎VIP💎")]
]
main_kb = ReplyKeyboardMarkup(keyboard=main, resize_keyboard=True)
cases_inline = [
Expand Down Expand Up @@ -71,9 +71,10 @@
]
admins_kb = ReplyKeyboardMarkup(keyboard=admin_keyboard, resize_keyboard=True)
user_vip_keyboard = [
[KeyboardButton(text="/add_item"),
KeyboardButton(text="/my_items")],
[KeyboardButton(text="/support"),
KeyboardButton(text="/vip_help")]
[KeyboardButton(text="➕ADD ITEM➕"),
KeyboardButton(text="📈MY ITEMS📈")],
[KeyboardButton(text="❌DELETE❌"),
KeyboardButton(text="⁉️SUPPORT⁉️"),
KeyboardButton(text="❓VIP HELP❓")]
]
users_vip_kb = ReplyKeyboardMarkup(keyboard=user_vip_keyboard, resize_keyboard=True)
3 changes: 0 additions & 3 deletions user_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,5 @@
"960622004": [
"Snakebite Case",
"Revolution Case"
],
"736491563": [
"Operation Breakout Weapon Case"
]
}

0 comments on commit a9cab36

Please sign in to comment.