HangupsBot
Bot for Google Hangouts
Requirements
Python >= 3.3
hangups (https://github.com/tdryer/hangups)
appdirs (https://github.com/ActiveState/appdirs)
asyncio (https://pypi.python.org/pypi/asyncio) for Python < 3.4
Usage
Run hangupsbot --help to see all available options. Start HangupsBot by running hangupsbot.
You can configure basic settings in config.json file. This file will be copied to user data directory (e.g. ~/.local/share/hangupsbot/ on Linux) after first start of HangupsBot.
The first time you start HangupsBot, you will be prompted to open a link in your web browser where you log into your Google account. After logging in and clicking on “SIGN IN”, you should see authorization code. Copy this code to clipboard and paste it into HangupsBot to complete the process. Your credentials will only be sent to Google, and only OAuth 2 refresh token will be stored locally.
Help
usage: hangupsbot [-h] [-d] [--log LOG] [--token TOKEN] [--config CONFIG]
[--version]
optional arguments:
-h, --help show this help message and exit
-d, --debug log detailed debugging messages (default: False)
--log LOG log file path (default:
~/.local/share/hangupsbot/hangupsbot.log)
--token TOKEN OAuth refresh token storage path (default:
~/.local/share/hangupsbot/refresh_token.txt)
--config CONFIG config storage path (default:
~/.local/share/hangupsbot/config.json)
--version show program's version number and exit
Features (event handlers)
autoreplies - automatically reply to specified keywords in messages
commands - run /bot commands (type /bot help for list of available commands)
forwarding - forward messages from one conversation to another
membership - watch conversations for added/removed users
rename - watch for renamed conversations (only example plugin for now)
Development
You can extend HangupsBot in two ways - by writing handlers or commands plugins. Every Python file (which doesn’t start with _) in handlers and commands directories is loaded automatically.
Handlers
Functions in plugins can be registered as event handlers by decorating them with @handler.register(priority=10, event=None) decorator.
If event parameter is None (default), all event types are forwarded to handler. If you want to handle only some specific type of event, you can set event to hangups.ChatMessageEvent, hangups.MembershipChangeEvent or hangups.RenameEvent.
You can change priority of handler by specifying priority parameter (default is 10). A lower number means higher priority. If you raise StopEventHandling exception in your handler, current event will not be handled by any other handler.
Commands
Functions in plugins can be registered as /bot commands by decorating them with @command.register(admin=False) decorator.
If admin parameter is False (default), anyone can run the command. If admin is True, only admins (as set in config.json) can run it.
See existing commands for examples.
Metadata
Release files for HangupsBot 1.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| HangupsBot-1.7.1.tar.gz | 34.8 kB | Without provenance | Details |
Release files / HangupsBot-1.7.1.tar.gz
| Download URL | HangupsBot-1.7.1.tar.gz |
|---|---|
| Size | 34.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c3428c1dae420c0f52ce945e1868c77acfe99c0f489b65fa134d8d9bb4f7114
|
|
BLAKE2b-256 checksum How to use checksums |
d72bbd6583c29b532294489c3f3718779f2351dbaa44028dbf8a661a2753224c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for HangupsBot 1.7.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.