pyCraft
pyCraft copied to clipboard
Sending messages.
how can i send messages as the player?
If you run the file start.py from console you can type chat messages and run server commands by just starting the message with an slash.
If you run the file start.py from console you can type chat messages and run server commands by just starting the message with an slash.
not this way. i wanna in a line of code.
i am trying to make smth that joining from alot accounts. i cant just type it i wanna smth that typeing it for me
If you look at the file start.py the lines for sending a message are this:
packet = serverbound.play.ChatPacket()
packet.message = "This is a chat message"
connection.write_packet(packet)
You could create a function like this:
def send_chat_message(connection, message):
packet = ChatPacket()
packet.message = message
connection.write_packet(packet)
And use it like this:
send_chat_message(connection, "One")
send_chat_message(connection, "Two")
send_chat_message(connection, "Three")
send_chat_message(connection, "This is a chat message")
you should close this issue if you understand