waitonbot/channel_util.py

32 lines
905 B
Python

from typing import Match
from slackclient import SlackClient
import slack_util
# Useful channels
GENERAL = "C0CFHPNEM"
RANDOM = "C0CFDQWUW"
COMMAND_CENTER_ID = "GCR631LQ1"
SLAVES_TO_THE_MACHINE_ID = "C9WUQBYNP"
BOTZONE = "C3BF2MFKM"
HOUSEJOBS = "CDWDDTAT0"
# Callback for telling what channel we in
async def channel_check_callback(slack: SlackClient, msg: dict, match: Match) -> None:
# Sets the users scroll
rest_of_msg = match.group(1).strip()
rest_of_msg = rest_of_msg.replace("<", "lcaret")
rest_of_msg = rest_of_msg.replace(">", "rcaret")
# Respond
response = ""
response += "Channel id: {}\n".format(msg["channel"])
response += "Escaped message: {}\n".format(rest_of_msg)
slack_util.reply(slack, msg, response)
channel_check_hook = slack_util.ChannelHook(channel_check_callback,
patterns=r"channel id\s*(.*)")