Nurdbot: Difference between revisions

From NURDspace
No edit summary
No edit summary
 
(22 intermediate revisions by 5 users not shown)
Line 1: Line 1:
NURDbot is a small IRC bot based on the fantastic jsonbot by Bart Thate. It runs on nurdbot.vm.nurd.space.
nurdbot is the bot in our IRC channel. It used to be based on the fantastic jsonbot by Bart Thate, but has been replaced: see [[GHBot]] and [[Harkbot]].


== Writing custom commands (AKA plugs) ==
== Writing custom commands (AKA plugs) ==
{{outdated}}
Extensions go in ''/home/nurdbot/.jsb/myplugs/socket''. In theory you could load a plugin with:
Extensions go in ''/home/nurdbot/.jsb/myplugs/socket''. In theory you could load a plugin with:


Line 9: Line 10:


== Reloading the bot ==
== Reloading the bot ==
 
{{outdated}}
* kill process starting with "python2.7 ./bin/jsb-irc"
* kill process starting with "python2.7 ./bin/jsb-irc"
* as user nurdbot, run the following
* as user nurdbot, run the following
Line 25: Line 26:
* !label - Prints labels with free text @ [[Labelprinter]] @ [[SlabPi]]
* !label - Prints labels with free text @ [[Labelprinter]] @ [[SlabPi]]
* !janee - response in the affirmative or negatory sense to inquiries
* !janee - response in the affirmative or negatory sense to inquiries
* !mpdtube - Sends search query or url to [[MPDTube]]
* !ot - shows OpenTherm data from [[Jarvis|Home assistant]]
* !ot-set - Updates OpenTherm thermostat setpoint through [[Jarvis|Home assistant]]
* !sensors - Queries sensors from [[Jarvis|Home assistant]]
* !speak / !spreek / !dire / !sprech / !habla - Text to speach using espeak on [[SlabPi]] (different languages yay \o/)
* !statustoggle - (temp) manually switch the space from closed to open
* !statustoggle - (temp) manually switch the space from closed to open
* !sth temps and humidities of the different rooms
* !sth - temps and humidities of the different rooms
* !ticker sends text to [[Led ticker]]
* !toggle - toggles switches (Sonoff, epc, pdu) through [[Jarvis|Home assistant]]
* !toggle-list - shows a list of IDs that !toggle can use
* !wau-temp - Read the external temperature from the WUR sensors
* !wau-temp - Read the external temperature from the WUR sensors
* !wikipedia - customised from the basic version
* !wikipedia - customised from the basic version
* !who - Checks which known devices are connected to the Wifi (if you want to be on here, see [[Jarvis#Enable_tracking_for_your_MAC_address]])
* !wol - Performs wake-on-lan actions for machines in the space
* !wol - Performs wake-on-lan actions for machines in the space
* !power - Current power consumption
* !sensor - Read sensors from hass
== Bot replacement requirements ==
* Python 3 - to make it less of a pain to convert the plugins
* ACL/groups  - current ones are for example SPACE, USER, MPD, SPEAK
* Nickserv integration - so we don't need to track users ourselves, perhaps, optional
=== possible replacements ===
{{outdated}}
* [[GHBot]] (https://github.com/folkertvanheusden/ghbot)
* pyaib (https://github.com/facebookarchive/pyaib)
** pros
*** dynamic loadable plugins
*** simple code
*** nickserv tracking
** cons
*** some cry babies will complain that it was originally made by facebook
*** documentation is scarce
*** old and unmaintained
*** nobody uses it
** notes
*** python3


* ~power - Current power consumption (not [[Nurdbot]] but x0p actually)
* limnoria (https://github.com/ProgVal/Limnoria)
** pros
*** documented
*** maintained!
*** ACLs
** cons
*** plugins are hard to read (their code) << opinion by flok, somebody verify this.
** notes
*** python3


==WIP==
* kiki
* !speak - Text to speach using Festival on [[SlabPi]]
** pros
* !espeak / !espreek / !edire / !esprech - Text to speach using espeak on [[SlabPi]] (different languages yay \o/)
*** stable code
*** maintained
*** flexible database
*** plugin interface
*** lots of functionality
** cons
*** horrible code (organically grown)
*** java
** notes
*** java code

Latest revision as of 14:07, 26 September 2023

nurdbot is the bot in our IRC channel. It used to be based on the fantastic jsonbot by Bart Thate, but has been replaced: see GHBot and Harkbot.

Writing custom commands (AKA plugs)

Outdated IMPORTANT: The content of this section is outdated. Please update this section if you can. If you have checked or updated this section and found the content to be suitable, please remove this notice.

Extensions go in /home/nurdbot/.jsb/myplugs/socket. In theory you could load a plugin with:

!plug-enable <plugin name>

In practice it turns out you have to kill the bot, start it again (see below how) and then do the !plug-enable.

Reloading the bot

Outdated IMPORTANT: The content of this section is outdated. Please update this section if you can. If you have checked or updated this section and found the content to be suitable, please remove this notice.
  • kill process starting with "python2.7 ./bin/jsb-irc"
  • as user nurdbot, run the following

screen ~/jsonbot/botstart.sh

  • restarting the mqtt connection (for eg the temperature sensors):
    • kill and restart: /usr/bin/screen -d -m -S 'mqtt-to-sqlite3' /home/nurdbot/mqtt-to-sqlite3.py‎


Our custom commands

  • !badum - for terrible jokes
  • !bclabel - Prints Bookcrossing labels @ Labelprinter @ SlabPi
  • !fluoro - controls the fluorescent lights
  • !label - Prints labels with free text @ Labelprinter @ SlabPi
  • !janee - response in the affirmative or negatory sense to inquiries
  • !mpdtube - Sends search query or url to MPDTube
  • !ot - shows OpenTherm data from Home assistant
  • !ot-set - Updates OpenTherm thermostat setpoint through Home assistant
  • !sensors - Queries sensors from Home assistant
  • !speak / !spreek / !dire / !sprech / !habla - Text to speach using espeak on SlabPi (different languages yay \o/)
  • !statustoggle - (temp) manually switch the space from closed to open
  • !sth - temps and humidities of the different rooms
  • !ticker sends text to Led ticker
  • !toggle - toggles switches (Sonoff, epc, pdu) through Home assistant
  • !toggle-list - shows a list of IDs that !toggle can use
  • !wau-temp - Read the external temperature from the WUR sensors
  • !wikipedia - customised from the basic version
  • !who - Checks which known devices are connected to the Wifi (if you want to be on here, see Jarvis#Enable_tracking_for_your_MAC_address)
  • !wol - Performs wake-on-lan actions for machines in the space
  • !power - Current power consumption
  • !sensor - Read sensors from hass

Bot replacement requirements

  • Python 3 - to make it less of a pain to convert the plugins
  • ACL/groups - current ones are for example SPACE, USER, MPD, SPEAK
  • Nickserv integration - so we don't need to track users ourselves, perhaps, optional

possible replacements

Outdated IMPORTANT: The content of this section is outdated. Please update this section if you can. If you have checked or updated this section and found the content to be suitable, please remove this notice.
  • pyaib (https://github.com/facebookarchive/pyaib)
    • pros
      • dynamic loadable plugins
      • simple code
      • nickserv tracking
    • cons
      • some cry babies will complain that it was originally made by facebook
      • documentation is scarce
      • old and unmaintained
      • nobody uses it
    • notes
      • python3
  • limnoria (https://github.com/ProgVal/Limnoria)
    • pros
      • documented
      • maintained!
      • ACLs
    • cons
      • plugins are hard to read (their code) << opinion by flok, somebody verify this.
    • notes
      • python3
  • kiki
    • pros
      • stable code
      • maintained
      • flexible database
      • plugin interface
      • lots of functionality
    • cons
      • horrible code (organically grown)
      • java
    • notes
      • java code