spockbot.plugins.helpers.chat module¶
Processes chat into easy to use events
-
class
spockbot.plugins.helpers.chat.
ChatCore
(net)¶ Bases:
object
-
chat
(message)¶
-
whisper
(player, message)¶
-
-
exception
spockbot.plugins.helpers.chat.
ChatParseError
¶ Bases:
Exception
-
class
spockbot.plugins.helpers.chat.
ChatPlugin
(ploader, settings)¶ Bases:
spockbot.plugins.base.PluginBase
Emits
chat
events withposition, raw, text, type, message, name, uuid
.position
: Always one ofspockbot.mcdata.constants
‘sCHAT_POS_CHAT, CHAT_POS_SYSTEM_MESSAGE, CHAT_POS_ABOVE_HOTBAR
.raw
: Always the JSON dict as received from the server.text
: The text (without formatting) of the chat message as the vanilla client would display it. Needsen_US.lang
to be present in the active directory, otherwise some but not all messages are translated properly.type
: None or one ofachievement, admin, announcement, emote, incoming, outgoing, text
, which are the last part of the corresponding vanilla translation IDs.If
type
is not None,message, name, uuid
are set and an additionalchat_<type>
event is emitted. Otherwise,message, name, uuid
are all None.message
: The message as it was typed by the sender.name
: The name of the sender.uuid
: The UUID of the sender, with dashes.-
events
= {'PLAY<Chat Message': 'handle_chat'}¶
-
handle_chat
(evt, packet)¶
-
load_translations
()¶
-
pl_announce
= ('Chat',)¶
-
render_chat
(chat_data)¶ Render the text as in the vanilla client. On a vanilla server, this uses the translations dict.
-
requires
= ('Event', 'Net')¶
-
-
spockbot.plugins.helpers.chat.
parse_with_1_extra
(json_data)¶