Wiki
Clone wikiHackmud_chat / Home
Welcome to the unofficial Hackmud's chat Python API
This Python module is intended to simplify access to the Hackmud's chat API directly in Python.
It would be a great help in developing chat bots.
Installation
Just pip install hackmud_chat
As Hackmud's API is a HTTP/JSON API, this module will also install requests
to perform HTTP communications.
Usage
To use the Hackmud's API you need either a token or a password.
If you don't already have a token, you must log into the Hackmud's client and enter the command chat_pass
. You will get a 5 ASCII characters password which expires within 5 minutes.
If you already got a token and it is still valid (45 day expiracy) you can use it directly.
Once you have what you need, simply write:
#!python from hackmud_chat import Account account = Account(token='your_token') # OR account = Account(passwd='your_pass')
Then you'll need to get users from this account to interact with the chat.
#!python print account.users # [<hackmud_chat.User name='user1'>, <hackmud_chat.User name='user2'>, ...] user1 = account.get_user('user1')
Finally you can interact with the chat:
#!python user1.tell('other_user', 'Hello') user1.say(user1.channels[0].name, 'Hi everyone') user1.sayTo(user1.channels[0].name, 'other_user', 'Hello you!') user1.update_history()
Updated