This implements the /rot command of our Slack bot. The format of this
command is as follows:
- /rot [count|*] String to be rotated
+ /rot [count|*] String to be rotated
The optional count indicates an amount to rotate each character in the
string. If the count is '*' or is not present, then the string will
in a direct message that it is not a member of. Otherwise, if the slash
command was issued in a channel, the bot will reply in that channel."""
- data = request.get_data();
- headers = request.headers;
+ data = request.get_data()
+ headers = request.headers
response_url = request.form.get('response_url')
channel_name = request.form.get('channel_name')
channel = request.form.get('channel_id')
if (match):
try:
count = int(match.group(1))
- except:
+ except ValueError:
count = None
text = match.group(2)
else:
if count:
reply += rot_string(text, count)
else:
- reply += "\n".join(["{:02d} ".format(count) + rot_string(text, count) for count in range(1,26)])
+ reply += "\n".join(["{:02d} ".format(count) + rot_string(text, count)
+ for count in range(1, 26)])
reply += "```"