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

Improve the display of Discord code blocks when bridging to IRC #81

Open
ilyagr opened this issue Oct 29, 2024 · 5 comments · May be fixed by #83
Open

Improve the display of Discord code blocks when bridging to IRC #81

ilyagr opened this issue Oct 29, 2024 · 5 comments · May be fixed by #83
Labels
type: bug Something isn't working type: feature New feature or request

Comments

@ilyagr
Copy link

ilyagr commented Oct 29, 2024

If I type in Discord:

```python
def f():
  return 2 + 2
```
image

I get this on IRC:

16:29:18 <BridgeBot`> <i​ly​ag​r> def f(): 
16:29:19 <BridgeBot`> <i​ly​ag​r>   return 2 + 2
16:29:20 <BridgeBot`> <i​ly​ag​r> 
image

I wonder if this could be improved.

It would help if the bot could leave the "```python" line and the closing backticks on the IRC side.

It would be even better if it could be indicated that these lines come from a single Discord message. If something even better could happen -- that is even better!

P.S. Thanks for the nice project with the simple setup and clear instructions! It helps a lot.

@ilyagr ilyagr changed the title Markdown code blocks are not communicated in a nice way. Markdown code blocks are communicated to IRC in a confusing way Oct 29, 2024
@zachbr zachbr added the type: feature New feature or request label Nov 1, 2024
@zachbr zachbr changed the title Markdown code blocks are communicated to IRC in a confusing way Improve the display of Discord code blocks when bridging to IRC Nov 1, 2024
@zachbr
Copy link
Owner

zachbr commented Nov 1, 2024

Hello, currently code blocks are formatted using the monospace formatting indicator 0x11 when being bridged to IRC.

Unfortunately, this is not widely supported by many IRC clients, but it is the only de facto standard for this I am aware of. While we may be able to just send a larger text block to represent this, I am leery to make the bot emit more lines than necessary where it can be avoided.

This is the current behavior on a client that supports the 0x11 formatting code:
image

As you can see, even on supported clients we're not properly prefixing successive lines with the monospace formatting code. So there's definitely work to be done here regardless.

@zachbr zachbr added the type: bug Something isn't working label Nov 1, 2024
@ilyagr
Copy link
Author

ilyagr commented Nov 1, 2024

Interesting, thanks!

It makes sense to prioritize fixing the actual bug that you mentioned.

For the rest of it, I'm just using the default web client somebody set up, that seems to be https://codeberg.org/emersion/gamja. I'm not sure how hard it would be to support this formatting code there (I don't know much about how IRC works), but I filed https://todo.sr.ht/~emersion/gamja/167 and https://todo.sr.ht/~emersion/goguma/160 for it.

Perhaps you could consider adding an option of leaving backticks in, instead of monospace?

Update: This makes sense especially for inline backticks since Dis4IRC converts backticks typed in IRC to Discord's code blocks. I think using both monospace and backticks is best for that. For multi-line code blocks, it's more questionable because it causes more lines, but I'd still use it if it was an option.

Are there free IRC clients that support this monospace extension? I'm mostly interested in Mac or Android, but you could document them in the README?

@ilyagr
Copy link
Author

ilyagr commented Nov 20, 2024

I made #83 that inserts backticks on the IRC side. It does not fix the bug with multiline code blocks. As I say over there, I'm not sure it's a good idea to merge it if some people prefer the other way, since I didn't make any configuration for this yet.

Two additional thoughts:

  • I tried to train myself to use "`...`" instead of plain backticks on the Discord side, but it was hopeless.
  • The bug with multiline code blocks does not seem to matter as much in practice. I don't see people on Discord trying to use multiline code blocks, at least after I warned them that multiline messages could be problematic (no idea whether anyone noticed the warning).
  • The first client I found that supported monospace was Textual, but it's barely visible there with its default config:
image

See the PR for how it looks with the backticks, which I think is clearer.

Out of curiosity, what's the client you are using? Does it support the soju bouncer? (But, in any case, I think gamja and liberachat web clients would be the ones I'd want to keep in mind for my Discord-IRC bridge)

@zachbr
Copy link
Owner

zachbr commented Nov 23, 2024

I use TheLounge as my client, but I'm not as active as I once was. It shouldn't have any problems connecting to IRC servers or IRC bouncers but I am not familiar with soju specifically. Ultimately for me it was just about having a good way to have the same client configurations, unread/read indicators, etc. across a comically large number of devices. https://github.com/thelounge/thelounge

I am not opposed to including a mode where we pass through the markdown directly to IRC more or less unchanged, but I am not sure what IRC clients support that and whether it's worth including as a configuration option.

@ilyagr
Copy link
Author

ilyagr commented Nov 24, 2024

thelounge is quite interesting, thanks for telling me about it! I think it doesn't make much sense to learn about soju if you use it, since it covers the same usecase. https://chat.sr.ht serves a similar function to somebody setting up an always-on instance of thelounge for you to use (assuming you don't feel the need to use IRC clients other than thelounge), and thelounge looks easier to configure for self-hosting (there's one thing to configure, instead of a bouncer + a client).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working type: feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants