File size: 1,122 Bytes
11fa042
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from pyrogram import Client, filters
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
from ..utils.helper import check_chat
from ..db.users import users_db

@Client.on_message(filters.command("reset"))
async def reset_handler(bot: Client, message):
    if not await check_chat(message, chat='Both'):
        return
    
    if message.chat.type != "private":
        bot_info = await bot.get_me()
        keyboard = InlineKeyboardMarkup([
            [InlineKeyboardButton("Reset Settings in DM", url=f"https://t.me/{bot_info.username}?start=reset")]
        ])
        await message.reply(
            "▸ <b>Reset</b>\n"
            "Status: ● Private Only\n\n"
            "<blockquote>Settings can only be reset in private chat.\n"
            "Please DM me to reset your encoding preferences.</blockquote>",
            reply_markup=keyboard
        )
        return
        
    u_id = message.from_user.id
    await users_db.delete_user(u_id)
    await users_db.add_user(u_id)
    
    await message.reply("▸ <b>Settings</b>\nStatus: ● Reset\nYour settings have been reset to default.")