adikso / bashbot Goto Github PK
View Code? Open in Web Editor NEWBashBot is a Discord bot that allows terminal access via chat
License: GNU General Public License v3.0
BashBot is a Discord bot that allows terminal access via chat
License: GNU General Public License v3.0
I'd love to run this on my pi, in a docker container.
Thoughts?
Allow us to configure a macro to automatically run upon opening a terminal session. This would allow one to get a specific set of controls up and ready to go instantly when opening a new session, and any other important commands.
https://docs.python.org/3/whatsnew/3.7.html
Simply renaming the async calls fixes this issue
Here is the traceback :
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/discord.py-1.2.3-py3.7.egg/discord/client.py", line 270, in _run_event
await coro(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/bashbot-1.0-py3.7.egg/bashbot/bot.py", line 49, in on_message
if is_command(message):
File "/usr/local/lib/python3.7/dist-packages/bashbot-1.0-py3.7.egg/bashbot/bot.py", line 120, in is_command
if message.channel.is_private:
AttributeError: 'DMChannel' object has no attribute 'is_private'
I tried in a channel, and in private message
I don't think I miss something in the installation process...
Cordially
If you want to talk to me directly from Discord :
Dezyox#3310
I'd like to see some support for the CTRL-C shortcut, to be able to quit running apps in the terminal session. In the meantime, I suppose one can use a macro that sends the ETX character.
I am running a bash script through BashBot and the script has quite many options to be displayed . BashBot generated tty in discord only lets me see the bottom half of the script ( it first shows the top half and then immediately shows the bottom half )
So is it possible to add a scrollbar to the terminal .If not , you can make the tty screen height unlimited ( ie. When a user opens tty and starts any process , it can display everything from start to end without replacing older text and tty height can be as long as it needs to be ). I don't know if you might have a better solution to this problem but it would really great have this issue addressed
Thank you
I got this output when i start the bot via python bashbot.py (rewrite repo)
[2019-11-24 02:20:52] WARNING:discord.client: PyNaCl is not installed, voice will NOT be supported
[2019-11-24 02:20:52] INFO:discord.client: logging in using static token
[2019-11-24 02:20:52] INFO:discord.client: Cleaning up tasks.
[2019-11-24 02:20:52] INFO:discord.client: Closing the event loop.
[2019-11-24 02:20:52] ERROR:Launcher: Improper token has been passed.
I have tried your both repo, master and rewrite, both have the same error. I give the correct token. (Bot token)
When i type"$.open name", it returns a message saying it is starting, but in the console, it has a python error on line 58 in sessions.py execute_async(message.edit, content=content)
. It says that "Nonetype has no attribute 'edit'". I presume that "Nonetype" is the message. I've tried a lot of things, but it always returns the same message. First time using this bot, and help would be appreciated. Thanks!
I want to type a command without having to put "\n" at the end every time. Is there anyway I can edit to make this happen? thanks.
Add a setting that makes the bot delete the message with the terminal box when the session is closed.
Currently in private message, the bot only responds to default commands shown here - https://github.com/Adikso/BashBot#commands
It doesn't responds to actual commands that we input . Can you please make it work properly in private message , that would be really great :)
Edit - Noticed that this option is already present
I want to send a single command. How do I do that without opening a terminal?
Something like "source .bashrc" -
for just this command, I have to do
anything to make it one liner? I know I can use a macro. but possible to just run the command? with a prefix maybe or something?
When running "$.permission list", the following error spits out
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 307, in _run_event
yield from getattr(self, event)(*args, **kwargs)
File "/home/adminrat/Downloads/BashBot/bashbot/bot.py", line 64, in on_message
success = await commands_manager.execute(client, message)
File "/home/adminrat/Downloads/BashBot/bashbot/commands/__init__.py", line 88, in execute
await command.execute(client, message, alias, args)
File "/home/adminrat/Downloads/BashBot/bashbot/commands/__init__.py", line 59, in execute
await getattr(self, action)(client, message, parameters)
AttributeError: 'PermissionCommand' object has no attribute 'list_all'
Hi, I tend to use controls quite alot, I have even set up a particular set of commands for when I want to use them so I just have to copy paste, and as you can see, it's quite long...
That's already 4 characters.
3 more.
And append another 12...
Add another final 7.
So in total, that makes us 4 + 3 + 12 + 7 = 26 keys to set, so with character count for all commands, removing whitespaces in between sections that makes us a whopping 765 characters to type.
Honestly that's almost half of discord's allowed per message character limit. That's way too much. Please either make a configuration file; a save command; a startup preset or bulk insertion. That's way too much.
Even after editing the code to fix intent errors, the bot never responds!
so in my friend's server i wanted to run a bash bot for the whitelist program (for a minecraft server) made of shell script as it is made of shell script others can't run it so i decided to use this bot but it didn't work so i tried sh script.sh -asd (the code)
Ignoring exception in on_message Traceback (most recent call last): File "/home/clerickx/.local/lib/python3.9/site-packages/discord/client.py", line 312, in _run_event await coro(*args, **kwargs) File "/home/clerickx/BashBot/bashbot/bot.py", line 136, in on_message await message.delete() File "/home/clerickx/.local/lib/python3.9/site-packages/discord/message.py", line 759, in delete await self._state.http.delete_message(self.channel.id, self.id) File "/home/clerickx/.local/lib/python3.9/site-packages/discord/http.py", line 241, in request raise Forbidden(r, data) discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
and then it gave me this message
Hey there,
this is my first time using this bot, so please bare with me.
I've installed it on a Ubuntu 20.04 server, exactly according to your documentation (besides replacing pip/python-commands with pip3/python3 for obvious reasons).
It runs fine, but just doesn't do anything.
It was invited to my server, is in a channel where it has nearly all permissions but just doesn't respond to "$help", "$.help" or ".bash help". The log doesn't give any information besides that it's been started, its ID and how to invite it. Discord shows it as online.
Is there any thing I could've missed? If you need further details, please let me know what exactly and I'll happily provide it.
Hello,
I am trying to setup the permissions for the bot but i can't make it right and python always make me an error at startup here is the permissions i am "trying" to apply for now.
{
"default": {
"chat.write": true,
"info.about": false,
"info.help": true,
"input.controls.manage": false,
"input.repeat": false,
"internal.settings": false,
"permissions.manage": false,
"permissions.manage.edit": false,
"permissions.manage.view": false,
"session.close": false,
"session.freeze": false,
"session.kill": false,
"session.killall": false,
"session.list": true,
"session.move": false,
"session.open": false,
"session.rename": false,
"session.select": false
}
"admin": {
"chat.write": true,
"info.about": false,
"info.help": true,
"input.controls.manage": false,
"input.repeat": false,
"internal.settings": false,
"permissions.manage": false,
"permissions.manage.edit": false,
"permissions.manage.view": false,
"session.close": false,
"session.freeze": false,
"session.kill": false,
"session.killall": false,
"session.list": true,
"session.move": false,
"session.open": false,
"session.rename": false,
"session.select": false
}
}
When i try to run it it does this error :
Loaded `/root/.bashbot/settings.json`
Traceback (most recent call last):
File "/usr/local/bin/bashbot", line 11, in <module>
load_entry_point('bashbot==1.0', 'console_scripts', 'bashbot')()
File "/usr/local/lib/python3.6/dist-packages/bashbot-1.0-py3.6.egg/bashbot/main.py", line 7, in main
File "/usr/local/lib/python3.6/dist-packages/bashbot-1.0-py3.6.egg/bashbot/settings.py", line 65, in copy_default
File "/usr/local/lib/python3.6/dist-packages/bashbot-1.0-py3.6.egg/bashbot/settings.py", line 27, in load
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 355, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 23 column 8 (char 632)
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f8f8d889a90>
Hi there!
Whenever I try this on Windows 10 2004, I keep getting in discord "Waiting for tty.." and it never moves. Nothing shows up in logs.
Please Help!
I am trying to deploy this bot in heroku but i got this output when i ran python bashbot.py
Traceback (most recent call last):
File "bot.py", line 3, in
from bashbot.commands import CommandsManager
File "/app/bashbot.py", line 5, in
import bashbot.main
ModuleNotFoundError: No module named 'bashbot.main'; 'bashbot' is not a package
Help me
Hi, I would appreciate any help. I set the bot working to dm, macros with live terminal, etc. but I cannot make bot listen and interact into a discord server channel even when I configured roles for the bot.
Thank you.
I installed all the required stuff but i can't find bashbot.py module. What to do?
As the title says. Nothing else to add
When running the command sudo python setup.py
I get an error about encoding
error text:
Processing dependencies for bashbot==1.0
Searching for websockets>=3.1,<4.0
Reading https://pypi.python.org/simple/websockets/
Best match: websockets 3.4
Downloading https://pypi.python.org/packages/4a/e8/acf36f117deeb18c0b6679624fa11 b57b0876044f0ce3f34024c3a7b2d95/websockets-3.4.tar.gz#md5=3586aa49a9e6da35759da0 92d5c79c18
Processing websockets-3.4.tar.gz
Writing /tmp/easy_install-peGAAr/websockets-3.4/setup.cfg
Running websockets-3.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-peGAAr /websockets-3.4/egg-dist-tmp-tgvu6J
Traceback (most recent call last):
File "setup.py", line 17, in <module>
"bashbot = bashbot.main:main",
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 67 , in run
self.do_egg_install()
File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 11 7, in do_egg_install
cmd.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", li ne 393, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", li ne 617, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", li ne 668, in install_item
self.process_distribution(spec, dist, deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", li ne 716, in process_distribution
[requirement], self.local_index, self.easy_install
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 631, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 874, in best_ma tch
return self.obtain(req, installer)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 886, in obtain
return installer(requirement)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", li ne 636, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", li ne 666, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", li ne 856, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", li ne 1078, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", li ne 1063, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 68, in run _setup
DirectorySandbox(setup_dir).run(runner)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 114, in ru n
return func()
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 67, in run ner
_execfile(setup_script, ns)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 43, in _ex ecfile
exec(code, globals, locals)
File "/tmp/easy_install-peGAAr/websockets-3.4/setup.py", line 11, in <module>
license="MIT",
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 243, in _o pen
return _open(path,mode,*args,**kw)
TypeError: 'encoding' is an invalid keyword argument for this function
When not using setup.py I get a different error relating to encoding after installing the dependencies and running python bashbot.py
error text
File "bashbot.py", line 12
SyntaxError: Non-ASCII character '\xe2' in file bashbot.py on line 12, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
I am trying to open a terminal and the bot responds with "waiting for tty" and a terminal never opens.
Hello, good afternoon, I have a question
every time someone sends a message in some channel, the bot reply to that message saying that the user needs to be on the whitelist add
it will not be possible to do this command, but did everything make the user do a bot command with the prefix?
it becomes annoying anybody to send a message in the chat and the bot spam
When trying to type a command, it would show the output of me doing the cmd in terminal, but nothing would happen in Discord. I tried changing permissions.json and settings,json, but no luck.
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.