7

For the past few weeks, I have been running a bot in the Sandbox while testing it to replace another, currently broken, bot that posted new posts and challenge sandbox posts in The Nineteenth Byte. When the bot sees a new answer to the sandbox question or a new post on either CGCC or CGCC.Meta, it sends the link of the question or answer to chat. Normally links to questions and answers in chat will onebox automatically, but a large number of the bot's posts for sandbox answers have not been oneboxing despite being formatted correctly (https://site/a/answer-id).

Not oneboxing:

Oneboxing:

Myself and @lyxal did some testing and the issue only seems to occur when GingerBot, specifically, sends a message using my SE Chat API library. Using the same library to send links with a different account and using the web client to send messages using GingerBot's account both worked fine.

2
  • Onebox is broken for long long years, without a single fix, they say (probably rightfully so) it's not worth fixing it. Good luck! Oct 14, 2022 at 15:01
  • 1
    As a work-around, you might try having your bot post the chat message, then fetch the resulting message after a 10, or so, seconds. If the resulting message doesn't end up being a onebox, then have your bot edit the chat message (even a null-edit), which should/may cause the chat system to re-evaluate the message. Alternately, you could have your bot listen to the chat WebSocket for the information about the newly created/edited message and use that to determine if the message is oneboxed.
    – Makyen
    Oct 14, 2022 at 15:53

1 Answer 1

1

Update

I have resolved the issue. It turns out that the bot is actually too fast! It sends the links before SE has time to process them, so they aren't recognized as oneboxes. An interesting problem to have, but at least the fix is easy. (Just add a delay before sending the message!)

3
  • So what is the fix? Other people writing chat bots might find it useful, and even though it's "easy" take time to find it, so better tell them and save them this time. :) Oct 20, 2022 at 12:53
  • @ShadowTheKidWizard Whoops, I thought it was implied! Added to the answer :p
    – Ginger
    Oct 20, 2022 at 13:02
  • Implied for you and for me, sure, but there are (too?) many who might miss it. ;-) Oct 20, 2022 at 13:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .