mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-24 21:43:37 +00:00
teletype fix a bug
This commit is contained in:
parent
217d37396c
commit
cebaeff68d
@ -1,25 +1,26 @@
|
||||
from asyncio import sleep
|
||||
from pyrogram import Client
|
||||
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import lang, Message
|
||||
|
||||
@listener(is_plugin=False, incoming=True, command="teletype",
|
||||
description=lang('teletype_des'),
|
||||
parameters="<message>")
|
||||
async def teletype(_: Client, context: Message):
|
||||
if not context.arguments:
|
||||
return await context.edit("出错了呜呜呜 ~ 空白的参数。")
|
||||
|
||||
@listener(is_plugin=False, command="teletype",
|
||||
description=lang('teletype_des'),
|
||||
parameters="<message>")
|
||||
async def teletype(message: Message):
|
||||
if not message.arguments:
|
||||
return await message.edit("出错了呜呜呜 ~ 空白的参数。")
|
||||
try:
|
||||
message = context.arguments
|
||||
text = message.arguments
|
||||
except ValueError:
|
||||
await context.edit("出错了呜呜呜 ~ 无效的参数。")
|
||||
await message.edit("出错了呜呜呜 ~ 无效的参数。")
|
||||
return
|
||||
interval = 0.05
|
||||
cursor = "█"
|
||||
buffer = ''
|
||||
msg = await context.edit(cursor)
|
||||
msg = await message.edit(cursor)
|
||||
await sleep(interval)
|
||||
for character in message:
|
||||
for character in text:
|
||||
buffer = f"{buffer}{character}"
|
||||
buffer_commit = f"{buffer}{cursor}"
|
||||
await msg.edit(buffer_commit)
|
||||
@ -28,4 +29,6 @@ async def teletype(_: Client, context: Message):
|
||||
await msg.edit(buffer)
|
||||
except MessageNotModifiedError:
|
||||
pass
|
||||
except Exception:
|
||||
return
|
||||
await sleep(interval)
|
||||
|
Loading…
Reference in New Issue
Block a user