mirror of
https://github.com/RGBCube/VReplBot
synced 2025-07-27 00:17:46 +00:00
Make it functional
This commit is contained in:
parent
9eb87f0c8d
commit
80ec2b9d9e
2 changed files with 8 additions and 5 deletions
|
@ -32,11 +32,11 @@ class ReplBot(CommandsBot):
|
||||||
command_prefix = when_mentioned_or("&"),
|
command_prefix = when_mentioned_or("&"),
|
||||||
strip_after_prefix = True,
|
strip_after_prefix = True,
|
||||||
case_insensitive = True,
|
case_insensitive = True,
|
||||||
status = Game("on play.minearchy.com"),
|
status = Game("in the V playground"),
|
||||||
owner_ids = { 512640455834337290 },
|
|
||||||
allowed_mentions = AllowedMentions.none(),
|
allowed_mentions = AllowedMentions.none(),
|
||||||
max_messages = 100,
|
max_messages = 100,
|
||||||
intents = Intents(
|
intents = Intents(
|
||||||
|
guilds = True,
|
||||||
messages = True,
|
messages = True,
|
||||||
message_content = True,
|
message_content = True,
|
||||||
),
|
),
|
||||||
|
|
|
@ -28,17 +28,20 @@ class REPL(
|
||||||
async def eval(
|
async def eval(
|
||||||
self,
|
self,
|
||||||
ctx: Context,
|
ctx: Context,
|
||||||
|
*,
|
||||||
code: Codeblock | None = commands.param(converter = codeblock_converter, default = None)
|
code: Codeblock | None = commands.param(converter = codeblock_converter, default = None)
|
||||||
) -> None:
|
) -> None:
|
||||||
if code is None:
|
if code is None:
|
||||||
await ctx.reply("No code provided.")
|
await ctx.reply("No code provided.")
|
||||||
|
return
|
||||||
|
|
||||||
with self.bot.session.post(
|
async with await self.bot.session.post(
|
||||||
"https://vlang.io/play",
|
"https://play.vlang.io/run",
|
||||||
data = { "code": code.content },
|
data = { "code": code.content },
|
||||||
) as response:
|
) as response:
|
||||||
|
text = await response.text()
|
||||||
await ctx.reply(
|
await ctx.reply(
|
||||||
"```\n" + response.text.replace("`", "\u200B`\u200B") + "\n```"
|
"```\n" + text.replace("`", "\u200B`\u200B") + "\n```"
|
||||||
) # Zero-width space.
|
) # Zero-width space.
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue