GithubHelp home page GithubHelp logo

matrix-admin-bot's Introduction

Matrix Admin bot uses matrix-bot-sdk

This bot helps to keep the matrix channels maintainable and implements functionality which runs bulk invite to the channels new users
Initial tool request Eng requirements doc

Running / Building

  1. Update your project's details in package.json.
  2. Run yarn install to get the dependencies.

To build it: yarn build.

To run it: yarn dev

To check the lint: yarn lint

To build the Docker image: docker build -t your-bot:latest .

To run the Docker image (after building): docker run --rm -it your-bot:latest

Configuration

$ cp .env.example .env

Project structure

src/bot.ts

This is where the bot's entry point is. Here you can see it reading the config, preparing the storage, and setting up other stuff that it'll use throughout its lifetime. Nothing in here should really require modification - most of the bot is elsewhere.

src/commands/handler.ts

When the bot receives a command (see bot.ts for handoff) it gets processed here. The command structure is fairly manual, but a basic help menu and processing for a single command is there.

src/commands/hello.ts

This is the bot's !adminbot hello command. It doesn't do much, but it is an example.

build/

This is where the project's build files go. Not really much to see here.

storage/

This is the default storage location. Also not much to see here.

Development process

Once you followed all steps above, and server is up and running

  • Create a private room for testing your bot from localhost (make sure to have Encryption DISABLED, otherwise bot won't be able to recognize commands)
  • Invite your bot to this room (invitations are auto-accepted)
  • Write command in channel with your bot, and have fun :)

matrix-admin-bot's People

Contributors

alvicsam avatar arminteimouri avatar arshamteymouri avatar ba1uev avatar dependabot[bot] avatar joao-paulo-parity avatar lazam avatar mordamax avatar mutantcornholio avatar oleg-plakida avatar piggydoughnut avatar rcny avatar sergejparity avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

matrix-admin-bot's Issues

Matrix: Augment user profile with Parity information

User profile: where they are, how they like working, response time, profile photo (cross platform), how to work with them, timezone, handles of Twitter and GitHub

Problem
When you open someone's profile in Element - often it's hard to connect the dots with github, bamboo and/or find the right person.

Solution
How exactly this should be done, needs to be investigated. But ideally that could be added in sidebar, which opens when you click on user image, as its own block, with the information loaded from BambooHR
image

Matrix: NudgeBot, remind about incomplete requests automatically

Problem:
New Employees have to-do lists of onboarding, or sometimes peopleops ask to provide some additional information during the contract. The way to do this - is DM directly and remind from time to time.
How could we improve peopleOps life to contract & remind employees automatically of remaining to-do items?

One of the solutions:

  • use bamboo hr as source of list of tasks
  • create schedule which will crawl the incomplete tasks and send a message in matrix

Tool needed: Support Engineer Matrix Bot Assistant

Describe your problem and idea for the tool

What you would like us to build? Which problem does it solve? What are the most important features this tool should have?

From Ricardo:

Related to bots, are you able to get the emoticons message reactions. I'm thinking on another thing we need, not important for now but will come handy later on.
The general idea is to create a new gihub issue in a private repo once a emoticon reaction happens on a specific message. As a way to filter and track good questions.
hhmm I was thinking on this for the Substrate technical channel. As a way to prevent creating a new ticketing platform but allowing Support engineers to spend less time answering the same question over and over.

My pseudo-psuedocode:

We could do something like...

as support_helper_matrix_bot:
if
[any person from list of approved matrix accounts] reacts with [specific emoji] to [post]; then
post as issue on github
post a link to the issue it created
fi

How do you solve this problem now?

What workarounds have you already tried? Do you have any docs describing these processes? Have you tried any opensource tools or found articles that could theoretically help us with that?

I'll let @riusricardo explain more here if needed. In the past, it was attempted to redirect people to StackOverflow to avoid repeating the same answers to the same questions over and over, but Github Discussions (or issues) is a better outlet.

Importance and impact

Between low and medium

Deadline

None

Scheduled Operations: Post a digest of unanswered StackExchange questions to Matrix

Describe your problem and idea for the tool

