Closed jsfour closed 1 year ago
We need a new comment type here: https://github.com/octaviuslabs/walter/blob/main/src/index.ts#L199 for "status" messages which are messages sent by the bot and say "Queued for processing..." or "Processing this now".
Queued for processing...
To add a new comment type for "status" messages, you can modify the parseComment
function to include a new regex pattern to match the status messages. Here is the updated pseudocode:
function parseComment(comment: any): CommentAction {
const approveRegex = new RegExp(`@${BOT_NAME}\\s*APPROVED`, "i");
const statusRegex = new RegExp(`@${BOT_NAME}\\s*(Queued for processing...|Processing this now)`, "i");
if (approveRegex.test(comment.body)) {
return { type: "approve", body: comment.body };
}
if (statusRegex.test(comment.body)) {
return { type: "status", body: comment.body };
}
// design by default
return { type: "design", body: comment.body };
}
This new code checks if the comment body matches the "status" message pattern, and if it does, it returns a new comment action with the type "status" and the comment body. The rest of the code remains unchanged.
The comment will be from the bot (not tagged for the bot). Also update type for "comment" its a comment from the octokit webhook event.
The comment will be from the bot (not tagged for the bot). Also update type for "comment" its a comment from the octokit webhook event.
Queued for processing...
I understand your requirements now. You want to update the parseComment
function to handle the status messages sent by the bot and update the type for "comment" from the octokit webhook event. Here's the updated pseudocode:
function parseComment(comment: any): CommentAction {
const approveRegex = new RegExp(`@${BOT_NAME}\\s*APPROVED`, "i");
const statusRegex = new RegExp(`(Queued for processing...|Processing this now)`, "i");
if (comment.user.login === BOT_NAME && statusRegex.test(comment.body)) {
return { type: "status", body: comment.body };
}
if (approveRegex.test(comment.body)) {
return { type: "approve", body: comment.body };
}
// design by default
return { type: "comment", body: comment.body };
}
This updated code checks if the comment user is the bot and if the comment body matches the "status" message pattern. If both conditions are met, it returns a new comment action with the type "status" and the comment body. The rest of the code remains unchanged, but the default type is now "comment" instead of "design".
@imwalterbot APPROVED https://github.com/octaviuslabs/walter/blob/main/src/index.ts#L199 for changes
@imwalterbot APPROVED https://github.com/octaviuslabs/walter/blob/main/src/index.ts#L199 for changes
Queued for processing...
@imwalterbot APPROVED https://github.com/octaviuslabs/walter/blob/main/src/index.ts#L199 for changes
Processing this now
We need a new comment type here: https://github.com/octaviuslabs/walter/blob/main/src/index.ts#L199 for "status" messages which are messages sent by the bot and say "Queued for processing..." or "Processing this now".