Code Monkey home page Code Monkey logo

nextcloud-talk-bot-jitsi's Introduction

Nextcloud Talk Jitsi Bot

A bot for Nextcloud Talk that creates Jitsi meetings.

Overview

This chatbot integrates with a Jitsi Meet instance to create password protected meetings in response to a keyword such as #videochat from Nextcloud Talk. It is a client for nctalkproxyd, which in turn is a part of the Nextcloud Talk Bot Framework.

Installation

A Docker image is available at Docker Hub.

Usage

As a prerequisite, the bot requires an instance of nctalkproxyd to work, which in turn requires a bot account in Nextcloud. Please adjust the following commands, which will start both nctalkproxyd and the nctalkbot-jitsibot, with the correct information - you can even use your own custom bot commands by changing NCTALKBOT_BOT_COMMANDS.

% docker volume create nctalkproxyd
% docker network create nctalkbots
% docker run \
	-p 1969:1969 \
	-v nctalkproxyd:/var/lib/nctalkproxyd \
	-v nctalkproxyd:/var/lib/nctalkproxyd \
	-e NCTALKPROXYD_DBPATH=/var/lib/nctalkproxyd \
	-e NCTALKPROXYD_USERNAME=botusername \
	-e NCTALKPROXYD_PASSWORD=botpassword \
	-e NCTALKPROXYD_ADDRREMOTE=https://mynextcloud.com \
	--network nctalkbots \
	--name nctalkproxyd \
	-d pojntfx/nctalkproxyd
% docker run \
	-e NCTALKBOT_BOT_NAME=botusername \
	-e NCTALKBOT_COMMANDS=\#videochat,\#videocall,\#custom \
	-e NCTALKBOT_SLEEP_TIME=20 \
	-e NCTALKBOT_JITSI_ADDR=meet.jit.si \
	-e NCTALKBOT_JITSI_ROOM_PASSWORD_BYTE_LENGTH=1 \
	-e NCTALKBOT_NCTALKPROXYD_ADDR=localhost:1969 \
	--network nctalkbots \
	-d pojntfx/nctalkbot-jitsi

License

Nextcloud Talk Jitsi Bot (c) 2020 Felicitas Pojtinger

SPDX-License-Identifier: AGPL-3.0

nextcloud-talk-bot-jitsi's People

Contributors

pojntfx avatar rzerres avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nextcloud-talk-bot-jitsi's Issues

Failure building (docker-compose) `bad download` for `node-pre-gyp`

I am trying to build a docker container and getting the following error:

Step 4/8 : RUN apt install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget protobuf-compiler
 ---> Using cache
 ---> a90ef6ab67d1
Step 5/8 : COPY . .
 ---> Using cache
 ---> 95d8cac56829
Step 6/8 : RUN npm ci
 ---> Running in c0d2381fbb9c

> [email protected] install /app/node_modules/grpc-tools
> node-pre-gyp install

node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp ERR! install error
node-pre-gyp ERR! stack Error: bad download
node-pre-gyp ERR! stack     at Unpack.afterTarball (/app/node_modules/grpc-tools/node_modules/node-pre-gyp/lib/install.js:100:46)
node-pre-gyp ERR! stack     at Unpack.emit (events.js:315:20)
node-pre-gyp ERR! stack     at Unpack.[maybeClose] (/app/node_modules/grpc-tools/node_modules/tar/lib/unpack.js:171:12)
node-pre-gyp ERR! stack     at Unpack.[unpend] (/app/node_modules/grpc-tools/node_modules/tar/lib/unpack.js:394:21)
node-pre-gyp ERR! stack     at /app/node_modules/grpc-tools/node_modules/tar/lib/unpack.js:308:46
node-pre-gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:163:23)
node-pre-gyp ERR! System Linux 4.19.24-20.container
node-pre-gyp ERR! command "/usr/local/bin/node" "/app/node_modules/grpc-tools/node_modules/.bin/node-pre-gyp" "install"
node-pre-gyp ERR! cwd /app/node_modules/grpc-tools
node-pre-gyp ERR! node -v v14.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
bad download
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-04-25T04_25_19_745Z-debug.log
ERROR: Service 'nxtalkchatbots' failed to build: The command '/bin/sh -c npm ci' returned a non-zero code: 1

I am building from a freshly updated git clone of this repo. My docker-compose file is as follows (some details changed for security).

version: '3'

services:

     nxtalkproxyd:
        restart: always
        build:
            context: ../nextcloud-talk-bot-framework/
            dockerfile: Dockerfile
        container_name: nxtalkproxyd
        expose:
            - "1969"
        volumes:
            - nxtalkproxyd:/var/lib/nxtalkproxyd
        environment:
            NXTALKPROXYD_NXTALKPROXYD_DBPATH: "/var/lib/nxtalkproxyd"
            NXTALKPROXYD_NXTALKPROXYD_USERNAME: "jitsybot"
            NXTALKPROXYD_NXTALKPROXYD_PASSWORD: "PASSWORD"
            NXTALKPROXYD_NXTALKPROXYD_RADDR: "https://nextcloud.server.net"
        networks:
            docker2:
              ipv4_address: ${IP_nxtalkproxyd}

     nxtalkchatbots:
        container_name: nxtalkchatbots
        build:
            context: ../nextcloud-talk-bot-jitsi/
            dockerfile: Dockerfile
        restart: always
        environment:
            BOT_JITSI_ADDR: "jitsi.server.net"
            BOT_JITSI_BOT_NAME: "jitsibot"
            BOT_JITSI_SLEEP_TIME: 20
            BOT_NXTALKPROXYD_ADDR: "nxtalkproxyd:1969"
            BOT_JITSI_ROOM_PASSWORD_BYTE_LENGTH: 1
            BOT_COMMANDS: "#videochat,#videocall,#custom"
        networks:
            docker2:
              ipv4_address: ${IP_nxtalkchatbots}

