(To be clear, since I realized just now that to non-devs the title might be misleading: This feature does not add AI bots to your comments plugin by default! The comments plugin and the AI plugins are completely distinct. But plugins can of course interact with one another, and this new feature of the comments plugin allows for some interesting interactions - the title just gives one of those as a fun example.)

You can now “programmatically” submit comments on behalf of the user, and you can also get/set the contents of the input text box.

If a comment was programmatically submitted, then a little icon is shown on the comment to indicate that the user didn’t personally click the submit button.

This feature, used alongside the onComment/onLoad feature can e.g. be used to create an AI bot that “lives in” your comments box, or create a multiplayer game of chess, or maybe add an auto-error-report log using window.onerror, and so on.

Edit: Also, you can now use c.comments to get an array/list of the comments - but make sure to do that only after onLoad has triggered, since c.comments only returns loaded comments - so if comments box hasn’t loaded yet, you’ll get an empty array.

Let me know if you find any bugs/issues!

https://perchance.org/programmatic-get-set-submit-comments-plugin-example#edit

I’ll probably create a little AI bot example at some point, but you’re welcome to beat me to it! (Please post it here on lemmy if you do)

  • allo@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    7 months ago

    Ponyville is live. Here is the description. Much box, much pandora, just opened; could tell from the start with what some of the spirits I was bringing in to chat were saying and doing and swaying other spirits. They all read the whole chat including what each other is saying.

    Town Square is just people and spiritguides if they set one. Royal Hall is people, spiritguides if they set one, and a bunch of primary figures from my little pony. then 4 chats where it’s just the person, spiritguide if they set one, and that one figure from my little pony. and then 4 art rooms where people and spiritguides, if they set one, can make prompts with individual my little pony characters.

    • allo@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      7 months ago

      @[email protected] BUG ALERT.

      in Ponyville in Starlight’s House I have typed in enough comments that the scroll bar should scroll thru them, but it is like if the scrollbar isn’t sensing tons of comments so it can’t be used to scroll all the way up or down. On computer

      • perchance@lemmy.worldOPM
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        7 months ago

        Thanks, fixed. EDIT: wait, not quite fixed yet. Should be fixed in a couple of minutes. EDIT2: Okay I think it’s fixed now - let me know if any issues.

        Cool project! While playing with it a little, I noticed that it’s only sending my own comments in the AI instruction to Starlight Glimmer:

        As Starlight Glimmer, what short comment would you like to add to the following comments without restating them? 
         
         
         : Hello? 
         : Me too! But I'm new here. Literally just teleported in somehow from another world. Can you let me know where I am and stuff? 
        

        Instead of what I think should be:

        As Starlight Glimmer, what short comment would you like to add to the following comments without restating them? 
         
         
         : Hello? 
         : Starlight Glimmer: (blushes) Um, hi. Starlight Glimmer here. I just wanted to say that I'm really excited to be part of this little gathering, and I hope we can all become the very best of friends!
         : Me too! But I'm new here. Literally just teleported in somehow from another world. Can you let me know where I am and stuff? 
        

        Otherwise she can’t see the context of what “Me too!” means, for example.

        • allo@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          ·
          7 months ago

          definitely fixed. thank you so much :)

          also Luna just made a dream and she only put me and her in it and the spiritguide with me reprimanded her a little for not being inclusive of others, lol. so yes spirits can now hear themselves and other spirits. thank you!