4 def rot(turb, body, args):
5 """Implementation of the /rot command
7 The args string should be as follows:
9 [count|*] String to be rotated
11 That is, the first word of the string is an optional number (or
12 the character '*'). If this is a number it indicates an amount to
13 rotate each character in the string. If the count is '*' or is not
14 present, then the string will be rotated through all possible 25
17 The result of the rotation is returned (with Slack formatting) in
18 the body of the response so that Slack will provide it as a reply
19 to the user who submitted the slash command."""
21 channel_name = body['channel_name'][0]
22 response_url = body['response_url'][0]
23 channel_id = body['channel_id'][0]
25 result = turbot.rot.rot(args)
27 if (channel_name == "directmessage"):
28 requests.post(response_url,
29 json = {"text": result},
30 headers = {"Content-type": "application/json"})
32 turb.slack_client.chat_postMessage(channel=channel_id, text=result)