![]() ![]() This ensures that the types that the bot uses are consistent across bots and always up to date with the output of the API. Most of the types the bot uses are generated from definitions defined in the protocol/ directory inside the Keybase client repo. Remove any existing pre-commit hooks via rm.We check all git commits with the above tools with The correct versions should be install when you run poetry install, but you'll probably want to configure your editor to work with: We use a few different static analysis tools to perform linting, type-checking, formatting, etc. Then install your local version: pip uninstall pykeybasebot Locally, you'll need to first uninstall previously installed pykeybasebot, Remember that if you're making changes to pykeybasebot and want to test them This will set up a virtualenv for you and install all the dependencies needed into it! Once you have the right Python version, you can run: pip install poetry With pyenv installed, it should automatically set python to 3.7 when you cd into this repo. We recommend using pyenv to handle different versions of Python on your machine. To start Poetry, you'll need the python executable in your path to link to Python 3.7. Go check out their website for installation instructions. We're really counting on them to make it clear how to use this library. This bot command wraps keybase chat api-listen, (and it takes basically the same exact options) and fires off events to your handler function.ĭefinitely definitely check out the examples. start the bot inside the asyncio event loop.We recommend doing this with the oneshot command. If you are not already running on a logged-in device, you need to do that.These three are more useful for complicated local development with multiple accounts and less useful if you're running in a docker container or as the only user on your system. You may optionally pass in: (1) the username and/or paperkey for the bot's identity (it'll default to the currently logged-in user otherwise), (1) the event loop that you want new tasks to be sent to (this is necessary if you want to lock on async behavior - see the examples), (2) the location of the running keybase app (defaults to keybase which is fine if it's in your PATH), your user's home directory, or pid_file. You must initialize this with the handler function to call with each event. This function will get called with your bot instance (described below) and the KbEvent instance. Create a handler function that takes event objects and does something with them.Generally speaking, here's what you need to do: And it's all async, so you'll need to call into it with that in mind. Future work can add teams behavior, more wallet functionality (e.g. That's enough for the vast majority of basic functionality. It currently does reading from channels and writing messages/reactions pretty well. This library is very far from exhaustively covering the complete Keybase API, but it is our hope that it will be easy to add to (see chat_client.py for the pattern). There are also similar libraries for JavaScript and Go. You'll have to build that yourself, but with the examples, this library will hopefully make whatever you want to build much much easier :). This library does not attempt to do intent parsing or manage state at all. It is an unopinionated, simple wrapper around the Keybase CLI API for creating an interactive bot or general scripting. This is the officially support Keybase Python library. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |