š Flask App
import asyncio
import time
from datetime import datetime
from spluspy import Client
SESSION = "vikaivis_self"
TRIGGER = "7"
BOX_INTERVAL = 0.20
ANIMATION_INTERVAL = 0.60
client = Client(SESSION)
animation_running = False
RABBIT_FRAMES = [
r""" (\_/)
(o.o) āāāāāāāāāāāāāāāāāā
/ > ā vikaivis_bot ā
āāāāāāāāāāāāāāāāāā""",
r""" (\_/)
(o.o) āāāāāāāāāāāāāāāāāā
/ > ā vikaivis_bot ā
āāāāāāāāāāāāāāāāāā""",
r""" (\_/)
(o.o) āāāāāāāāāāāāāāāāāā
/ > ā vikaivis_bot ā
āāāāāāāāāāāāāāāāāā""",
r""" (\_/)
(o.o) āāāāāāāāāāāāāāāāāā
/ > ā vikaivis_bot ā
āāāāāāāāāāāāāāāāāā"""
]
BOX_FRAMES = [
"ā",
"āāāāāāāāāāāāāāāāāāāāāāāāāā®\nā ā\nā°āāāāāāāāāāāāāāāāāāāāāāāāāÆ",
"āāāāāāāāāāāāāāāāāāāāāāāāāā®\nā ŲØŪŁ Ų±Ł ŚŚ© ک٠ā\nā°āāāāāāāāāāāāāāāāāāāāāāāāāÆ",
"āāāāāāāāāāāāāāāāāāāāāāāāāā\nā ā\nāāāāāāāāāāāāāāāāāāāāāāāāāā",
"āāāāāāāāāāāāāāāāāāāāāāāāāā\nā ŲØŪŁ Ų±Ł ŚŚ© ک٠ā\nāāāāāāāāāāāāāāāāāāāāāāāāāā"
]
def build_text(frame, start_time):
now = datetime.now()
elapsed = int(time.monotonic() - start_time)
hours, remainder = divmod(elapsed, 3600)
minutes, seconds = divmod(remainder, 60)
rabbit = RABBIT_FRAMES[frame % len(RABBIT_FRAMES)]
box = BOX_FRAMES[min(frame, len(BOX_FRAMES) - 1)]
return (
f"{rabbit}\n\n"
f"{box}\n\n"
f"āāāāāāāāāāāāāāāāāāāā\n"
f" VIKAIVIS\n"
f"āāāāāāāāāāāāāāāāāāāā\n"
f"š Ų³Ų§Ų¹ŲŖ: {now.strftime('%H:%M:%S')}\n"
f"š
ŲŖŲ§Ų±ŪŲ®: {now.strftime('%Y-%m-%d')}\n"
f"ā³ Ų§Ų¬Ų±Ų§: {hours:02}:{minutes:02}:{seconds:02}"
)
async def animate_message(message):
start_time = time.monotonic()
frame = 0
while True:
text = build_text(frame, start_time)
try:
updated_message = await message.edit(text)
if updated_message is not None:
message = updated_message
frame += 1
except asyncio.CancelledError:
raise
except Exception as error:
print(f"[EDIT ERROR] {type(error).name}: {error}")
await asyncio.sleep(2)
continue
if frame <= len(BOX_FRAMES):
await asyncio.sleep(BOX_INTERVAL)
else:
await asyncio.sleep(ANIMATION_INTERVAL)
@client.on_me()
async def handle_own_message(client, event):
global animation_running
try:
original = getattr(event, "message", None)
if original is None:
return
text = getattr(original, "message", None)
if text is None:
text = getattr(original, "text", "")
if str(text).strip() != TRIGGER:
return
if animation_running:
return
animation_running = True
try:
start_time = time.monotonic()
first_text = build_text(0, start_time)
sent_message = await event.reply(first_text)
if sent_message is not None:
await animate_message(sent_message)
finally:
animation_running = False
except asyncio.CancelledError:
raise
except Exception as error:
animation_running = False
print(f"[HANDLER ERROR] {type(error).name}: {error}")
async def main():
await client.start()
print("VIKAIVIS connected. Send 7 to start.")
await client.run_until_disconnected()
if name == "main":
try:
asyncio.run(main())
except KeyboardInterrupt:
print("Stopped.")
except Exception as error:
print(f"[FATAL ERROR] {type(error).name}: {error}")