What you would like us to build? Which problem does it solve? What are the most important features this tool should have?

I would like to have a bot that posts unanswered Substrate StackExchange questions for specified tags to our core team channel in Matrix.

  • The questions should be posted as a digest to our core team channel.
  • Each question should contain the number of unanswered days as an info.
  • The digest should be posted every Monday 10 am CET.

This is the format I imagine:

Please just keep the number of days and don't shorten it to weeks. Please sort by longest unanswered on the top.

Those are the tags that should be watched: ink, smart-contract, pallet-contracts, substrate-contracts-node, cargo-contract, contracts.

The digest should be posted to https://matrix.to/#/!nqwrcufvSwqTNsLMkj:matrix.parity.io?via=matrix.parity.io&via=web3.foundation.

Talk to me (Matrix: @michi:matrix.parity.io) or @athei (Matrix: @alext:matrix.parity.io) if you need an admin to set up the bot in the channel.

How do you solve this problem now?

What workarounds have you already tried? Do you have any docs describing these processes? Have you tried any opensource tools or found articles that could theoretically help us with that?

There is no solution yet and asking people to go through unanswered questions by themselves hasn't been fruitful.

Importance and impact

  • Low. Would be nice to have it at some point in the future
  • Medium. Lack of this instrument really prevents some people from working effectively
  • High. If we don't make it by the deadline — we're doomed!

Deadline

Date, month or event reference to understand urgency.

31 June

Additional info

Any additional comments, links, inputs on what we need to know to understand your problem. You can mention other people here, so they can write their own inputs in comments. Remove this section if it's empty.

Tool needed: Matrix Admin - mass invite to parity channels during onboarding

Describe your problem and idea for the tool

A matrix "moderation" bot which ensures correct room permissions, manages user power levels, access control (ACLs), etc for internal rooms.

How do you solve this problem now?

The PeopleOps team manually invites users to rooms when onboarded; Arnold and I have the keys for the r00t account. There is no automation here.

Importance and impact

  • Low. Would be nice to have it at some point in the future
  • Medium. Lack of this instrument really prevents some people from working effectively
  • High. If we don't make it by the deadline — we're doomed!

Deadline

Date, month or event reference to understand urgency.

Additional info

There could be some more interesting things done regards to this, like having the bot have an internal concept of 'teams' and integrating paritytech/opstooling#13 per-team, or something like that. Lots of possibilities. We should maybe ask the general company (matrix users) to weigh in on this, as I'm sure there has been plenty of pain.

Tool needed: Matrix channel archiving bot

Tell us your story

Security team is proposing a new data deletion policy for our Matrix server. Matrix supports per-channel data deletion policies. Most of what happens on Matrix is ephemeral and should be deleted; some of it is important (for legal or other reasons) and should be archived.

What tools do we have available to archive Matrix threads that deserve archiving? Such a tool should be easy to use but not too easy to use, as we don't want to wind up with everything being archived unencrypted on people's laptops.

What tools have you already tried

There does not appear to be a lot of publicly-available information on archiving Matrix channels.

How bad is your pain?

  • Itching from time to time
  • Fairly intense. I would really like to solve it soon
  • It often blocks me for a long time :'(

Additional info

This is a low-medium priority issue that needs to be addressed at some point in Q2 or Q3. (The answer might be: there is no such tool, and the effort required to build one is too high; but then again, perhaps a good solution exists or can be built with minimum effort? Unknown.)

Matrix: make forum answers to fold into a thread

From original request:

Forum notifications in one channel and threading for posts
implemented here: https://github.com/discourse/discourse-chat-integration/blob/a73f5da114d6d7adfac53bdd58b7f45a4e3ac31a/lib/discourse_chat_integration/provider/matrix/matrix_provider.rb
Answer to forum posts from Matrix

Problem:
Currently forum posts every individual post or answer under it as separate message in matrix room, which is (i suppose, from request) hard to read.

Solution:
The idea is to leverage standard (yet beta) threads functionality of matrix. So when someone posts a new topic, it goes directly to matrix room, and when someone answers under topic - it automatically places answers in thread under topic message

