ubiquity-os-marketplace / ubiquity-os-kernel-telegram

0 stars 5 forks source link

Implement `/newtask` #32

Closed Keyrxng closed 1 day ago

Keyrxng commented 3 weeks ago

A new admin controlled command that allows the creation of GitHub tasks direct from telegram.

We lack the same context that we do on GitHub so it's required that the invoker pass in the repository.full_name (ubiquity-os-marketplace/ubiquity-os-kernel-telegram) so that we deliver the issue to the correct repo. This makes sense as admins will know immediately where they'd want it opened.

0x4007 commented 3 weeks ago

Should be inlined "inline function" as we discussed before.

Keyrxng commented 3 weeks ago

I don't think anything will be ported. Inline message seems quite different.

I will implement as I first suggested and you can see how it looks and we'll take it from there re: creating new chats from user comments.

I spent an hour reading through inline docs etc last night to try implement repo name autocomplete.

https://core.telegram.org/bots/api#inline-mode https://core.telegram.org/bots/inline

I think you want to type @ubiquitos and then it pop up an inline modal only you can see and then you press a button or type newtask and it 'runs' this logic, is that right?

  1. The inline update the server receives won't have context on which message you want. It's purpose is to post something into the chat like a gif, document, link etc.
  2. It might capture the message ctx if you initiate a direct reply and then try to use @ubiquityos but they seem like separate features, I had to enable inline mode via the botfather and haven't explored it much.

I'll attempt to implement it, showing why it cannot be done if that's the case and we'll take it from there.

Keyrxng commented 3 weeks ago

This is the trouble with the inline query; it's that we don't know which comment you are referring to even when direct replying and then mentioning the bot as the update doesn't reference it.

image

Inline query results are delivered in a fire-and-forget fashion. In other words, after your bot sent the list of inline query results to Telegram, it will not know which result the user picked (or if they picked one at all).

The above means that somehow we'd need to capture the original message and then hoist that into the inline_query update and then persist that through the chain of inline_query updates as we need to select which org then which repo. So at least 3 inline_queries to chain after capturing the task inspo comment.

There are advanced parts of Grammy that allow branching and forking of different ctx and updates and splicing them but that's beyond reach atm, still a lot of learning involved with the APIs and the libs we are using. Two brand new APIs and two libs; one for MTProto, one for BotAPI.


Let's ship the feature as a command for V1 and a task can be dedicated to upgrading it to an 'inline function', as it'll require more research and quite a bit of work as mentioned above. Do you agree?

ubiquity-os-beta[bot] commented 1 day ago

@Keyrxng the deadline is at Wed, Dec 4, 8:52 PM UTC

ubiquity-os-beta[bot] commented 1 day ago

A new workroom has been created for this task. Join chat