deltachat-bot / deltabot Goto Github PK
View Code? Open in Web Editor NEWDelta.Chat bot written in Python
License: Mozilla Public License 2.0
Delta.Chat bot written in Python
License: Mozilla Public License 2.0
The objective is to be able to do something like:
bot.commands.register(name="/join", func=process_join, type='dynamic')
Then commands like: /join, /join_g20, /join_c11, are processed by function "process_join" and have payloads "", "g20" and "c11" respectively.
The use case is to make commands that have arguments easy to use by clicking on them on DC clients that support this feature.
account hook ac_incoming_message
isn't triggered on member added/removed events, but since deltabot uses account.get_fresh_messages()
fresh member added/removed events are returned and processed as incoming messages
commands have an IncommingCommand object that allows to access the bot variable, filters only get the message as argument
commands and filters are only allowed to return an string, it is needed to allow to return file + text so the bot can reply with pictures, etc.
when implementing this, please allow to return a file-like object, don't force to a path because a file object gives much more flexibility (ex. to use a BytesIO object etc.)
"db" plugin is installed on deltabot_init
hook in deltabot.builtin.db:10
, despite the plugin is registered before other 3rd-party plugins, seems internally pluggy uses a dict
to store them so the deltabot_init
hook is triggered in arbitrary order so it happens that plugins try to use bot.set/get before "db" plugin is registered causing the operation to do nothing.
Currently if two(or more) bots are added to a group and a command is sent for one bot, the other bots will complain if they don't have the command, and in case they have all the same command there are no way to declare that only bot X should process the command
$ python --version
Python 3.9.2
$ pip3 install deltabot
[no errors so not showing it]
$ deltabot help
Traceback (most recent call last):
File "/home/simon/.venv/bin/deltabot", line 5, in <module>
from deltabot.cmdline import bot_main
File "/home/simon/.venv/lib/python3.9/site-packages/deltabot/cmdline.py", line 6, in <module>
from .parse import render_hop_trace
File "/home/simon/.venv/lib/python3.9/site-packages/deltabot/parse.py", line 4, in <module>
import attr
ModuleNotFoundError: No module named 'attr'
Could very well be my fault, I might have overlooked something, but in case it's not, here's an error when I ran "deltabot init " , File "/opt/virtualenvs/python3/lib/python3.8/site-packages/deltabot/cmdline.py", line 42, in init acc.configure(addr=emailadr, mail_pw=password) TypeError: configure() got an unexpected keyword argument 'addr'
currently commands are also passed to the filters, passing to the plugin devs the burden to ask if it is a command or a normal message
and what python version do not work.
there is deltabot_shutdown hook, triggered when bot.trigger_shutdown() is called, but there is no trigger_start hook, and it is needed for bridges plugins to start connections to other services etc. currently there is deltabot_init hook but it gets triggered even before command line parsing.
currently on incoming commands if the command is unknown an error message is sent back to the user, this can be disturbing if there are several bots in a group you send the command for one bot but all other bots will complain of invalid command.
in a 1:1 chat (or if we support /command@[email protected] in the future) the error message is ok
plugins sometimes need a folder to place databases and other files
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.