From 87116b8d3a1b25aba0a11fe645e15dccd264e81d Mon Sep 17 00:00:00 2001 From: Someone Date: Sat, 19 Mar 2022 23:36:58 +0100 Subject: [PATCH] modules/WSDMNotSupportedNotification.py --- modules/WSDMNotSupportedNotification.py | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 modules/WSDMNotSupportedNotification.py diff --git a/modules/WSDMNotSupportedNotification.py b/modules/WSDMNotSupportedNotification.py new file mode 100644 index 0000000..09218f3 --- /dev/null +++ b/modules/WSDMNotSupportedNotification.py @@ -0,0 +1,27 @@ +# Mattermost Bot module. +# Copyright (c) 2016-2022 by Someone (aka. Jan Vales ) +# published under MIT-License + +from inspect import cleandoc + + +# pylint: disable=wrong-import-position +from AbstractWSHandler import AbstractWSHandler +class WSDMNotSupportedNotification(AbstractWSHandler): + NAME = "dm-not-supported-notification" + + def on_WS_EVENT(self, data): + if data["data"]["channel_type"] == "D" and data["data"]["sender_name"] != "@bot": + import pprint + pprint.pprint(data) + self.bot.api.create_post(data["broadcast"]["channel_id"], cleandoc(""" + ``AUTODELETE-WEEK`` :warning: DMs not supported. Use self-channel as storage. + ## ``It seems like you sent me a direct message.`` + While I appreciate the attention, I am not programmed to respond to this message in any meaningful way. + + :warning: Also I feel like I need to point out that this channel can get wiped when I randomly malfunction and that it can happen that @someone gets to see the messages and files posted here when debugging me. + + ##### :point_right: If you intended to store some files or messages for later use, maybe I can inspire you to use your "self-channel" @ https://mattermost.fsinf.at/fsinf/messages/"""+data["data"]["sender_name"]+""" instead? + """)) + + return True -- 2.43.0