Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yusukebe/karma-bot
Slack Bot with Cloudflare Workers. It’s about Karma.
https://github.com/yusukebe/karma-bot
bot cloudflare cloudflare-workers slack slack-bot
Last synced: 12 days ago
JSON representation
Slack Bot with Cloudflare Workers. It’s about Karma.
- Host: GitHub
- URL: https://github.com/yusukebe/karma-bot
- Owner: yusukebe
- Created: 2021-10-15T00:16:41.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-09-24T22:31:13.000Z (over 2 years ago)
- Last Synced: 2025-01-08T17:09:06.560Z (15 days ago)
- Topics: bot, cloudflare, cloudflare-workers, slack, slack-bot
- Language: TypeScript
- Homepage:
- Size: 321 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# karma-bot
Slack Bot on Cloudflare Workers. Its' about Karma.
## Description
It's a Slack Bot for slash command. You can increment or decrement a name such as name of Slack chennel member or product name or your lover.
Input:
```
/karma cloudflare++
```![Slack screenshot](docs/slack-001.png)
Output:
```
cloudflare : 1
```![Slack screenshot](docs/slack-002.png)
This application works on Cloudlare Workers. Values of Karma are stored in Cloudflare Workers KV.
You can deploy your own Cloudflare Workers project.## Requirements
* Node.js
* wrangler## Deployment
### With Deploy button
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/yusukebe/karma-bot)
Set environment variables on Cloudflare Workers web page.
![Cloudflare screenshot](docs/cloudflare-001.png)
### With wrangler
Git clone. Copy wrangler setting file.
```
$ git clone [email protected]:yusukebe/karma-bot.git
$ cd karma-bot
$ cp wrangler.exampl.toml wrangler.toml
```Make namespace of Workers KV.
```
$ wrangler kv:namespace create "KV_KARMA"
$ wrangler kv:namespace create "KV_KARMA" --preview
```Then, set `id` in `wrangler.toml`.
```
kv_namespaces = [
{binding = "KV_KARMA", id = "your-id", preview_id = "your-preview-id "},
]
```Set a Slack Verification Token.
```
$ wrangler secret put SLACK_TOKEN
```Publish to your Workers.
```
$ wrangler publish
```Finally set your Workers URL `https://karma-bot.username.workers.dev` as Slack webhook URL.
By default, `/karma` command is working only you.
If you want to use `/karma` command for everyone on yor Slack channel, set `RESPONSE_TYPE` env var.
Edit `wrangler.toml`.```
RESPONSE_TYPE = 'in_channel'
```## License
MIT
## Author
Yusuke Wada