Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Discord code blocks: Export to is Ok Import from KO
#1
Hi QB64pe friends 
this message can be interesting for who uses Discord or for developers team working on Discord interfacing:

If you want to share your code on Discord server of QB64pe you can do this easily through the menu of QB64pe IDE:  File -> Exort as...--> Discord codebox.  And that is fantastic!


[Image: Discord-codebox-original.jpg]


The way back is more difficult. 
if you select the icon copy from a codebox on Discor server or you highlightes handly the text of codebox and then you perform a rightclick and choose  copy text, then you open QB64pe IDE and rightclick to paste or choose menu Edit --> paste  you got a bad stuff...
the code is written in the editor window with the formatting of Discord codebox!

[Image: Discord-codebox-paste-into-QB64pe-IDE.jpg]



the only way to escape to this trap is  1. highlight the text of codebox by mouse and 2. then copy via keyboard combo Ctrl+C. 
Now you got the source code with no formatting characters.

So about discord codebox  , is it possible  to have the come back way straight as an option of Paste menu command o similar?

I have already told my way to do this.
Reply
#2
No, unfortunatly that is not possible.

See it the opposite way, if one publishes an ANSI code block for others to test, then of course the ANSI sequences must be part of the code block copy to reproduce the exact behavior. Not taking the sequences would be similar to stripping all COLOR commands from a BASIC program.

Unfortunately Discord doesn't have a native QB codeblock, we just use the ANSI codeblock to fake some (not all) of our highlighting. But when you copy it back it is per se not a BASIC program, as it was designated as ANSI in Discord.

In fact manually selecting the code and copy it is the only way to get it without the ANSI sequences, there's nothing we can do except from making a native QB code block plugin for Discord, and that's at least far beyond me, but if someone else is able to do that, then I'm happy to change the code export feature to use that one.
Reply
#3
Sorry @TempodiBasic,

I didn't read your message carefully enough. While my words from above remain true for the general handling of ANSI codeblocks, it is of course absolutely possible to filter the sequences when pasting it back into the IDE (I missed that pasting partSmile).

We don't even need a special option or "Paste from Discord" menu entry for it but simply perform the action on the regular paste operation, I'll shortly push a change to the repository, so we'll have that working with the next release.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  VS Code and Qb64 pe Unseen Machine 6 718 09-03-2025, 09:42 PM
Last Post: grymmjack
  has anyone had ChatGPT write QB64 code yet? madscijr 13 2,915 08-23-2025, 09:15 AM
Last Post: doppler
  liquid code experiment madscijr 3 485 06-20-2025, 07:26 PM
Last Post: madscijr
  My discord account AtomicSlaughter 2 828 01-31-2025, 06:07 PM
Last Post: SMcNeill
  [split] Lines of Code bplus 20 2,989 01-25-2025, 05:11 PM
Last Post: Pete

Forum Jump:


Users browsing this thread: 1 Guest(s)