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