Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why on messages sent with await channel.send #306

Open
MatthewBaggins opened this issue Jun 27, 2023 · 1 comment
Open

Why on messages sent with await channel.send #306

MatthewBaggins opened this issue Jun 27, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@MatthewBaggins
Copy link
Collaborator

Normally, Stampy sends messages to channels using the Response object. Passing a string to the why argument gives us a way to ask Stampy for why he gave particular responses

            return Response(
                confidence=Conf,
                text=self.dereference(text.partition(" ")[2], who) + "!",
                why=f"{who} told me to say it!",
            )

Screenshot from 2023-06-27 15-56-57

However, sometimes Stampy sends a message to a channel as a string via await channel.send syntax. This allows Stampy send a message to an arbitrary channel, rather than just "in Response" to a message that somebody else posted to the channel. However, in this case there is no why because there is no Response.

        await channel.send(make_post_question_message(question))

Screenshot from 2023-06-27 15-59-10

Giving "reasons why" is served by the Why module.

Maybe it would be possible to use Response with await channel.send but IDK. One alternative I see is just to make Stampy remember all the awaited messages he sends, e.g., by saving them to some new dictionary in Utilities that maps message IDs to their "why's". In this case, we would probably want to have a new method for doing await channel.send, which automatically saves the messages to that dictionary. The Why module would then need to be extended to make use of that dictionary.

@MatthewBaggins MatthewBaggins added the enhancement New feature or request label Jun 27, 2023
@tayler6000
Copy link
Collaborator

I know this is an old post, but I'm not sure this is necessary. The why module is meant to debug responses when Stampy is prompted by a user. Automatic posts, such as the one in this screenshot, are not prompted, Stampy was just designed to post them. Any Stampy Dev should be familiar with what modules automatically post things like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants