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

Telegram users should be able to run bot commands on IRC #330

Open
Tjzabel opened this issue Jun 30, 2020 · 2 comments
Open

Telegram users should be able to run bot commands on IRC #330

Tjzabel opened this issue Jun 30, 2020 · 2 comments
Labels
help wanted Anyone is welcome to help us with this! new change Adds new capabilities or functionality Telegram Issues relating to Telegram bridge
Milestone

Comments

@Tjzabel
Copy link
Member

Tjzabel commented Jun 30, 2020

Summary

If a bot exists on IRC that listens for generic commands (!command) from users, a Telegram user should also be able to run these commands across the bridge.

Background

Is your feature request related to a problem? Please describe:

IRC bots are unable to see commands sent from Telegram. Currently, messages are sent over the bridge like this:

<user> !foo bar

When a TG user wishes to run a command on IRC, the bridge should not send over the Telegram username, and should show:

!foo bar

Details

Parse the first character of each Telegram message for a known command flag such as !. Then, if the first character matches the known command flag, the bridge should only send over the message without the user's TG username, so any IRC bot can properly run the given command. This will allow Telegram users to participate more seamlessly with IRC.

Outcome

Telegram users are able to more seamlessly contribute to IRC by being able to use IRC bot commands specific channels may have.

@Tjzabel Tjzabel added help wanted Anyone is welcome to help us with this! new change Adds new capabilities or functionality Telegram Issues relating to Telegram bridge labels Jun 30, 2020
@Tjzabel Tjzabel added this to the v2.x.x milestone Jun 30, 2020
@xforever1313
Copy link
Member

This is a tough one....

For some IRC Bots, the ! command is easy, it just outputs a canned message (e.g. !help).

However, some IRC Bots have smarts. It actively looks at the username of who sent the message and performs actions based on who sent it. So if using a quote bot, for example, an someone on Telegram sends !quote add something, the user that adds the quote won't be the Telegram user, but Teleirc.

There are also some bots that are even smarter; they are aware bridges are a thing and can parse messages from bridged users and figure out who sent the message. So <teleirc> <TelegramUser> !quote add something the bot would notice "teleirc" sent the message, and it is configured to be a bridge bot. It then parses the message and sees "TelegramUser" sent "!quote add something". It would add the quote as TelegramUser, not teleirc. If teleirc sent !quote add, the IRC Bot would have no idea who on the other side of the bridge sent the message and attribute the quote to teleirc.

There is no way to change who is sending a username over IRC (with good reason), PRIVMSG takes in two parameters: the target and the message.

So with all of that... there is a compromise that could be done. Not send 1 message during a command, but 2. The first one could be "TelegramUser sent command: !quote add something" and then the next message would be "!quote add something". This buys us two things:

  • The first message informs the IRC Channel who on the other-side of the bridge sent the command. IRC Bots who are aware bridge bots are a thing can then parse the message after the "send command:" message and take action.
  • The second message informs not-so-smart IRC Bots that a command has been sent. If these bots are unaware of bridge-bots, they are out-of-luck, they will always parse the user as teleirc.

Perhaps we can even make this configurable (e.g. have teleirc send the first message, second message, or both).

@xforever1313
Copy link
Member

We would also need a setting that specifies which message prefixes are commands. Some bots are "!", some are "#", others are "@". Heck, some are all three 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Anyone is welcome to help us with this! new change Adds new capabilities or functionality Telegram Issues relating to Telegram bridge
Projects
None yet
Development

No branches or pull requests

2 participants