Additionally someone suggested that would be nice to be able to answer to the forum topic from the matrix thread. So if you post a message in this thread from element client - it'd automatically reply from your account in forum. But this needs to be evaluated separately. (Do we really need it, what's the effort and caveats)

image

Matrix: Set Reminders

There were several separate (but similar) requests:

  • Set reminders
  • Bots reminding around unanswered or unread questions
  • Bot for important emails being received. Bot reminder with check list (todo list) with deadlines

Problem/Pain:
From the given requests, I can guess the main incentives are:

  • to delay some action for later (either read message, or reply someone in forum, etc). Was thinking about having some context menu (right mouse click) on message
  • to not forget to do something (like: set up a meeting with X, or send an 1). This could be custom - you ask bot to do X at Y time

Solution:
TBD

Existing similar tools:

Disabling and suspension of accounts feature

would be useful if the admin bot could help offboarding users.

common scenarios when offboarding: use admin/v1/deactivate/ for account deactivation (needed for sso and non-sso configurations.

sometimes accounts need to be suspended, then admin/v1/reset_password/ is used with random password and logout of devices (useful in non-sso scenarios -- log-out of devices would still be useful though with sso).

would also be useful to be able to check the deactivated status of a user, show logged in devices and set a password.

cc @dartamendi-parity

Matrix: Read later / Mark as unread

This is very popular request among matrix users, and IMO it must be a core matrix functionality, rather than custom implementation. Although, i saw issues on matrix repos - like matrix-org/matrix-spec#612 or matrix-org/synapse#5601, or element-hq/element-meta#347
... Since 2017 🤦

Question - how can we make it? Either help them or do a workaround or do something more "smart" 😄
No clear idea how to do this, but this is part of an issue - investigate and propose possible solutions, and implement

Matrix: scheduled announcements posts

Problem:
Sometimes Parity has some announcements which need to be posted at particular day on public channels

Solution
Best solution needs to be investigated, but here's main thoughts:

  • only allowed people should be able to request schedule a post
  • they should be able to provide a 1) text 2) time 3) channel
    • question: How will they do it? web interface? or 1:1 chat with bot, tbd

Send mass message with reminder to fill survey + personal link

from Helen:

For the Parity Health and Wellbeing Survey via Dear Employee, we would like to send people an invitation with their individual participation link over Element. While everyone has a personal link, we unfortunately can’t send the same message with a general link to everyone.
Could you help us send the message to everyone with their individual links? We have the info in a csv file, which I can share.

Matrix: Change display name (or status) to OOO when on vacation (from bamboo)

This could be a bot which talks to the user and reminds you on something like display-name or status.
Or automatic change accordingly to Bamboo OOO status

You can do it via the synapse admin API. You need the access_token of an admin account. Then you can do:

curl -X PUT --header 'Authorization: Bearer <access_token>' --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ "displayname": "[ooo] Mak" }' 'https://matrix.parity.io/_synapse/admin/v2/users/@maksym:matrix.parity.io' -i

Tool needed: Matrix notification from crates.io

Describe your problem and idea for the tool

From https://github.com/paritytech/devops/issues/192

It'd be nice to have a "crate published" notification in a Riot-channel whenever a crate owned by paritytech:core-devs gets updated.

How do you solve this problem now?

We don't :(

Who's going to use it?

Yes, quite usefull at least for security audit purposes.
Crates.io ACLs suck, basically anyone can publish anything; so we'd better to at least be aware when this happens.

So this would be at least for the security team, and @dvdplm from the other tooling team actually was the original requestor.

Importance

  • Would be nice to have it at some point in the future
  • Lack of this instrument really prevents some people from working effectively
  • If we don't make it by the deadline — we're doomed!

Deadline

None, the devops issue has been open for a long time already 😅

Additional info

Potentially could become a part of a multi-purpose Parity matrix bot our bot suite. We have a lot of general ideas for matrix bots but really don't have any current tooling that uses them effectively beyond general monitoring webhooks etc. I can highly recommend using the matrix-nio API as it supports e2ee, and the template is a great place to start: https://github.com/anoadragon453/nio-template

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.