Skip to content

Commit

Permalink
fixed regex
Browse files Browse the repository at this point in the history
  • Loading branch information
ddbruce committed May 5, 2019
1 parent f04fb54 commit 73c7f54
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,21 @@ app.action(
user: { id }
}
}) => {
const channel_id = /#(.*?)[a-zA-Z1-9]{9}/
const channel_id = /<#(.*?)[a-zA-Z0-9]{7,10}>/
.exec(blocks[0].text.text)[0]
.replace("#", "");
.replace("<#", "")
.replace(">", "");
const text = blocks[1].text.text.replace("&gt;&gt;&gt;", "");
const user_id = /@(.*?)[a-zA-Z1-9]{9}/
const user_id = /<@(.*?)[a-zA-Z0-9]{7,10}>/
.exec(blocks[0].text.text)[0]
.replace("@", "");
.replace("<@", "")
.replace(">", "");
if (/^APP_.*/.test(action_id)) {
approveMessage(channel_id, text, user_id, ts, id);
} else if (/^REJ_.*/.test(action_id)) {
rejectMessage(channel_id, text, user_id, ts, id);
} else if (/^DEL_.*/.test(action_id)) {
deleteRequest(channel_id, text, user_id, ts, id);
cancelRequest(channel_id, text, user_id, ts, id);
}
}
);
Expand Down

0 comments on commit 73c7f54

Please sign in to comment.