mirror of
https://github.com/yawaflua/Easy_telegram_bot.git
synced 2025-12-14 01:16:26 +02:00
Telegram bot
This commit is contained in:
2
telegram bot/handlers/__init__.py
Normal file
2
telegram bot/handlers/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import personal_actions
|
||||
from . import callbacks
|
||||
4
telegram bot/handlers/callbacks.py
Normal file
4
telegram bot/handlers/callbacks.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from aiogram import types
|
||||
from dispatcher import dp
|
||||
import config
|
||||
|
||||
28
telegram bot/handlers/personal_actions.py
Normal file
28
telegram bot/handlers/personal_actions.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from aiogram import types
|
||||
from dispatcher import dp
|
||||
import config
|
||||
|
||||
@dp.message_handler(is_owner=True, commands=['setlink'])
|
||||
async def setlink_command(message: types.Message):
|
||||
with open('link.txt', 'w') as f:
|
||||
f.write(message.text.replpace('/setlink ', '').strip())
|
||||
f.close()
|
||||
|
||||
await message.answer('Link has been created')
|
||||
#
|
||||
@dp.message_handler(is_owner=True, commands=["getlink"])
|
||||
async def getlink_command(message: types.Message):
|
||||
with open('link.txt', 'r') as f:
|
||||
content = f.readlines()
|
||||
f.close()
|
||||
|
||||
await message.answer('Link: {}'.format(content[0].strip()))
|
||||
|
||||
@dp.message_handler(commands="test_buttons")
|
||||
async def cmd_buttons(message: types.Message):
|
||||
keyboard = types.ReplyKeyboardMarkup()
|
||||
button_1 = types.KeyboardButton(text="tested buttons⚠")
|
||||
keyboard.add(button_1)
|
||||
button_2 = "tested buttons ⚠"
|
||||
keyboard.add(button_2)
|
||||
await message.answer("Tested buttons", reply_markup=keyboard)
|
||||
Reference in New Issue
Block a user