Giter Site home page Giter Site logo

candebot's Introduction

Candebot

Go Report Card

634885518034_68b9e6615588d0cf48f6_512

Our lovely opinionated Slack bot. Find it in BcnEng Slack workspace as @candebot.

Features

  • Commands emulating a command line tool. Via Slack slash (/) or mentioning the bot. See /cmd. For example:
    • coc - Shows the Code of Conduct.
    • netiquette - Shows the Netiquette.
    • staff - Shows the list of staff members.
    • echo - Sending messages as the bot user. Only available to admins.
    • candebirthday - Days until @sdecandelario birthday! Something people cares.
  • Filter stopwords in messages. Suggest more inclusive alternatives to the user. See /inclusion.
  • Submission and validation of job posts. Posted in the #hiring-job-board channel via a form.
  • Message actions. For example:
    • Deleting a message and the whole thread. Only available to admins.
    • Report messages to the admins.

Configuration

Candebot can be configured via Toml file + environment variables. The need for setting up environment variables when using the Toml file is due to the fact that some of the configurations is sensitive and should not be stored in a file.

Environment variables

All environment variables are prefixed with BOT_. For example, BOT_BOT_USER_TOKEN. If you want to change the prefix, you can set -env-prefix <prefix> flag when running the bot.

The following environment variables are needed in order to run the bot:

  • BOT_BOT_USER_TOKEN - Slack bot user token. Used to authenticate the bot user.
  • BOT_BOT_ADMIN_TOKEN - Slack user token with admin rights. Used to authenticate the bot user when performing admin actions.
  • BOT_BOT_SERVER_SIGNING_SECRET - Slack app signing secret. Used to verify the authenticity of the requests.

There are more environment variables that can be set. Please, check /bot/config.go.

Toml File

By default, ./.bot.toml is used as the configuration file. If you want to change the path, you can set -config <filepath> flag when running the bot.

Please, use the following file as a reference.

Installation

go get -u github.com/bcneng/candebot

Usage

BOT_BOT_USER_TOKEN=<slack-bot-user-token> \
BOT_BOT_ADMIN_TOKEN=<slack-user-with-admin-rights-token> \ 
BOT_BOT_SERVER_SIGNING_SECRET=<slack-app-signing-secret> \

candebot

You can get your bot user token by creating a Slack app via https://api.slack.com/apps.

Deployment

There is no preference for deployment. You can deploy it in any way you want. For example, using Docker. The files required will always be:

  • Compiled binary of the bot.
  • .bot.toml file with the configuration.

candebot's People

Contributors

akira28 avatar alhuelamo avatar cristinaverdi avatar dependabot[bot] avatar fenech avatar gonzaloserrano avatar ignasi35 avatar pbartrina avatar renovate[bot] avatar rogerclotet avatar ronnylt avatar sdecandelario avatar smoya avatar snamor avatar urielsalis avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

candebot's Issues

Feature request: Anonymous messages

It would be nice to have an option to post anonymously for different channels like #hiring-discussions, even create a new #workplace-challenges channel. The idea is that people feel comfortable to express themselves without engaging their current or former coworkers.

**The idea came from another Slack channel.

[tests] Follow a table-driven test approach next time.

FYI, you can follow a table-driven test approach next time.

Example:

func TestValidate(t *testing.T) {
	tests := []struct {
		name           string
		val            string
		max            int
		min            int
		expectedErrors map[string]string
	}{
		{
			name: "fields for the salary are properly parsed",
			val:  "http://foo.com",
			max:  12,
			min:  10,
		},

		// more tests cases here
	}
	for _, test := range tests {
		t.Run(test.name, func(t *testing.T) {
			max, min, validateErrors := validateSubmission(test.val, test.max, test.min)
			if test.expectedErrors != nil {
				require.Empty(t, max)
				require.Empty(t, min)
				require.EqualValues(t, test.expectedErrors, validateErrors)
			} else {
				require.Equal(t, test.max, max)
				require.Equal(t, test.min, min)
			}
		})
	}
}

Originally posted by @smoya in #72 (comment)

Candebot won't create job post on iphone

I'm experiencing an issue where some input forms on Candebot "New Job Post" command void after filling some other inputs. It happens on my slack on iPhone.

Steps to Reproduce:

  • Fill the first two inputs "Role" and "Company"
  • Fill the rest inputs until "Link to the job spec"
  • Then "Role" and "Company" are voided.

Note: If you try to fill them again, it voids the "Link to the job spec" and vice versa.

It seems it works normally on desktop

Feature request: Toot pinned Slack messages

I came up with the following idea I find cool; to toot (Tweet in Mastodon) every pinned (maybe only by Staff) Slack message, including a link to that message.

Why? I think this will help us spread the important topics and discussions we daily have in our community, giving visibility to more people, and also creating attraction for others to join BcnEng.

Collect usage metrics

We can take profit of free New Relic tier and collect usage metrics, i.e. # Job offers posted.

Feature flag non-essential features

The candebot is too BcnEng-specific.

By adding a simple feature flag or two it could be stripped down of features that make it more generic (remove Candelario birthday, remote twtitter intergration or word-filtering, etc...).

This is related to #77

Extract hardcoded values as config

Recently a user raised their interest on reusing this bot on other slack channels (at least the job posting feature).

There are a few hardcoded values that are exclusive to BcnEng (URLs, list of forbidden words, etc...).

Proposal: add field to #hiring-job-board offers with contract type

Many offers, esp. remote offers are for "contractor/freelancer/autónomo/self-employed" positions, because foreign companies without a Spanish legal entity cannot offer regular employee contacts.

Personally, I find this non-ideal, because I'm only interested in regular employee positions, and it makes it very hard to spot them.

I would propose a simple field with "employee" and other options.

Allow add more info in job offer

Add a textarea, limited to 250(?) characters to add more information.

When the form is send, add in the thread of the same publication.

Add job field: part time, full time, 4 days, etc...

I don't know how to call it but it will be nice to have a field for part-time, full-time, 4 days, etc...

In Indeed for example, they call it: Job type and they have: Part-time, Full-time, Permanent, Temporary, Contract, Volunteer, Apprenticeship, Internship

In InfoJob they call it "Jornada Laboral" so maybe "Workday"?

Personally, I'm especially interested in the 4 days (or even less) part tbh.

Feature request: admins to have the ability to "close" a thread

Sometimes, threads can blow out or go out of control 🔥 . Slack doesn't have the future for not allowing more people to write in a thread but maybe Candebot could help by adding a new action on message threads where admins can set a thread as closed, so Candebot removes any new message posted in there from that time, adding a ephemeral message (only visible to the user) saying the thread is closed.

For this, we would need a DB to store the state.

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.