A bot that provide an easier way to add or remove clusters from the database.
cluster is an object in the database that store channel property.
- yarn >=1.19.1
- node >=12.11.1
yarn
yarn start
yarn test
:fries: create cluster_name --flag
-
First, check cluster name existence in the database:
- If it already exists, notify user via direct message that a new record can't be added to the database.
- If it doesn't exist, check the flag after cluster name.
-
Different types of flag in the command:
- If
--vc
flag is presented in the command,isVC
property in the database will be true and vice versa. - If
--batch
flag is presented in the command,isBatch
property in the database will be true and vice versa.
- If
π create c4k --vc
=> {"name": 'c4k', "isVC": true, "isBatch": false, "members": [], "_id": '1'}
π create b-6 --batch
=> {"name": 'b-6', "isVC": false, "isBatch": true, "members": [], "_id": '1'}
π create b-6 β
π create b-6 --vc --batch β
NOTE:
- Only authorized users can use this command.
- A cluster must have either
--vc
or--batch
flag. It can't be both.
:fries: update cluster_name @userA @userB @userC
Check cluster name existence in the database:
- If it doesn't exist, notify user via direct message that record can't be updated in the database.
- If it exists, add members to the database with no duplicate of the old members.
π update b-6 @userA @userB @userC
=> {"name": 'b-6', "isVC": false, "isBatch": true, "members": [UQECTBTDX, UDECTATDM, UQEDTXTDM], "_id": '1'}
π update b-6 @here
{"name": 'b-6', "isVC": false, "isBatch": true, "members": [all_slack_users_id_in_current_channel], "_id": '1'}
NOTE: Only authorized users can use this command.
:fries: remove cluster_name @userA @userB @userC
Check cluster name existence in the database.
- If it doesn't already exist, notify user via direct message that record can't be removed in the database .
- If it exists, remove members that are mentioned in the command. If there's no members mentioned in the command, remove the entire cluster from database.
π remove b-6 @userA
=> {"name": 'b-6', "isVC": true, "isBatch": false, "members": [old_members_except_@userA_slack_id], "_id": '1'}
π remove b-6
=> remove b-6
cluster from database.
NOTE: Only authorized users can use this command.
:fries: mention cluster_name text
Check cluster name existence in the database.
- If it doesn't exist, notify user via direct message.
- If it exists, send text to each members in the cluster individually.
π mention b-6 "hello world"
=> send "hello world" as direct message to everyone in b-6
cluster.
:fries: invite cluster_name
Check cluster name existence in the database.
- If it doesn't exist, notify user via direct message about invalid cluster name.
- If it exists, invite all members in the cluster to current channel.
:fries: kick cluster_name
Check cluster name existence in the database.
- If it doesn't exist, notify user via direct message about invalid cluster name.
- If it exists, kick all members in the cluster to current channel.
:fries: list cluster_name
Check cluster name existence in the command.
- If there's no cluster_name, sent a direct message containing API link of all clusters.
- If cluster_name(s) is presented in the command, send a direct message containing only those clusters API link(s).
π€ code4kit
- Website: https://code4kit.slack.com/signup
- Github: @code4kit
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a βοΈ if this project helped you!
Copyright Β© 2019 code4kit.
This project is MIT licensed.