2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-31 06:26:04 +00:00

make messages more friendly

This commit is contained in:
Nick80835
2020-06-06 11:04:14 -04:00
parent 4a43c528cf
commit 81127faa02
16 changed files with 88 additions and 93 deletions

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
import asyncio
from platform import python_version, uname
from platform import python_version
from time import time_ns
from telethon import version
@@ -13,7 +13,7 @@ ldr = micro_bot.loader
@ldr.add("reload", sudo=True)
async def reload_modules(event):
reload_msg = await event.reply("`Reloading modules…`")
reload_msg = await event.reply("Reloading modules…")
errors = ldr.reload_all_modules()
@@ -21,7 +21,7 @@ async def reload_modules(event):
await reload_msg.edit(errors)
else:
try:
await reload_msg.edit("`Successfully reloaded.`")
await reload_msg.edit("Successfully reloaded.")
except:
pass
@@ -44,7 +44,7 @@ async def help_cmd(event):
help_string += f"`{info}`, "
help_string = help_string.rstrip(", ")
await event.reply(f"`Available commands:`\n{help_string}")
await event.reply(f"**Available commands:**\n{help_string}")
@ldr.add("sysd", sudo=True)
@@ -62,31 +62,29 @@ async def sysd(event):
await event.reply(f"`{stdout.decode().strip()}{stderr.decode().strip()}`")
except FileNotFoundError:
await event.reply("`Neofetch not found!`")
await event.reply("Neofetch not found!")
@ldr.add("alive", sudo=True)
async def alive(event):
alive_format = "`μBot is running under {0}.\n\n" \
"Version: {1}\n" \
"Telethon: {2}\n" \
"Python: {3}`"
alive_format = "**Telethon version:** {0}\n" \
"**Python version:** {1}"
await event.reply(alive_format.format(uname().node, ldr.botversion, version.__version__, python_version()))
await event.reply(alive_format.format(version.__version__, python_version()))
@ldr.add("shutdown", sudo=True)
async def shutdown(event):
await event.reply("`Goodbye…`")
await event.reply("Goodbye…")
await micro_bot.stop_client()
@ldr.add("ping")
async def ping(event):
start = time_ns()
ping_msg = await event.reply("`Ping…`")
ping_msg = await event.reply("Ping…")
time_taken_ms = int((time_ns() - start) / 1000000)
await ping_msg.edit(f"`Ping… Pong! -> `**{time_taken_ms}**`ms`")
await ping_msg.edit(f"Ping… Pong! -> **{time_taken_ms}**ms")
@ldr.add("repo")