From 80ec2b9d9e4bd5e0e8dd100001bb98da0bf8fdc8 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Mon, 30 Jan 2023 20:20:29 +0300 Subject: [PATCH] Make it functional --- v_repl_bot/__init__.py | 4 ++-- v_repl_bot/cogs/repl.py | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/v_repl_bot/__init__.py b/v_repl_bot/__init__.py index 45cb011..fa5807b 100644 --- a/v_repl_bot/__init__.py +++ b/v_repl_bot/__init__.py @@ -32,11 +32,11 @@ class ReplBot(CommandsBot): command_prefix = when_mentioned_or("&"), strip_after_prefix = True, case_insensitive = True, - status = Game("on play.minearchy.com"), - owner_ids = { 512640455834337290 }, + status = Game("in the V playground"), allowed_mentions = AllowedMentions.none(), max_messages = 100, intents = Intents( + guilds = True, messages = True, message_content = True, ), diff --git a/v_repl_bot/cogs/repl.py b/v_repl_bot/cogs/repl.py index ac8b0df..1f57db4 100644 --- a/v_repl_bot/cogs/repl.py +++ b/v_repl_bot/cogs/repl.py @@ -28,17 +28,20 @@ class REPL( async def eval( self, ctx: Context, + *, code: Codeblock | None = commands.param(converter = codeblock_converter, default = None) ) -> None: if code is None: await ctx.reply("No code provided.") + return - with self.bot.session.post( - "https://vlang.io/play", + async with await self.bot.session.post( + "https://play.vlang.io/run", data = { "code": code.content }, ) as response: + text = await response.text() await ctx.reply( - "```\n" + response.text.replace("`", "\u200B`\u200B") + "\n```" + "```\n" + text.replace("`", "\u200B`\u200B") + "\n```" ) # Zero-width space.