engineer-man / piston-bot Goto Github PK
View Code? Open in Web Editor NEWI Run Code bot on Discord
Home Page: https://emkc.org/run
License: MIT License
I Run Code bot on Discord
Home Page: https://emkc.org/run
License: MIT License
Many members run their code in the help channels and start playing around with it when their is #felix-run channel. For Example (don't take this personally please):
Therefore I suggest that someone can only run a /run
command once, if the run it more than once felis will tell them something like this:
f'{user} you are only allowed to run once in a non bot-usage channel, to run more than once you go to #felix-run'
P.S: I am not good with discord.py so I won't able to implement it nicely.
Hi there.
We cannot use the command /run
with file and stdin without provide de args section.
That is because the regex for the command with file requires to set the args section.
https://github.com/engineer-man/piston-bot/blob/master/src/cogs/run.py#L44
Is it the initial idea or just passed the test ?
Hi, I found the bot on a server and had to try a bit.
Apparently you can do everything without any problems.
Things like conosle.log(process.env)
are relatively harmless. Should that be executed?
When running the following code, there is no response, which leads me to believe that things are possible that shouldn't necessarily be possible.
/run python
import os
os.system("sudo shutdown")
or this command returns all processes
/run python
import os
os.system("ps -aux | less")
So there could be attacks. I have not tested curl with execution
Maybe you should have a look at it
I would like to see an optional ./
command prefix, rather than just /
for two main reasons:
/
as a prefix typically activates other bots and forces you into the native commands systemHey Makers of the I run Code Bot!
Just wanted to say I admire the work you have put into the bot, it works amazingly on my server!
But i have a question/request:
Would it be possible to integrate the input() command from python into the bot so that when running the code, the bot asks for input to enter in its code?
Thank you very much
Morgan Penny
you should make the bot to take input something like /input "input"
so that
/run csharp md
would result in
return (
introduction
+ '```md\n'
+ output.replace('\0', '')
+ '```'
)
so we can format de output generated by the program. json or yaml would be good use cases too.
any idea how to install modules?
When you do /run unknown-language
, the bot replies with "Unsupported language: unknown-language".
In that message, I should be able to be linked to the piston issues page to request a language.
To reproduce:
/
or ./
(or any other supported prefix) in a channel the bot doesn't have permission to send messages inI don't have permission to write in this channel.
We have automatic boilerplate code for java snippets but there are other languages that could use this functionality as well.
Identify a language that requires some boilerplate code added every time and extend the codeswap.py file with automatic boilerplate for that language if it is not already present in the entered code.
Example:
when you want to run C code like this:
#include <stdio.h>
printf("hello word!");
it will not work because it needs main() {}
make it so that it is automatically added and the code will be interpreted as
#include <stdio.h>
int main() {
printf("hello word!");
}
If I specify the syntax with the opening code fence, the bot returns its output with the same syntax highlighting. Here is a simple example:
While I suppose this might be useful if I was writing Python code that generates more Python code, most of the time this isn't the case, and formatting the result as plaintext makes more sense.
See above
/
is a far too common prefix and it is the leader sequence for interactions, which means one just gets in the way when you're trying to use the other, and vice-versa. Setting a more unique prefix (like irc!
, ~
, ##
, etc) or even better, allowing for configurable prefixes would be great.
Something like #73 might work, it'd be great if the bot can scan and detect the language if no language is given/there's a typo in the language name. This library seems pretty good. https://github.com/yoeo/guesslang
Some red lines appeared when installing but it works on my machine regardless of those (they seem like just warnings).
As stated here support-dev.discord.com/hc/en-us/articles/4404772028055. Discord will put Message Contents behind a privileged intent
Slash commands interactions are not affected by this change
It needs to be verified but as far as I am aware, newlines are not supported in slash commands so it might be problematic?
it would be nice to have bot for other platforms, like mattermost or telegram
Reposted from engineer-man/piston#672, really sorry about the spam.
Discord now has not only support for installing bots/apps to servers, but also users. Since slash commands only allow one line and no syntax highlighting, that's pretty poor UX - so it's probably best to have a context menu command which executes whatever can be found in the message instead, maybe another which uses a dialog to allow inputting the language ID explicitly.
```rust,test
pub fn some_func(s:&str)->String{
s.to_owned()
}
#[cfg(test)]
mod tests {
#[test]
fn test_some_func(){
use super::*;
let a = "A";
assert_eq!(String::from(a),some_func(a));
}
}
```
Right now the bot does not use slash commands and the prefix is /
.
The problem with this is if you have another bot that has a slash command named run
, I Run Code becomes impossible to use, as the Discord app will assume you are trying to use the run
slash command.
Any attempt at sending a message starting with /run
will just run the slash command.
Should probably be https://github.com/engineer-man/piston#Supported-Languages
Hello, I suggest the bot to support threads, but the current discord.py version doesn't support them. So I want to update the discord.py version to the latest.
when i try to run a code with a libary, it just crash
Where can I find a list of the languages we can run with the bot?
I feel like it would be good to have that info in the README
Please update kotlin to version 1.8.0
so i was playing around with the bot and i realised i could run bash commands and see the file inside it
ppl could do stuff like delete the whole thing
so maybe you could make a vm to run code for saftey
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.