Skip to main content

This is a powerful chat center for all kinds of messages.

Project description

king-chat

This is a powerful chat center for all kinds of messages.

Principles

json in, json out.

That is to say, don't send pure text, it's silly, send json instead.

Installation

sudo pip3 install king-chat

Usage

server

from king_chat import Server

server = Server(ip="127.0.0.1", port=5920)


@server.on_received
def handle(protocol, text):
    print(f"Server got: {text}")
    protocol.send_to_all_except_sender(text)


server.start(wait=True)

client 1

from king_chat import Client

client = Client(name="qq", ip="127.0.0.1", port=5920)


@client.on_received
def on_received(protocol, text):
    print(f"We got a msg: {text}")


client.start(wait=False)

while 1:
    client.send(input('What you wanna say: '))

client 2

from king_chat import Client

client = Client(name="telegram", ip="127.0.0.1", port=5920)


@client.on_received
def on_received(protocol, text):
    print(f"We got a msg: {text}")


client.start(wait=False)

while 1:
    client.send(input('What you wanna say: '))

Project details


Download files

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

Files for king-chat, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size king_chat-0.1.0-py3-none-any.whl (16.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size king_chat-0.1.0.tar.gz (15.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page