remove eval log

This commit is contained in:
Nexus 2024-09-08 01:39:16 +01:00
parent adc72ab13c
commit 69c166685f

View file

@ -23,7 +23,6 @@ class EvalModule(niobot.Module):
if not bot.owner_id:
raise RuntimeError("No owner ID set in niobot. Refusing to load for security reasons.")
super().__init__(bot)
self.log = logging.getLogger(__name__)
async def owner_check(self, ctx: niobot.Context) -> bool:
"""Checks if the current user is the owner, and if not, gives them a very informative message."""
@ -158,10 +157,13 @@ class EvalModule(niobot.Module):
await ctx.client.add_reaction(ctx.room, ctx.message, "\N{cross mark}")
await msg.edit(f"Error:\n```py\n{traceback.format_exc()}```")
@niobot.command("thumbnail", hidden=True)
@niobot.command("thumbnail")
@niobot.is_owner()
async def thumbnail(self, ctx: niobot.Context, url: str, width: int = 320, height: int = 240):
"""Get the thumbnail for a URL"""
"""Get the thumbnail for a URL.
URL can be an mxc, in which case C2S will be used to get a thumbnail.
Supplying a HTTP URL will use niobot thumbnailing."""
if url.startswith("mxc://"):
parsed = urlparse(url)
media_id = parsed.path.lstrip("/")
@ -194,5 +196,4 @@ class EvalModule(niobot.Module):
)
thumb.save("file.webp", "webp")
attachment = await niobot.ImageAttachment.from_file("file.webp", generate_blurhash=True)
self.log.info("Generated thumbnail: %r", attachment)
await ctx.respond("thumbnail.webp", file=attachment)