Skip to main content

A library to connect to https://hack.chat/

Project description

#!/usr/bin/env python3

import hclib


# Make a callback function with two parameters.
def on_message(connector, data):
    # The second parameter (<data>) is the data received.
    print(data)
    print(connector.onlineUsers)
    # Checks if someone joined the channel.
    if data["type"] == "online add":
        # Sends a greeting the person joining the channel.
        connector.send("Hello {}".format(data["nick"]))


if __name__ == "__main__":
    hackChat = hclib.HackChat(on_message, "myBot")
    hackChat.join("botDev")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hclib-0.1.0.tar.gz (3.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page