Skip to content

Commit

Permalink
Merge pull request #3 from domwhewell-sage/domwhewell-sage-patch-1
Browse files Browse the repository at this point in the history
Fix teams output
  • Loading branch information
domwhewell-sage authored Sep 9, 2024
2 parents ca8ef80 + fc7b0d2 commit 465d089
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions bbot/modules/output/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,10 @@ class Teams(WebhookOutputModule):
"min_severity": "Only allow VULNERABILITY events of this severity or higher",
}
_module_threads = 5
adaptive_card = {
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl": None,
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"msteams": {"width": "full"},
"body": [],
},
}
],
}

async def handle_event(self, event):
while 1:
data = self.format_message(self.adaptive_card.copy(), event)
data = self.format_message(event)

response = await self.helpers.request(
url=self.webhook_url,
Expand Down Expand Up @@ -89,7 +73,23 @@ def get_severity_color(self, event):
color = "Good"
return color

def format_message(self, adaptive_card, event):
def format_message(self, event):
adaptive_card = {
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl": None,
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"msteams": {"width": "full"},
"body": [],
},
}
],
}
heading = {"type": "TextBlock", "text": f"{event.type}", "wrap": True, "size": "Large", "style": "heading"}
body = adaptive_card["attachments"][0]["content"]["body"]
body.append(heading)
Expand Down

0 comments on commit 465d089

Please sign in to comment.