Python binding to Hackmud's chat API
Project description
hackmud_chat (Unofficial)
-------------------------
###### Installation
Just `pip install hackmud_chat`
Learn by example:
``` python
>>> from hackmud_chat import Account
# 'Login' to the hackmud chat API
>>> account = Account(token='yourtokenhere')
# Don't have a token? No panic...
# Get into your hackmud client and enter the command chat_pass
>>> account = Account(passwd='thegivenpass')
# Account's properties:
>>> account.users
>>> account.token
# Get the user you want to interact with
>>> user1 = account.get_user('user1')
# User's properties:
>>> user1.messages
>>> user1.channels
# Deeper, inside channels:
>>> user1.channels[0].users # The list of channel's members
# Access user's messages (sorted by time [latest == earliest])
>>> last = user1.messages[-1]
# Message object:
>>> last.id
>>> last.time
>>> last.from_user
>>> last.text
>>> last.to_user # Optional
>>> last.channel # Optional
>>> last.is_join # Optional
>>> last.is_leave # Optional
# Update messages:
>>> user1.update_history() # Updates user1.messages
# User's actions:
>>> user1.tell('user2', 'Hello') # Send a private message to user2
>>> user1.say('0000', 'H1 3vry0ne!') # Send a message to channel 0000
>>> user1.sayTo('0000', 'user2', "You're a noob!") # Send a message to chan 0000 formated like:
# @user2: You're a noob!
```
See some examples in [examples/](./examples/)
Documentation is coming...
-------------------------
###### Installation
Just `pip install hackmud_chat`
Learn by example:
``` python
>>> from hackmud_chat import Account
# 'Login' to the hackmud chat API
>>> account = Account(token='yourtokenhere')
# Don't have a token? No panic...
# Get into your hackmud client and enter the command chat_pass
>>> account = Account(passwd='thegivenpass')
# Account's properties:
>>> account.users
>>> account.token
# Get the user you want to interact with
>>> user1 = account.get_user('user1')
# User's properties:
>>> user1.messages
>>> user1.channels
# Deeper, inside channels:
>>> user1.channels[0].users # The list of channel's members
# Access user's messages (sorted by time [latest == earliest])
>>> last = user1.messages[-1]
# Message object:
>>> last.id
>>> last.time
>>> last.from_user
>>> last.text
>>> last.to_user # Optional
>>> last.channel # Optional
>>> last.is_join # Optional
>>> last.is_leave # Optional
# Update messages:
>>> user1.update_history() # Updates user1.messages
# User's actions:
>>> user1.tell('user2', 'Hello') # Send a private message to user2
>>> user1.say('0000', 'H1 3vry0ne!') # Send a message to channel 0000
>>> user1.sayTo('0000', 'user2', "You're a noob!") # Send a message to chan 0000 formated like:
# @user2: You're a noob!
```
See some examples in [examples/](./examples/)
Documentation is coming...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hackmud_chat-0.1a4.tar.gz
(3.6 kB
view hashes)
Built Distributions
hackmud_chat-0.1a4-py2.7.egg
(7.3 kB
view hashes)
Close
Hashes for hackmud_chat-0.1a4-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b14cf0b5bd1f93f9fc2612794ea60024c72c2f372203b395696f77c65d27d3df |
|
MD5 | de8e2560c59dac70065bbb76d47533af |
|
BLAKE2b-256 | dc3e2a90f5b62511afc301f62d0b98be84e2fa21e3008fe6d0b29e0ad0bb5be3 |