-
Notifications
You must be signed in to change notification settings - Fork 51
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
Inline mode support #42
Comments
There is no support for inline mode right now. |
Will this be difficult to implement? I'm still learning Haskell, but I feel like this could be easily implemented, just by defining an InlineQuery record, let Aeson parse it, and build an Update from there. But I guess I would need some help from the current collaborators... |
Well, I tried doing exactly this, but I stuck with something that looks like an infinite recursion during parsing the query and I have no idea, how to fix or debug this. |
@pavel-the-best May I kindly ask you to share the code you are currently working with in order to help you with infinite recursion? |
Yes, here you go: |
Hi! Sorry for the long delay. I've been able to test @pavel-the-best implementation and it looks really good. I've been able to receive correctly inline queries, but couldn't send back results for that query. Currently, the data type InlineQueryResult (https://github.com/pavel-the-best/telegram-bot-simple/blob/a3a88369ffeb7c73802f6fb6725653bdc752de0c/src/Telegram/Bot/API/InlineMode.hs#L68) has only the type, id, and contact fields, so the other ones, required for other types of results are missing. Tomorrow I will check if just adding some fields will do the work, let's see what I can do, because I've never messed with something as advanced as Aeson... In any case, this looks cool! |
Ok, I've been taking a closer look at this, and there is work to do to get the answers/results work (If I understood it correctly, when an inline query comes, the bot should send "answers", and when the user chooses one, that comes to the bot as a "result". Thus, "answer" and "result" are not the same). those dataclasses need to be made, and then hopefully it work. Although I'm very novice, I think I can do, at least, most of it, so I will post here any progress I make! |
Can you please provide EchoBot example that you used for testing this? |
Sorry, I didn't used EchoBot. I made a bot the last month (https://git.sr.ht/~gdanix/marlin_gcode_info_bot), and I wanted to add inline mode to it, so I've been messing with my bot. In any case, I didn't do anything special, just created the bot with I remember I had to uncomment 2 lines from Bot/API.hs to make it work, but it's just a matter of imports/exports. |
Good news!! I've been able to complete a minimal working support for inline mode, and modified EchoBot to make use of it. Now, it should respond to inline queries echoing the query itself. I'm going to work now on cleaning up, documenting and structuring a bit better the dataclasses I've created. One downside is that conversationBot doesn't work with inline mode, probably because inline queries doesn't have a chat id. I've uploaded all the code to my fork: https://git.sr.ht/~gdanix/telegram-bot-simple This is my very first contribution to a Haskell project any feedback (doesn't need to be kind, don't worry) is appreciated! P.S. I forgot to blur the name of my testing bot in the first screenshot... Doesn't matter... |
Hi! I've done a bit more of work for inline mode. I've implemented the InputMessageContent dataclasses (https://core.telegram.org/bots/api#inputmessagecontent) in their own module. I've uploaded all the progress to my fork (https://git.sr.ht/~gdanix/telegram-bot-simple). Please @swamp-agr, let me know if you can grab the changes from there and publish here, or if you prefer me to open a Pull Request. Currently, with these latest additions, a bot can respond to inline queries, and can send back only article results (text, basically). Since all the InputMessageContent dataclasses are in place, these article displayed to the user can result in a text message (like in the above screenshots), but also in a venue, location or contact message. What's left to do is to implement the different result dataclasses. There are a huge number of them, but also the article result must be completed (url, reply_markup, and so on). Also the ChosenInlineResult. |
Hi! I've been looking for a "contributing" file, and I didn't find it. I would really like this library to be complete. Sadly, this is my first time contributing to a Haskell library, and I'm a bit lost. I'm sorry if I didn't do things right. What would be an appropriate plan for delivering this inline mode? To build it on top of the latest version? (I just continued working from the @pavel-the-best work). I guess, since the project is in GitHub, the PR workflow must be followed. |
Hi @gDanix, Please go ahead and open pull request. You contribution is welcome here. Best Regards, |
Thank you so much!! I will redo my changes on top of the latest version (0.3.5, IIRC) and open a PR. I don't think it would be necessary to backport them to previous versions. but let me know if you're interested! |
If there's nothing to add feel free to close the issue. |
Closing in absence of comments. Feel free to re-open at any time. |
Can I program an inline mode bot using this library?
The text was updated successfully, but these errors were encountered: