]> git.somenet.org - pub/jan/mattermost-bot.git/blob - modules/WSDMNotSupportedNotification.py
new file: modules/CommandFSOpen.py
[pub/jan/mattermost-bot.git] / modules / WSDMNotSupportedNotification.py
1 # Mattermost Bot module.
2 #  Copyright (c) 2016-2022 by Someone <someone@somenet.org> (aka. Jan Vales <jan@jvales.net>)
3 #  published under MIT-License
4
5 from inspect import cleandoc
6
7
8 # pylint: disable=wrong-import-position
9 from AbstractWSHandler import AbstractWSHandler
10 class WSDMNotSupportedNotification(AbstractWSHandler):
11     NAME = "dm-not-supported-notification"
12
13     def on_WS_EVENT(self, data):
14         if data["data"]["channel_type"] == "D" and data["data"]["sender_name"] != "@bot":
15             self.bot.api.create_post(data["broadcast"]["channel_id"], cleandoc("""
16                 ``AUTODELETE-WEEK`` :warning: DMs not supported. Use self-channel as storage.
17                 ## ``It seems like you sent me a direct message.``
18                 While I appreciate the attention, I am not programmed to respond to this message in any meaningful way.
19
20                 :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.
21
22                 ##### :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?
23                 """))
24
25             return True