cleanup and docs
This commit is contained in:
parent
cd529281f3
commit
a2eb049fc9
3 changed files with 169 additions and 8 deletions
|
|
@ -620,13 +620,8 @@ class DiscordBot(Bot):
|
|||
from evennia.server.sessionhandler import SESSIONS as _SESSIONS
|
||||
# these will be made available as properties on the protocol factory
|
||||
configdict = {"uid": self.dbid}
|
||||
logger.log_info("starting discord bot session")
|
||||
_SESSIONS.start_bot_session(self.factory_path, configdict)
|
||||
|
||||
def at_msg_send(self, **kwargs):
|
||||
"Skip this to avoid looping, presumably"
|
||||
pass
|
||||
|
||||
def at_pre_channel_msg(self, message, channel, senders=None, **kwargs):
|
||||
"""
|
||||
Called by the Channel just before passing a message into `channel_msg`.
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ class DiscordWebsocketServerFactory(WebSocketClientFactory, protocol.Reconnectin
|
|||
callback for when the URL is gotten
|
||||
"""
|
||||
data = json.loads(str(payload, "utf-8"))
|
||||
logger.log_info(f"payload: {data}")
|
||||
if url := data.get("url"):
|
||||
self.gateway = f"{url}/?v={DISCORD_API_VERSION}&encoding=json".encode("utf-8")
|
||||
useragent = kwargs.pop("useragent", DISCORD_USER_AGENT)
|
||||
|
|
@ -485,10 +484,8 @@ class DiscordClient(WebSocketClientProtocol, _BASE_SESSION_CLASS):
|
|||
|
||||
"""
|
||||
action_type = data.get("t", "UNKNOWN")
|
||||
logger.log_msg(f"DISCORD: Received an action of type {action_type}.")
|
||||
|
||||
if action_type == "MESSAGE_CREATE":
|
||||
logger.log_msg(str(data))
|
||||
data = data["d"]
|
||||
if data["author"]["id"] == self.discord_id:
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue