Skip to content

Commit 5120168

Browse files
committed
New command in /help
1 parent ff494fa commit 5120168

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

app/handlers/basic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ async def list_commands(message: types.Message):
2121
"/start - Starts the bot.\n"
2222
"/help - lists all of the available commands.\n"
2323
"/now - Show server's live stats.\n"
24-
"/cpu_graph - Shows graph of CPU % over the last 24 hrs."
24+
"/cpu_graph - Shows graph of CPU % over the last 24 hrs. \n"
25+
"/settings - Change settings"
2526
)
2627

2728
@dp.message(~IsOwner())

app/settings/settings.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def settings_commands(dp):
2323
async def get_keyboard(message: types.Message):
2424
await message.reply("Settings are working", reply_markup=keyboard)
2525

26-
@dp.callback.query_handler(text=['interval_call', 'timezone_call'])
26+
@dp.callback_query(lambda call: call.data in ['interval_call', 'timezone_call'])
2727
async def callback_handler(call: types.CallbackQuery, state: FSMContext):
2828
if call.data == "interval_call":
2929
await call.message.answer("Enter the interval value in minutes")
@@ -33,15 +33,14 @@ async def callback_handler(call: types.CallbackQuery, state: FSMContext):
3333
await call.message.answer("Enter yout timezone location in America/New_York format")
3434
await state.set_state(SettingsStates.waiting_for_timezone)
3535

36-
@dp.message(SettingsStates.waiting_for_interval)
36+
@dp.message(SettingsStates.waiting_for_interval, IsOwner())
3737
async def process_interval(message: types.Message, state: FSMContext):
3838
interval_val = message.text
3939
sett.write_settings("update_interval", interval_val)
4040
await state.clear()
4141

42-
@dp.message(SettingsStates.waiting_for_timezone)
42+
@dp.message(SettingsStates.waiting_for_timezone, IsOwner())
4343
async def process_timezone(message: types.Message, state: FSMContext):
4444
timezone_val = message.text
4545
sett.write_settings("timezone", timezone_val)
46-
await state.clear()
47-
46+
await state.clear()

requirements.txt

1.03 KB
Binary file not shown.

0 commit comments

Comments
 (0)