Skip to main content

A Simple and easy-to-use Python Library to read and interact with Minecraft's Chat in real time.

Reason this release was yanked:

Please install PythMC instead! It's a more complete, intuitive, and clean library, succeeding PyMChat and MESL.

Project description

PyMChat

A Simple and easy-to-use Python Library to read and interact with Minecraft's Chat in real time.

Installation

pip install pymchat

Usage

Reading chat messages

from pymchat.chat import Chat

chat = Chat()

# Limit in get_history is defaulted to 100.
message_list = chat.get_history(limit=10)

for message in message_list:
  print(message.content)

This sample output was taken from a real server.

[+] JohnRockefailure has joined
[+] Senseimasterman9 has joined
Welcome | Steve | Senseimasterman9 to the server!
<| Investor | *Blist> Welcom
<| Griffin | *Jay> W e l c o m e ! E n j o y y o u r s t a y a t S a f e S u r v i v a l
<| Event Staff | *Enelis> o-o
<| Griffin | *Jay> oof
<| Veteran | Parkemon20000> thats... not normal
[-] JohnRockefailure has left
<| Phoenix | *Kelp> Gn all

Sending chat messages

from pymchat.chat import Chat

chat = Chat()
message_list = chat.send("This is a sample message!")

Using this method will briefly attempt to locate a Minecraft Window, open the chat, send the message, and then switch back to the previous active window. A MinecraftWindowNotFoundError will be thrown if a Minecraft Window isn't found.

Message Objects

Properties:

content

id

date

Content Property: Holds the content of a message. It represents exactly what the user sees, without colours.

ID Property: An unique number for the message, for the current session. This helps distinguishing between messages effectively.

Date Property: The date of when the message was sent. It follows the format from the latest.log file's date.

Chat Object

Properties:

default_logs_path

chat_key

window_name

Methods:

get_history | Limit defaulted to 100, gets the chat messages history

send | Sends a message to the chat.

Default_Logs_Path Property: Can be altered, defines the location of the latest.log file. Defaults to \.minecraft\logs\latest.log

Chat_Key Property: Can be altered, defines the key that triggers the text chat on minecraft. Defaults to 'T'.

Window_Name: Can be altered, defines the title of the window that the Minecraft Client launches as. Defaults to "Minecraft"

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

pymchat-0.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

pymchat-0.2-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file pymchat-0.2.tar.gz.

File metadata

  • Download URL: pymchat-0.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.9.1 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for pymchat-0.2.tar.gz
Algorithm Hash digest
SHA256 b4de5dc61426610d9334daf8910a58a94891c9fac6ab8b7007d227bca9561ee3
MD5 c397e2efaf47ecbb4d5461347c9a3e82
BLAKE2b-256 3cf5a9e85f5da19158410c8654fa548d8e1728c09083bad0e650aeffb2ecc69b

See more details on using hashes here.

File details

Details for the file pymchat-0.2-py3-none-any.whl.

File metadata

  • Download URL: pymchat-0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.9.1 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for pymchat-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ecb733511125c76148fe05b7306088db5ddba4684fc9b207e554c82aab76e67e
MD5 224b6bae7885f9f90fb4fbc626ad82e0
BLAKE2b-256 74e5ed1f1b3e2b499b8d12247ca253f47397174c3b04ac9dab2ad3678dab7dd4

See more details on using hashes here.

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