mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 08:27:38 +00:00
autochange 自动启动
This commit is contained in:
parent
26bbc145d3
commit
1ed1c31166
@ -7,18 +7,23 @@ from telethon.tl.functions.account import UpdateProfileRequest
|
|||||||
from emoji import emojize
|
from emoji import emojize
|
||||||
from pagermaid import bot, log
|
from pagermaid import bot, log
|
||||||
from pagermaid.listener import listener
|
from pagermaid.listener import listener
|
||||||
from pagermaid.utils import alias_command
|
|
||||||
|
|
||||||
|
auto_change_name_init = False
|
||||||
dizzy = emojize(":dizzy:", use_aliases=True)
|
dizzy = emojize(":dizzy:", use_aliases=True)
|
||||||
cake = emojize(":cake:", use_aliases=True)
|
cake = emojize(":cake:", use_aliases=True)
|
||||||
all_time_emoji_name = ["clock12", "clock1230", "clock1", "clock130", "clock2", "clock230", "clock3", "clock330", "clock4", "clock430", "clock5", "clock530", "clock6", "clock630", "clock7", "clock730", "clock8", "clock830", "clock9", "clock930", "clock10", "clock1030", "clock11", "clock1130"]
|
all_time_emoji_name = ["clock12", "clock1230", "clock1", "clock130", "clock2", "clock230", "clock3", "clock330",
|
||||||
time_emoji_symb = [emojize(":%s:" %s, use_aliases=True) for s in all_time_emoji_name]
|
"clock4", "clock430", "clock5", "clock530", "clock6", "clock630", "clock7", "clock730", "clock8",
|
||||||
|
"clock830", "clock9", "clock930", "clock10", "clock1030", "clock11", "clock1130"]
|
||||||
|
time_emoji_symb = [emojize(":%s:" % s, use_aliases=True) for s in all_time_emoji_name]
|
||||||
|
|
||||||
|
|
||||||
@listener(is_plugin=True, outgoing=True, command=alias_command("autochangename"),
|
@listener(incoming=True, outgoing=True, ignore_edited=True)
|
||||||
description="每 30 秒更新一次 last_name")
|
|
||||||
async def change_name_auto(context):
|
async def change_name_auto(context):
|
||||||
await context.delete()
|
global auto_change_name_init
|
||||||
|
if auto_change_name_init:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
auto_change_name_init = True
|
||||||
await log("开始每 30 秒更新一次 last_name")
|
await log("开始每 30 秒更新一次 last_name")
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
@ -26,12 +31,8 @@ async def change_name_auto(context):
|
|||||||
hour, minu, seco, p, abbwn = time_cur.split(':')
|
hour, minu, seco, p, abbwn = time_cur.split(':')
|
||||||
if seco == '00' or seco == '30':
|
if seco == '00' or seco == '30':
|
||||||
shift = 0
|
shift = 0
|
||||||
mult = 1
|
|
||||||
if int(minu) > 30: shift = 1
|
if int(minu) > 30: shift = 1
|
||||||
# print((int(hour)%12)*2+shift)
|
|
||||||
# hour symbols
|
|
||||||
hsym = time_emoji_symb[(int(hour) % 12) * 2 + shift]
|
hsym = time_emoji_symb[(int(hour) % 12) * 2 + shift]
|
||||||
# await client1.send_message('me', hsym)
|
|
||||||
for_fun = random.random()
|
for_fun = random.random()
|
||||||
if for_fun < 0.10:
|
if for_fun < 0.10:
|
||||||
last_name = '%s时%s分 %s' % (hour, minu, hsym)
|
last_name = '%s时%s分 %s' % (hour, minu, hsym)
|
||||||
@ -43,7 +44,6 @@ async def change_name_auto(context):
|
|||||||
last_name = '%s' % dizzy
|
last_name = '%s' % dizzy
|
||||||
else:
|
else:
|
||||||
last_name = '%s' % cake
|
last_name = '%s' % cake
|
||||||
|
|
||||||
await bot(UpdateProfileRequest(last_name=last_name))
|
await bot(UpdateProfileRequest(last_name=last_name))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user