change some things

This commit is contained in:
blank X 2021-03-10 15:52:43 +07:00
parent c3b08e0c5f
commit 7574ec4821
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 7 additions and 6 deletions

View File

@ -2,19 +2,20 @@ import time
from pyrogram import Client, filters from pyrogram import Client, filters
from .. import config, help_dict, log_errors, public_log_errors, log_ring from .. import config, help_dict, log_errors, public_log_errors, log_ring
strings = {
'ping': 'Pong!',
'pong': 'Ping!'
}
@Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['ping', 'pong'], prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['ping', 'pong'], prefixes=config['config']['prefixes']))
@log_errors @log_errors
@public_log_errors @public_log_errors
async def ping_pong(client, message): async def ping_pong(client, message):
strings = {
'ping': 'Pong!',
'pong': 'Ping!'
}
text = strings[message.command[0].lower()] text = strings[message.command[0].lower()]
start = time.time() start = time.time()
reply = await message.reply_text(text) reply = await message.reply_text(f'{text}\n<b>Log Ring:</b> {len(log_ring)}/{log_ring.maxlen}')
end = time.time() end = time.time()
await reply.edit_text(f'{text}\n<i>{round((end-start)*1000)}ms</i>\n<b>Log Ring:</b> <i>{len(log_ring)}/{log_ring.maxlen}</i>') await reply.edit_text(f'{text} <i>{round((end-start)*1000)}ms</i>\n<b>Log Ring:</b> {len(log_ring)}/{log_ring.maxlen}')
help_dict['ping'] = ('Ping', help_dict['ping'] = ('Ping',
'''{prefix}ping - Pong! '''{prefix}ping - Pong!