1
Fork 0
mirror of https://github.com/RGBCube/VReplBot synced 2025-07-27 08:27:45 +00:00

Make it functional

This commit is contained in:
RGBCube 2023-01-30 20:20:29 +03:00
parent 9eb87f0c8d
commit 80ec2b9d9e
2 changed files with 8 additions and 5 deletions

View file

@ -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.