{"id":200,"date":"2026-04-24T19:32:58","date_gmt":"2026-04-24T19:32:58","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/a_carpenter\/?p=200"},"modified":"2026-04-24T19:32:58","modified_gmt":"2026-04-24T19:32:58","slug":"friday-4-24-26","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/a_carpenter\/2026\/04\/24\/friday-4-24-26\/","title":{"rendered":"Friday 4\/24\/26"},"content":{"rendered":"\n<p><strong>This week I have been mainly working on my Capstone project Teams bot.<br><br>In terms of the progress made, I have:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Attempted to make proactive messaging, but put on hold due to failure (most likely due to missing Azure Registration and true Teams compatibility)<\/strong><\/li>\n\n\n\n<li><strong>Learned how to create adaptive cards<\/strong><\/li>\n\n\n\n<li><strong>Used API to send random Pokemon image upon request <\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>#TEMPORARILY ON HOLD (WILL TRY WITH AZURE REGISTRSTION)\n\"\"\"@app.on_message_pattern(re.compile(r\"remind\"))\nasync def handle_proactive_message(ctx:ActivityContext&#91;MessageActivity]) -> None:\n    # Use the standard from_.id for consistency\n    user_id = ctx.activity.from_.id\n    storage&#91;user_id] = ctx.activity.conversation.id\n\n    await ctx.send(\"Okay\")\n    scheduler.add_job(\n        send_proactive_notification, \n        'date', # Use 'date' for a one-time reminder in 10s\n        run_date=datetime.now() + timedelta(seconds=10),\n        args=&#91;user_id], \n        id=f\"remind_{user_id}\",\n        replace_existing=True\n    )\n\nasync def send_proactive_notification(user_id: str):\n    conversation_id = storage.get(user_id)\n    if not conversation_id:\n        print(f\"DEBUG: No conversation found for {user_id}\") # Check your console!\n        return\n    \n    # Required: Proactive messages often need an explicit recipient account\n    activity = MessageActivityInput(text=\"I'm reminding u bro\").with_recipient(Account(id=user_id))\n    \n    await app.send(conversation_id, activity)\"\"\"<\/code><\/pre>\n\n\n\n<p><strong>Above is the code for the proactive messaging which is on hold due to lack of proper integration into Microsoft Teams.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@app.on_message_pattern(re.compile(r\"image|sendimage|imagepls\"))\nasync def handle_image_request(ctx: ActivityContext&#91;MessageActivity]) -> None:\n    \"\"\"send image as adaptive card\"\"\"\n    num = random.randint(1,1025)\n    card = AdaptiveCard(\n        body=&#91;\n            Image(\n                url=f\"https:\/\/raw.githubusercontent.com\/PokeAPI\/sprites\/master\/sprites\/pokemon\/{num}.png\",\n                size=\"Large\",\n                alt_text=\"ditto\"\n            )\n        ]\n    )\n\n    await ctx.send(card)<\/code><\/pre>\n\n\n\n<p><strong>Above is the code to send adaptive card with a random pokemon image.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week I have been mainly working on my Capstone project Teams bot. In terms of the progress made, I have: Above is the code for the proactive messaging which is on hold due to lack of proper integration into Microsoft Teams. Above is the code to send adaptive card with a random pokemon image.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-200","post","type-post","status-publish","format-standard","hentry","category-friday"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/posts\/200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/comments?post=200"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/posts\/200\/revisions"}],"predecessor-version":[{"id":201,"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/posts\/200\/revisions\/201"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/media?parent=200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/categories?post=200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_carpenter\/wp-json\/wp\/v2\/tags?post=200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}