Bootleg bot: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 1: Line 1:
''This page is prepared for the prototyping class on 3 March 2026 as part of SI29 and follows a Special Issue day with Doriane and Simon fully on topic of [[The bootleg library]].''
''This page is prepared for the prototyping class on 3 March 2026 as part of SI29 and follows a Special Issue day with Doriane and Simon fully on topic of [[The bootleg library]].''
==ssh to bootleg library==
There are two ways in which we can do this.
===laptop > sergio > bootleg library===
ssh sergio
===laptop > XVM > bootleg library===




Line 48: Line 58:


https://zulip.com/help/interactive-bots-api
https://zulip.com/help/interactive-bots-api
==hello Python!==
see: [[Hello Python]]
==read database==
* Simon and Luke made this Python script in 2021, to make the temporary index cards: https://git.vvvvvvaria.org/simoon/temporary-indexing
* documentation of sqlite module in Python: https://docs.python.org/3/library/sqlite3.html
==write database==
* a standalone webform for file uploads
* using the bootleg library upload URLs
* hosted on sergio (but can be hosted on another sandbox too in the future)


[[Category:Workbooks]]
[[Category:Workbooks]]

Revision as of 10:51, 3 March 2026

This page is prepared for the prototyping class on 3 March 2026 as part of SI29 and follows a Special Issue day with Doriane and Simon fully on topic of The bootleg library.

ssh to bootleg library

There are two ways in which we can do this.

laptop > sergio > bootleg library

ssh sergio

laptop > XVM > bootleg library

the zulip bot

First install the requirements listed on this page:

https://zulip.com/help/writing-bots

You can run the bot with:

zulip-bot-shell bootlegbot.py

bootlegbot.py

class BootlegBot(object):
    '''
    This is a small zulip bot to interact with the 👢🦵 library
    '''

    def usage(self):
        return '''Ask the bot about a book and they will search for it in the 👢🦵 library'''

    def handle_message(self, message, bot_handler):
        # This happens when someone write to the bot

        sender = message['sender_full_name']
        content = message['content']
        print(f'{sender} wrote to the bot: "{content}"')

handler_class = BootlegBot

bootlegbot.zuliprc

[api]
email=bootleg-bot@zulip.xpub.nl
key=XXXXXXXX
site=https://zulip.xpub.nl

We need to share the key with each other somehow.

Zulip bot API

https://zulip.com/help/interactive-bots-api

hello Python!

see: Hello Python

read database

write database

  • a standalone webform for file uploads
  • using the bootleg library upload URLs
  • hosted on sergio (but can be hosted on another sandbox too in the future)