Rename message class
This commit is contained in:
parent
f909d43c59
commit
1a88f7049b
@ -75,7 +75,7 @@ Arguments:
|
|||||||
- **to**: which user account to reply to (direct chat)
|
- **to**: which user account to reply to (direct chat)
|
||||||
- **room**: which room to reply to (group chat)
|
- **room**: which room to reply to (group chat)
|
||||||
|
|
||||||
> EasyMessage
|
> SimpleMessage
|
||||||
|
|
||||||
A simple message format. This is the type that you work with when your function
|
A simple message format. This is the type that you work with when your function
|
||||||
accepts a `message` argument.
|
accepts a `message` argument.
|
||||||
|
@ -10,7 +10,7 @@ from pathlib import Path
|
|||||||
from slixmpp import ClientXMPP
|
from slixmpp import ClientXMPP
|
||||||
|
|
||||||
|
|
||||||
class EasyMessage:
|
class SimpleMessage:
|
||||||
"""A simple message interface."""
|
"""A simple message interface."""
|
||||||
|
|
||||||
def __init__(self, message):
|
def __init__(self, message):
|
||||||
@ -119,7 +119,7 @@ class Bot(ClientXMPP):
|
|||||||
def message(self, message):
|
def message(self, message):
|
||||||
"""Handle message event."""
|
"""Handle message event."""
|
||||||
if message["type"] in ("chat", "normal"):
|
if message["type"] in ("chat", "normal"):
|
||||||
self.react(EasyMessage(message))
|
self.react(SimpleMessage(message))
|
||||||
|
|
||||||
def session_start(self, event):
|
def session_start(self, event):
|
||||||
"""Handle session_start event."""
|
"""Handle session_start event."""
|
||||||
@ -136,7 +136,7 @@ class Bot(ClientXMPP):
|
|||||||
"""Handle groupchat_message event."""
|
"""Handle groupchat_message event."""
|
||||||
if message["type"] in ("groupchat", "normal"):
|
if message["type"] in ("groupchat", "normal"):
|
||||||
if message["mucnick"] != self.config["bot"]["nick"]:
|
if message["mucnick"] != self.config["bot"]["nick"]:
|
||||||
self.react(EasyMessage(message))
|
self.react(SimpleMessage(message))
|
||||||
|
|
||||||
def register_xmpp_plugins(self):
|
def register_xmpp_plugins(self):
|
||||||
"""Register XMPP plugins that the bot supports."""
|
"""Register XMPP plugins that the bot supports."""
|
||||||
|
Reference in New Issue
Block a user