![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
github.com/sapphire-cord/eval
This repository contains a few backends for an eval command for your sapphire bots.
Eval is a command that executes dynamic code on the bot's host, it's very dangerous if given access to anyone untrusted but for the owner's personal use it's very powerful and lets you test some stuff quickly.
If you are coming from discord.js you sure heard of it, in Go however the language is compiled and doesn't have runtime execution of code so we need to plug-in an embeddable scripting language and pass values in between to allow dynamic behaviour, this repository does just that, it includes some backends for the most popular scripting engines to plug in an eval command to your bots.
Install your preferred backend and call some initialization in your bot, the available backends currently are:
$ go get github.com/sapphire-cord/eval/<your-backend>
Replace <your-backend>
with one of the above and import it in your entry file and initialize it, for example
// import
import (
"github.com/sapphire-cord/eval/<your-backend>"
)
// wherever you made a bot instance also initialize eval before logging in.
eval.Init(bot, "eval", "Owner", []string{"ev"})
Notes:
<your-backend>
with the backend you previously installed.eval
which can conflict if you want to use multiple backends, prefer to use go's import aliases. (see below)Sometimes you want to have more eval backends, we made it easy by allowing you to specify the name, category and aliases when registering so it doesn't conflict, now only the packages conflict but you can use an import alias:
import (
one "github.com/sapphire-cord/eval/backend1"
two "github.com/sapphire-cord/eval/backend2"
)
// When initializing.
one.Init(bot, "eval1", "Owner", []string{"ev1"})
two.Init(bot, "eval2", "Owner", []string{"ev2"})
After initialized, call the command with your prefix + whatever name you choosed at initialization and pass it a script of the choosen backend language, additionally these extra variables are exposed globally in the context of eval to make it more useful:
ctx
The command context.bot
Alias to ctx.Botsession
Alias to ctx.SessionWhich lets you do almost anything you can do in Go, only dynamically from Discord!
The eval backends also strip off codeblocks from the input so feel free to put your code inside a fancy codeblock.
Feel free to suggest or contribute new backends.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.