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: if not bot.owner_id:
raise RuntimeError("No owner ID set in niobot. Refusing to load for security reasons.") raise RuntimeError("No owner ID set in niobot. Refusing to load for security reasons.")
super().__init__(bot) super().__init__(bot)
self.log = logging.getLogger(__name__)
async def owner_check(self, ctx: niobot.Context) -> bool: 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.""" """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 ctx.client.add_reaction(ctx.room, ctx.message, "\N{cross mark}")
await msg.edit(f"Error:\n```py\n{traceback.format_exc()}```") await msg.edit(f"Error:\n```py\n{traceback.format_exc()}```")
@niobot.command("thumbnail", hidden=True) @niobot.command("thumbnail")
@niobot.is_owner() @niobot.is_owner()
async def thumbnail(self, ctx: niobot.Context, url: str, width: int = 320, height: int = 240): 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://"): if url.startswith("mxc://"):
parsed = urlparse(url) parsed = urlparse(url)
media_id = parsed.path.lstrip("/") media_id = parsed.path.lstrip("/")
@ -194,5 +196,4 @@ class EvalModule(niobot.Module):
) )
thumb.save("file.webp", "webp") thumb.save("file.webp", "webp")
attachment = await niobot.ImageAttachment.from_file("file.webp", generate_blurhash=True) 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) await ctx.respond("thumbnail.webp", file=attachment)