Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/techgaun/ex_mustang

:sparkles: A simple, clueless bot
https://github.com/techgaun/ex_mustang

bot elixir hacktoberfest responder slack slack-bot standup-reminder uptime-check uptime-monitoring

Last synced: about 1 month ago
JSON representation

:sparkles: A simple, clueless bot

Awesome Lists containing this project

README

        

# ex_mustang

> A simple, clueless bot

![Mustang](images/mustang.jpg)

ExMustang is a bot for Slack written in Elixir. While ExMustang is written for Slack, the responder modules should work fine with other Hedwig adapters as well. If you like Mustang, please use [Mustang](images/mustang.jpg) as bot image if possible :)

_Warning: This is a work in progress._

![Example](images/example.png)

![Example](images/example2.png)

![Example](images/example3.png)

### Setup

Create a Slack bot user from [here](https://my.slack.com/services/new/bot). You will receive an API token you can use. Set the `SLACK_API_TOKEN` environment variable and you should be good to go.

You can run this bot as below:

```shell
export SLACK_API_TOKEN=""
mix run --no-halt
```

A sample runner configuration looks like below:

```shell
export SLACK_API_TOKEN=" - Displays all help commands that match .
gmap - Replies with the information from google places/maps.
pwned - Checks to see if an account has been breached or not
quote - Replies with a random quote.
slap - Slaps the user. Format: slap | me
time - get time in a given timezone
unix2iso - Converts given unix timestamp to ISO format (Auto-replies for values that look like timestamps)
b64encode - base64 encoding of given text content
b64decode - base64 decoding of given text content
isitup - checks if given domain is up or not
insult me| - insults given username with random insults
httpcat - get http status code cat for given value
howdoi - tries to find solution on the given query
commitmsg - get a random commit message
clifu [search_word] - get clifu gem (gives random clifu if no keyword is passed)
whois - gives whois query for given domain
gittip [keyword] - Get a random git tip for given keyword
happy birthday - Send happy birthday message to the user mentioned
hdeploy - Deploys configured branch to the given app
inviteall [src_channel] - invite all the members of source channel
giphy [search_term] - Tries to find a GIF matching search_term (gives random gif if no search_term is provided)
```

#### Heroku Deployment

For heroku deployment to work, you need to specify the following configurations:

- `HEROKU_GITHUB_TOKEN` or `GITHUB_TOKEN`
- `HEROKU_TOKEN` which is an API key you can get from [here](https://dashboard.heroku.com/account)
- mapping of apps in your config which is a tuple of heroku app name and map of repo and branch

An example config looks like below:

```elixir
config :ex_mustang, ExMustang.Responders.HerokuDeploy,
github_token: System.get_env("HEROKU_GITHUB_TOKEN") || System.get_env("GITHUB_TOKEN"),
token: System.get_env("HEROKU_TOKEN"),
apps: [
{"casa-core-stage", %{repo: "casaiq/core", branch: "master"}}
]
```

#### InviteAll Responder

The invite all responder requires you to provide a token of a non-bot and non-guest slack team member because thats how the slack api works. You can get your personal tokens from [HERE](https://api.slack.com/custom-integrations/legacy-tokens)

### Changelog

The detail changelog is available [HERE](CHANGELOG.md)

### About Mustang

Mustang (pronounced like `moostang` not like the `Ford Mustang`; I don't know phonetics) is my best friend whom I had to leave back in Nepal. After surviving [April 2015 Earthquake](https://en.wikipedia.org/wiki/April_2015_Nepal_earthquake), we lived together for a while and I had to leave him back in Nepal. Below is the pic post-earthquake.

![Mustang and Me](images/me_mustang.jpg)