simplebot-org / simplebot Goto Github PK
View Code? Open in Web Editor NEWThis project forked from deltachat-bot/deltabot
Extensible Delta Chat bot written in Python3
License: Mozilla Public License 2.0
This project forked from deltachat-bot/deltabot
Extensible Delta Chat bot written in Python3
License: Mozilla Public License 2.0
Now with the new Delta Chat core 1.0, sending self avatar works, so it is useful to have a way to let bot operators set bot avatar, also providing some default avatars would be useful.
# uname -a
Linux nextcloud-VM 4.19.0-19-amd64 #1 SMP Debian 4.19.232-1 (2022-03-07) x86_64 GNU/Linux
After running tox
(on 0770380 version) getting next errors. I think test should be repeatable.
GLOB sdist-make: /home/some_username/simplebot/setup.py
py recreate: /home/some_username/simplebot/.tox/py
py installdeps: pytest, requests, pdbpp
py inst: /home/some_username/simplebot/.tox/.tmp/package/1/simplebot-2.4.1.dev15+g0770380.d20220310.zip
py installed: attrs==21.4.0,certifi==2021.10.8,cffi==1.15.0,charset-normalizer==2.0.12,deltachat==1.72.0,fancycompleter==0.9.1,idna==3.3,IMAPClient==2.2.0,importlib-metadata==4.11.2,iniconfig==1.1.1,Jinja2==3.0.3,MarkupSafe==2.1.0,packaging==21.3,pdbpp==0.10.3,Pillow==9.0.1,pkg_resources==0.0.0,pluggy==1.0.0,py==1.11.0,pycparser==2.21,Pygments==2.11.2,pyparsing==3.0.7,pyrepl==0.9.0,pytest==7.0.1,requests==2.27.1,simplebot @ file:///home/some_username/simplebot/.tox/.tmp/package/1/simplebot-2.4.1.dev15%2Bg0770380.d20220310.zip,six==1.16.0,tomli==2.0.1,typing_extensions==4.1.1,urllib3==1.26.8,wmctrl==0.4,zipp==3.7.0
py run-test-pre: PYTHONHASHSEED='507505052'
py runtests: commands[0] | pytest
==================================================================================== test session starts =====================================================================================
platform linux -- Python 3.7.3, pytest-7.0.1, pluggy-1.0.0 -- /home/some_username/simplebot/.tox/py/bin/python
cachedir: .tox/py/.pytest_cache
Deltachat core=v1.72.0 sqlite=3.36.0 journal_mode=wal
rootdir: /home/some_username/simplebot, configfile: tox.ini
plugins: simplebot-2.4.1.dev15+g0770380.d20220310, deltachat-1.72.0
collected 62 items / 1 error / 61 selected
=========================================================================================== ERRORS ===========================================================================================
___________________________________________________________________________ ERROR collecting examples/send_file.py ___________________________________________________________________________
ImportError while importing test module '/home/some_username/simplebot/examples/send_file.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.tox/py/lib/python3.7/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
examples/send_file.py:11: in <module>
import xkcd
E ModuleNotFoundError: No module named 'xkcd'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================================================================== 1 error in 0.79s ======================================================================================
ERROR: InvocationError for command '/home/some_username/simplebot/.tox/py/bin/pytest' (exited with code 2)
lint recreate: /home/some_username/simplebot/.tox/lint
lint installdeps: flake8, restructuredtext_lint, pygments
lint develop-inst: /home/some_username/simplebot
lint installed: certifi==2021.10.8,cffi==1.15.0,charset-normalizer==2.0.12,deltachat==1.72.0,docutils==0.18.1,flake8==4.0.1,idna==3.3,IMAPClient==2.2.0,importlib-metadata==4.2.0,Jinja2==3.0.3,MarkupSafe==2.1.0,mccabe==0.6.1,Pillow==9.0.1,pkg_resources==0.0.0,pluggy==1.0.0,py==1.11.0,pycodestyle==2.8.0,pycparser==2.21,pyflakes==2.4.0,Pygments==2.11.2,requests==2.27.1,restructuredtext-lint==1.4.0,-e git+https://github.com/some_username/simplebot.git@0770380af2493b46d844cd025f44296db976364b#egg=simplebot,six==1.16.0,typing_extensions==4.1.1,urllib3==1.26.8,zipp==3.7.0
lint run-test-pre: PYTHONHASHSEED='507505052'
lint runtests: commands[0] | rst-lint README.rst CHANGELOG.rst
Path "README.rst" not found as a file nor directory
ERROR: InvocationError for command '/home/some_username/simplebot/.tox/lint/bin/rst-lint README.rst CHANGELOG.rst' (exited with code 1)
__________________________________________________________________________________________ summary ___________________________________________________________________________________________
ERROR: py: commands failed
ERROR: lint: commands failed
internal commands like /start
and /settings
need to be reworked in a way that they are show in the help
we could have some basic FB Messenger bridge to facilitate the migration to Delta Chat without "leaving your friends behind"
Switch to GNU Affero General Public License, better for something that works as a service
name = 'deltachat_ffi'
operating_system = 'unix:Ubuntu'
crate_version = '1.101.0'
explanation = '''
Panic occurred in file '/root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/time/driver/entry.rs' at line 394
'''
cause = 'Timer already fired'
method = 'Panic'
backtrace = '''
0: 0x7f2d3b5f31db - core::panicking::panic_str::h98ed104b0c03a108
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:56
1: 0x7f2d3b3668d6 - core::option::expect_failed::h58d487f78ae9d247
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/option.rs:1874
2: 0x7f2d3bedb3d3 - tokio::time::driver::entry::TimerEntry::reset::hbbcccd7f9465b576
3: 0x7f2d3bee97a3 - <tokio::time::driver::sleep::Sleep as core::future::future::Future>::poll::h4c733a398cccea7a
4: 0x7f2d3b4062db - <core::future::from_generator::GenFuture as core::future::future::Future>::poll::h262d9fd449c43745
5: 0x7f2d3b822cb0 - <core::panic::unwind_safe::AssertUnwindSafe as core::ops::function::FnOnce<()>>::call_once::h8e9acae4f2a0b007
6: 0x7f2d3b8cce44 - tokio::runtime::task::raw::poll::h91b1edf4cf1ff0e4
7: 0x7f2d3bed5c4d - tokio::runtime::scheduler::multi_thread::worker::Context::run_task::hecfd6b2c01e05a3a
8: 0x7f2d3bed430b - tokio::runtime::scheduler::multi_thread::worker::run::h49404835eeeef5f3
9: 0x7f2d3b8cb7ac - tokio::runtime::task::raw::poll::h0083a76dc5421f13
10: 0x7f2d3bee3ef5 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1fadac6c4946e153
11: 0x7f2d3bee48ef - core::ops::function::FnOnce::call_once{{vtable.shim}}::h6a8293dca237876c
12: 0x7f2d3becc4b5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::call_once::ha99802c2c52ada61
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/alloc/src/boxed.rs:1861
- <alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::call_once::ha39aea1c57e28a15
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/alloc/src/boxed.rs:1861
- std::sys::unix::thread::Thread::new::thread_start::h9f8e3d72b1f7662f
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys/unix/thread.rs:108
13: 0x7f2d3d3d3609 - start_thread
14: 0x7f2d3d50d133 - clone
15: 0x0 - '''
add a plugin to allow Delta Chat users participate in XMPP rooms
I have installed deltachat-core-rust with the python bindings, I can run simplebot --version
successfully. But when I run:
simplebot init ADDR PASSWORD
with a email and password I created for the bot the command line is just stuck reporting this when I hit Crtl+C:
venv) $ simplebot --stdlog debug init ADDR PASSWORD
2021-03-03 11:20:39,698 - simplebot - DEBUG - registering plugin 'commands'
2021-03-03 11:20:39,700 - simplebot - DEBUG - registering plugin 'filters'
2021-03-03 11:20:39,702 - simplebot - DEBUG - registering plugin 'db'
2021-03-03 11:20:39,704 - simplebot - DEBUG - registered new command '/help'
2021-03-03 11:20:39,704 - simplebot - DEBUG - registered new command '/set'
2021-03-03 11:20:39,704 - simplebot - DEBUG - registered new command '/ban'
2021-03-03 11:20:39,705 - simplebot - DEBUG - registered new command '/unban'
^CTraceback (most recent call last):
File "venv/bin/simplebot", line 10, in <module>
sys.exit(main())
File "venv/lib/python3.7/site-packages/simplebot/main.py", line 24, in main
parser.main_run(bot=bot, args=args)
File "venv/lib/python3.7/site-packages/simplebot/parser.py", line 88, in main_run
res = args.subcommand_instance.run(bot=bot, args=args, out=out)
File "venv/lib/python3.7/site-packages/simplebot/builtin/cmdline.py", line 51, in run
args.emailaddr, args.password)
File "venv/lib/python3.7/site-packages/simplebot/bot.py", line 248, in perform_configure_address
configtracker.wait_finish()
File "deltachat-core-rust/python/src/deltachat/tracker.py", line 98, in wait_finish
if not self._configure_events.get():
File "/usr/lib/python3.7/queue.py", line 170, in get
self.not_empty.wait()
File "/usr/lib/python3.7/threading.py", line 296, in wait
waiter.acquire()
KeyboardInterrupt
I think I installed something incorrectly or how long does the init process take ?
ex. admin VS normal user
since the issue deltachat/deltachat-android#937 is already solved, the bot should set the commands in "body" instead of splitting them in subject and body
Now with Delta Chat core 1.0 it is possible to set os_name
which will be sent in the X-Mailer
header, this is useful to detect other simple bot instances
such as on_forget_user
to allow users remove all their data from a bot with one command, etc
I'm following the guide posted in the Delta Chat support forum here.
After attempting to initialize the bot it fails with the "AssertionError: plugin is not registered" traceback.
I have reproduced this issue on gentoo, guix and ubuntu systems which have the latest updates.
$ simplebot --stdlog debug init $ADDR "$PASSWORD"
2023-11-27 13:57:56,965 - simplebot - DEBUG - registering plugin 'commands'
2023-11-27 13:57:56,965 - simplebot - DEBUG - registering plugin 'filters'
2023-11-27 13:57:56,982 - simplebot - DEBUG - registering plugin 'db'
2023-11-27 13:57:56,982 - simplebot - DEBUG - registered new command '/sub'
2023-11-27 13:57:56,982 - simplebot - DEBUG - registered new command '/unsub'
2023-11-27 13:57:56,983 - simplebot - DEBUG - registered new command '/help'
2023-11-27 13:57:56,983 - simplebot - DEBUG - registered new command '/unban'
2023-11-27 13:57:56,983 - simplebot - DEBUG - registered new command '/ban'
2023-11-27 13:57:56,983 - simplebot - DEBUG - registered new command '/set'
2023-11-27 13:57:56,983 - simplebot - DEBUG - registered new command '/echo'
2023-11-27 13:57:56,983 - simplebot - DEBUG - registered new filter 'simplebot_echo.echo_filter'
2023-11-27 13:58:58,034 - simplebot - INFO - Successfully configured [email protected]
Traceback (most recent call last):
File "/home/user/.local/bin/simplebot", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/simplebot/main.py", line 24, in main
parser.main_run(bot=bot, args=args)
File "/home/user/.local/lib/python3.11/site-packages/simplebot/parser.py", line 111, in main_run
res = args.subcommand_instance.run(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/simplebot/builtin/cmdline.py", line 152, in run
success = bot.perform_configure_address(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/lib/python3.11/site-packages/simplebot/bot.py", line 383, in perform_configure_address
with self.account.temp_plugin(tracker) as configtracker:
File "/usr/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/home/user/.local/lib/python3.11/site-packages/deltachat/account.py", line 671, in temp_plugin
self._pm.unregister(plugin)
File "/usr/lib/python3.11/site-packages/pluggy/_manager.py", line 206, in unregister
assert name is not None, "plugin is not registered"
^^^^^^^^^^^^^^^^
AssertionError: plugin is not registered
!tr <FROM> <TO> <TEXT>
!tr en es hello world!!!
hola mundo!!!
See issue details here deltachat-bot/feedsbot#13.
currently, locale selection is just a prototype with localized strings in code.
the image extension should be detected
I was thinking in a generator for SysVInit, systemd or OpenRC like https://github.com/cloudflare/cloudflared/blob/master/cmd/cloudflared/linux_service.go (this is only dedicated to SysVinit and systemd).
In this way, would have integration with different systems.
Providing only a SysVInit file is also a solution for nearly all environments (systemd has compatibility over it and the same happens with OpenRC).
currently the group names are used to store the topic of the group and the state (public/private)
using a db will allow also to store a private group id to operate in private groups, like sharing an invitation link to a private group
Could be useful to have a bridge between Mastodon and Delta Chat, lets toot by email :)
command idea !webz [url]
:
without url displays a download links/help with a command to ask the bot to send the apk.
https://github.com/Simon-Laux/ZHV
Useful links for implementing:
https://pymotw.com/3/zipfile/index.html#writing-data-from-sources-other-than-files
currently plugins are simply kept together in a list and can only handle incoming messages, plugins should register for the events they want to react to, ex. before a message is processed or after a message was processed, etc.
if user haven't set their nick a random nick "user123" should be generated instead of using the user is email address as nick
when the contacts avatar sharing start working in Delta Chat, this plugin should be implemented, to get a random avatar or based on nick, the plugin could use:
https://www.peppercarrot.com/extras/html/2016_cat-generator/index.php?seed=
https://www.peppercarrot.com/extras/html/2019_bird-generator/?seed=
to subscribe to RSS and Atom feeds, a group should be created for every feed, etc
I had Simplebot running on a host and uninstalled it, then pulled in the new changes and installed Simplebot again. This created a new key-pair, wiped all previous email configurations, and wiped all old Sqlite plugins databases.
Steps I did:
pip3 uninstall simplebot
git pull
pip3 setup.py install
I was able to re-store the original key-pair from ~/.config/simplebot/account.db
in keypairs table, I understand this bot is still not in release, but just wanted to start the conversation if it is possible to utilize the old configurations rather than creating new ones since all the messages would be encrypted after upgrade.
Munin is a resource monitoring software tool for computers.
Sources:
Given that this is very near to email servers, postfix and exim plugins could help to get an idea of what to show. Plugins available at https://gallery.munin-monitoring.org/.
Traceback (most recent call last):
File "/usr/local/bin/simplebot", line 33, in <module>
sys.exit(load_entry_point('simplebot', 'console_scripts', 'simplebot')())
File "/home/sandra/py/simplebot/src/simplebot/main.py", line 22, in main
bot = make_bot_from_args(args, plugin_manager=pm)
File "/home/sandra/py/simplebot/src/simplebot/main.py", line 37, in make_bot_from_args
return DeltaBot(account, logger, plugin_manager=plugin_manager, args=args)
File "/home/sandra/py/simplebot/src/simplebot/bot.py", line 185, in __init__
plugin_manager.hook.deltabot_init.call_historic(
File "/usr/local/lib/python3.9/dist-packages/pluggy/_hooks.py", line 277, in call_historic
res = self._hookexec(self.name, self.get_hookimpls(), kwargs, False)
File "/usr/local/lib/python3.9/dist-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/usr/local/lib/python3.9/dist-packages/pluggy/_callers.py", line 60, in _multicall
return outcome.get_result()
File "/usr/local/lib/python3.9/dist-packages/pluggy/_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "/usr/local/lib/python3.9/dist-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "/home/sandra/py/simplebot_xmpp/simplebot_xmpp/__init__.py", line 33, in deltabot_init
bot.commands.register("/xmpp_bridge", cmd_bridge)
File "/home/sandra/py/simplebot/src/simplebot/commands.py", line 39, in register
short, long, args = parse_command_docstring(
File "/home/sandra/py/simplebot/src/simplebot/commands.py", line 162, in parse_command_docstring
funcargs = set(inspect.getargs(func.__code__).args)
AttributeError: 'str' object has no attribute '__code__'
This is after pip installing the git repo versions (as opposed to the releases package) of simplebot and simplebot_xmpp, and then this happens on simplebot init address password
I was having difficulties setting up this bot because the email server I use requires custom port, hostname, and security. To ease the setup process, could we introduce a config file during the init
process ?
implementing this game before the chess plugin to the idea
To provide text representation of websites.
OS: Linux
Python version: 3.9
After running simplebot init "addr" "pass"
, I am receiving the below error when running simplebot info
or simplebot db
:
Traceback (most recent call last):
File "deltachat-core-rust/python/venv/bin/simplebot", line 8, in <module>
sys.exit(main())
File "deltachat-core-rust/python/venv/lib/python3.9/site-packages/simplebot/main.py", line 18, in main
parser = get_base_parser(plugin_manager=pm, argv=argv)
File "deltachat-core-rust/python/venv/lib/python3.9/site-packages/simplebot/parser.py", line 151, in get_base_parser
args.basedir = addr and get_account_path(addr)
File "deltachat-core-rust/python/venv/lib/python3.9/site-packages/simplebot/utils.py", line 50, in get_account_path
return os.path.join(get_config_folder(), "accounts", quote(address))
File "/usr/lib/python3.9/urllib/parse.py", line 862, in quote
return quote_from_bytes(string, safe)
File "/usr/lib/python3.9/urllib/parse.py", line 887, in quote_from_bytes
raise TypeError("quote_from_bytes() expected bytes")
TypeError: quote_from_bytes() expected bytes
I took a look at utils.py line 50 and debugged that the address variable is a tuple and the address is in the first index, so I tried doing quote(address[0])
but then started recieving other intialization errors. Could you please help understand the issue ?
Side note: I was able to successfully setup the simplebot on another one of my machines running Linux and Python 3.7, I am recieving this error after trying to put it on my machine that has Python 3.9 and pulling in all the new changes from gtithub.
To make it easy for the user to learn and work with the commands, the help plugin could provide an html-based view with the plugins descriptions and buttons to get started using them easily, also other plugins should provide an html GUI if useful.
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.