Skip to content

Commit

Permalink
storing message id in reaction logs sheet, in order to be able to ide…
Browse files Browse the repository at this point in the history
…ntify uniqueness of messages, not only based on their content
  • Loading branch information
fcamblor committed Apr 29, 2020
1 parent 6bf7e7a commit 92279f3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scoring-slack-bot/main/index.ts
Expand Up @@ -143,7 +143,8 @@ class ScoringBot {
const messageInfos = this.retrieveMessageInfosFor(event.item.channel, event.item.ts);
sheet.appendRow([
new Date(), event.user, event.item_user, event.item.channel, event.reaction, event.type,
messageInfos?messageInfos.threadId:"", messageInfos?messageInfos.threadAuthorId:"", messageInfos?messageInfos.text:""
messageInfos?messageInfos.threadId:"", messageInfos?messageInfos.threadAuthorId:"", messageInfos?messageInfos.text:"",
event.item.ts
]);
}

Expand Down Expand Up @@ -181,13 +182,13 @@ class ScoringBot {
const scoreSheet = spreadsheet.insertSheet(channelConfig.sheetName, spreadsheet.getSheets().length);
const reactionsSheet = spreadsheet.insertSheet(channelConfig.reactionSheetName, spreadsheet.getSheets().length);

this.setSheetHeaderRows(scoreSheet, ["=SCORES_FOR_CHANNEL(Config!$A$"+newRowIndex+";Config!$C$"+newRowIndex+";UserList!A:B;'"+channelConfig.reactionSheetName+"'!A:I)"], "formulas");
this.setSheetHeaderRows(scoreSheet, ["=SCORES_FOR_CHANNEL(Config!$A$"+newRowIndex+";Config!$C$"+newRowIndex+";UserList!A:B;'"+channelConfig.reactionSheetName+"'!A:K)"], "formulas");

reactionsSheet.deleteRows(2, reactionsSheet.getMaxRows() - 2);
reactionsSheet.getRange(1, 10, 1, 1).setFormulas([
["=EXTRACT_SCORES_FROM_REACTIONS(Config!$A$"+newRowIndex+";Config!$C$"+newRowIndex+";UserList!A:B;A:I)"]
reactionsSheet.getRange(1, 11, 1, 1).setFormulas([
["=EXTRACT_SCORES_FROM_REACTIONS(Config!$A$"+newRowIndex+";Config!$C$"+newRowIndex+";UserList!A:B;A:K)"]
]);
this.setSheetHeaderRows(reactionsSheet, ["date", "issuer user id", "target user id", "channel reaction", "type", "thread id", "thread author id", "target message"], "values");
this.setSheetHeaderRows(reactionsSheet, ["date", "issuer user id", "target user id", "channel", "channel reaction", "type", "thread id", "thread author id", "target message", "target message id", ""], "values");

this.botShouldSay(event.channel, "Your config ["+configName+"] has been successfully initialized !\n⚠️Don't forget to publish the score sheet and put the link in the leaderboard channel configuration.", event.thread_ts);
}
Expand Down

0 comments on commit 92279f3

Please sign in to comment.