Files
limoka/KeyZenD/modules/calc.py
2025-07-10 21:02:34 +03:00

27 lines
848 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from .. import loader, utils
class КукуляторMod(loader.Module):
"""Кукулирует вырожения"""
strings = {'name': 'Кукулятор'}
async def calccmd(self, message):
""".calc <выражение или реплай на то, что нужно посчитать>
Кстати:
** - возвести в степень
/ - деление
% - деление по модулю"""
question = utils.get_args_raw(message)
reply = await message.get_reply_message()
if not question:
if not reply:
await utils.answer(message, "<b>2+2=5</b>")
return
else:
question = reply.raw_text
try:
answer = eval(question)
answer = f"<b>{question}=</b><code>{answer}</code>"
except Exception as e:
answer = f"<b>{question}=</b><code>{e}</code>"
await utils.answer(message, answer)