1
Fork 0
mirror of https://github.com/RGBCube/VReplBot synced 2025-07-26 16:07:45 +00:00
This commit is contained in:
RGBCube 2023-02-03 21:55:26 +03:00
parent 271706db7e
commit 5ede9f5f7d

View file

@ -37,18 +37,18 @@ class Playground(
async def run_test_common( async def run_test_common(
self, self,
ctx: Context, ctx: Context,
code: str | None, code_or_query: str | None,
*, *,
type: Literal["run"] | Literal["run_test"] type: Literal["run"] | Literal["run_test"]
) -> None: ) -> None:
if not code: if not code_or_query:
if not (reply := ctx.message.reference): if not (reply := ctx.message.reference):
await ctx.reply("No code provided.") await ctx.reply("No code provided.")
return return
content = await get_message_content(ctx.channel, reply) code_or_query = await get_message_content(ctx.channel, reply)
if (c_stripped := content.lstrip("https://")).startswith("play.vlang.io/?query="): if (c_stripped := code_or_query.lstrip("https://")).startswith("play.vlang.io/?query="):
query = c_stripped.lstrip("play.vlang.io/?query=").split(" ", 1)[0] query = c_stripped.lstrip("play.vlang.io/?query=").split(" ", 1)[0]
code = await self.get_query_content(query) code = await self.get_query_content(query)
@ -56,7 +56,7 @@ class Playground(
await ctx.reply("Invalid query.") await ctx.reply("Invalid query.")
return return
else: else:
code = codeblock_converter(content).content code = codeblock_converter(code_or_query).content
async with await self.bot.session.post( async with await self.bot.session.post(
f"https://play.vlang.io/{type}", f"https://play.vlang.io/{type}",