Spaces:
Running on Zero
Running on Zero
File size: 4,389 Bytes
60e9648 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | from pyrogram import Client, filters
from pyrogram.types import CallbackQuery, Message, InlineKeyboardButton, InlineKeyboardMarkup
#===============================================================#
async def texts(client, query):
msg = f"""<blockquote>**Text Configuration:**</blockquote>
**Start Message:**
<pre>{client.messages.get('START', 'Empty')}</pre>
**Force Sub Message:**
<pre>{client.messages.get('FSUB', 'Empty')}</pre>
**About Message:**
<pre>{client.messages.get('ABOUT', 'Empty')}</pre>
**Reply Message:**
<pre>{client.reply_text}</pre>
"""
reply_markup = InlineKeyboardMarkup([
[InlineKeyboardButton(f'ꜱᴛᴀʀᴛ ᴛᴇxᴛ', 'start_txt'), InlineKeyboardButton(f'ꜰꜱᴜʙ ᴛᴇxᴛ', 'fsub_txt')],
[InlineKeyboardButton('ʀᴇᴘʟʏ ᴛᴇxᴛ', 'reply_txt'), InlineKeyboardButton('ᴀʙᴏᴜᴛ ᴛᴇxᴛ', 'about_txt')],
[InlineKeyboardButton('◂ ʙᴀᴄᴋ', 'settings')]]
)
await query.message.edit_text(msg, reply_markup=reply_markup)
return
#===============================================================#
@Client.on_callback_query(filters.regex("^start_txt$"))
async def start_txt(client: Client, query: CallbackQuery):
await query.answer()
ask_text = await client.ask(query.from_user.id, "Send new start text message in the next 60 seconds, send `0` to cancel or wait 60 seconds!\n\n__Note you can use both markdown and html formatting!__", filters=filters.text, timeout=60)
try:
text = ask_text.text
if text == '0':
return await ask_text.reply("__Start text has not changed!__")
client.messages['START'] = text
await texts(client, query)
return await ask_text.reply("__Start text has been changed!__")
except Exception as e:
return client.logger(__name__, client.name).error(e)
#===============================================================#
@Client.on_callback_query(filters.regex("^fsub_txt$"))
async def force_txt(client: Client, query: CallbackQuery):
await query.answer()
ask_text = await client.ask(query.from_user.id, "Send new force sub text message in the next 60 seconds, send `0` to cancel or wait 60 seconds!\n\n__Note you can use both markdown and html formatting!__", filters=filters.text, timeout=60)
try:
text = ask_text.text
if text == '0':
return await ask_text.reply("__Force Sub text has not changed!__")
client.messages['FSUB'] = text
await texts(client, query)
return await ask_text.reply("__Force Sub text has been changed!__")
except Exception as e:
return client.logger(__name__, client.name).error(e)
#===============================================================#
@Client.on_callback_query(filters.regex("^about_txt$"))
async def about_txt(client: Client, query: CallbackQuery):
await query.answer()
ask_text = await client.ask(query.from_user.id, "Send new about text message in the next 60 seconds, send `0` to cancel or wait 60 seconds!\n\n__Note you can use both markdown and html formatting!__", filters=filters.text, timeout=60)
try:
text = ask_text.text
if text == '0':
return await ask_text.reply("__About text has not changed!__")
client.messages['ABOUT'] = text
await texts(client, query)
return await ask_text.reply("__About text has been changed!__")
except Exception as e:
return client.logger(__name__, client.name).error(e)
#===============================================================#
@Client.on_callback_query(filters.regex("^reply_txt$"))
async def reply_txt(client: Client, query: CallbackQuery):
await query.answer()
ask_text = await client.ask(query.from_user.id, "Send new reply text message in the next 60 seconds, send `0` to cancel or wait 60 seconds!\n\n__Note you can use both markdown and html formatting!__", filters=filters.text, timeout=60)
try:
text = ask_text.text
if text == '0':
return await ask_text.reply("__Reply text has not changed!__")
client.reply_text = text
await texts(client, query)
return await ask_text.reply("__Reply text has been changed!__")
except Exception as e:
return client.logger(__name__, client.name).error(e) |