# network
networks:
  docker2:
    external:
      name: docker2

volumes:
    nxtalkproxyd:
      driver: local
      driver_opts:
        type: 'none'
        device: '${PWD}/volumes/nxtalkproxyd'
        o: 'bind'

building from the image works, but I'd like to keep up to date with changes so am building from the Dockerfile. My setup is a little unusual as I use kata-containers, but I don't think that's the cause of the build error.

nctalkchatbots TypeError: chat.getActordisplayname is not a function

On a Nextcloud (docker) 19.0.3 with Talk App. 9.04 nctalkchatbot is not working and crashes on any message in the chat . The error is the following:

nctalkchatbots | (node:19) UnhandledPromiseRejectionWarning: TypeError: chat.getActordisplayname is not a function
nctalkchatbots | at /app/main.js:232:38
nctalkchatbots | at ClientReadableStreamImpl. (/app/src/nextcloudTalkBot.js:22:45)
nctalkchatbots | at ClientReadableStreamImpl.emit (events.js:314:20)
nctalkchatbots | at addChunk (_stream_readable.js:307:12)
nctalkchatbots | at readableAddChunk (_stream_readable.js:282:9)
nctalkchatbots | at ClientReadableStreamImpl.Readable.push (_stream_readable.js:221:10)
nctalkchatbots | at Object.onReceiveMessage (/app/node_modules/@grpc/grpc-js/build/src/client.js:317:28)
nctalkchatbots | at Object.onReceiveMessage (/app/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:287:182)
nctalkchatbots | at /app/node_modules/@grpc/grpc-js/build/src/call-stream.js:164:74
nctalkchatbots | at processTicksAndRejections (internal/process/task_queues.js:75:11)
nctalkchatbots | (node:19) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)

nctalkproxyd seems to work fine. It joins the chat rooms, read the messages and report to client

{"level":"info","timestamp":"2020-09-18T16:34:47Z","message":"starting server"},
{"level":"info","status":"joined room "admin" ("admin") with ID "9" and token "5wez9a79"","timestamp":"2020-09-18T16:34:51Z","message":"received Nextcloud client status"},
{"level":"info","status":"joined room "Talk updates โœ…" ("jitsibot") with ID "14" and token "gd5qgjzr"","timestamp":"2020-09-18T16:34:51Z","message":"received Nextcloud client status"},
{"level":"info","status":"joined room "mytest4444" ("mytest4444") with ID "16" and token "ib5k2mfe"","timestamp":"2020-09-18T16:34:51Z","message":"received Nextcloud client status"},
{"level":"info","timestamp":"2020-09-18T16:34:51Z","message":"new client connected to service"},
{"level":"info","chat":{"id":212,"token":"ib5k2mfe","actorType":"users","actorId":"gargale","actorDisplayName":"Enrico Gargale","isReplyable":true,"message":"Prova di messaggio","messageParamertes":""},"timestamp":"2020-09-18T16:41:07Z","message":"writing chat from Nextcloud Talk to clients"},
{"level":"info","chat":{"id":213,"token":"ib5k2mfe","actorType":"users","actorId":"gargale","actorDisplayName":"Enrico Gargale","isReplyable":true,"message":"#meeting","messageParamertes":""},"timestamp":"2020-09-18T16:41:47Z","message":"writing chat from Nextcloud Talk to clients"},
{"level":"info","chat":{"id":214,"token":"ib5k2mfe","actorType":"users","actorId":"gargale","actorDisplayName":"Enrico Gargale","isReplyable":true,"message":"#chat","messageParamertes":""},"timestamp":"2020-09-18T16:42:25Z","message":"writing chat from Nextcloud Talk to clients"},

Below the docker-compose.yml for the services:

version: '3'
services:
    nctalkproxyd:
        image: pojntfx/nctalkproxyd
        container_name: nctalkproxyd
        restart: unless-stopped
        ports:
            - "1969:1969"
        volumes:
            - nctalkproxyd:/var/lib/nctalkproxyd
        environment:
            NCTALKPROXYD_DBPATH: "/var/lib/nctalkproxyd"
            NCTALKPROXYD_USERNAME: "jitsibot"
            NCTALKPROXYD_PASSWORD: "PASSWORD"
            NCTALKPROXYD_RADDR: "https://NEXTCLOUD.EXAMPLE.COM"
            NCTALKPROXYD_ADDRREMOTE: "https://NEXTCLOUD.EXAMPLE.COM"
        networks:
            - nctalkbots
    nctalkchatbots:
        container_name: nctalkchatbots
        restart: unless-stopped
        image: pojntfx/nextcloud-talk-bot-jitsi
        environment:
            NCTALKBOT_BOT_NAME: "jitsibot"
        networks:
            - nctalkbots
networks:ts 
    nctalkbots:
        external: true
volumes:
    nctalkproxyd:
        driver: local

Unsuccessful attempts for resolving the problem:

  • Downgrade Nextcloud to ver. 18 latest
  • Build the docker containers instead of using the docker hub images

Any hint would be appreciated. And thanks for the code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.