Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #35

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
31 changes: 31 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/@typescript-eslint',
],
env: {
node: true,
},
rules: {
'prettier/prettier': [
'error',
{
trailingComma: 'es5',
singleQuote: true,
},
],
},
plugins: ['import', 'prettier', '@typescript-eslint'],
overrides: [
{
files: ['**/*.test.ts'],
env: {
jest: true,
},
},
],
};
69 changes: 65 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,66 @@
node_modules
# Taken from https://github.com/github/gitignore/blob/master/Node.gitignore

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# jest-junit
junit.xml

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.idea/
yarn-error.log
build/

# TypeScript compiled directory
dist
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ WORKDIR /opt/app
COPY . /opt/app

RUN npm i
RUN npm i -g forever

ENTRYPOINT sh /opt/app/app.sh
ENTRYPOINT npm start
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,30 @@
```
BLOCK_IO_API_KEY=XXXXXXXXX
BLOCK_IO_SECRET_PIN=XXXXXXX
SLACK_TOKEN=xoxb-.....
BOT_USER_ID=-----

BOT_USER_ID=XXXXXXX
BOT_DM_CHANNEL_ID=XXXXXXX
BOT_CHANNEL_MEMBER_ID=XXXXXXX

GENERAL_CHANNEL_ID=YOUR_GENERAL_CHANNEL

SLACK_ACCESS_TOKEN=xoxb-...
SLACK_SIGNING_SECRET=XXXXXXX

BOT_REACTION_EMOJI = 'cool-doge';

PORT=5000
```

### In public / private channels

- `tip <username> <amount>` - gives amount to specified user
- `tip <username1> <username2> <usernameN> <amount>` - gives amount to specified users
arifaydogmus marked this conversation as resolved.
Show resolved Hide resolved
- `rain <amount>` - Divides amount equally between participants (currently max. 5)
- `random <amount>` - Randomly awards one person the specified amount

### In `@cooldoge` private DM
### Slash commands

- `deposit` - return address
- `balance` - shows balance
- `withdraw <adress> <amount?>` - withdraws to address
- `/deposit` - return address
- `/balance` - shows balance
- `/withdraw` - withdraws to address (not implemented yet)
5 changes: 0 additions & 5 deletions app.sh

This file was deleted.

19 changes: 19 additions & 0 deletions bottender.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
arifaydogmus marked this conversation as resolved.
Show resolved Hide resolved
session: {
driver: 'memory',
stores: {
memory: {
maxSize: 500,
},
},
},
initialState: {},
channels: {
slack: {
enabled: true,
path: '/',
accessToken: process.env.SLACK_ACCESS_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET,
},
},
};
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/* eslint-disable import/no-unresolved */
module.exports = require('./dist').default;
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"private": true,
"repository": "https://github.com/cool-bots/doge-cool.git",
"scripts": {
"dev": "nodemon --watch src --ext ts,js --exec 'ts-node' src/index.ts",
"dev": "bottender dev",
"prettier": "prettier --write '**/*.{js,ts,tsx,json,md}'",
"precommit": "pretty-quick --staged",
"start": "sh app.sh"
"start": "bottender start"
},
"prettier": {
"singleQuote": true,
Expand All @@ -24,20 +24,20 @@
]
},
"dependencies": {
"block_io": "2.0.0",
"bottender": "0.14.34",
"dotenv": "6.2.0",
"lodash": "4.17.13",
"messaging-api-slack": "0.7.11",
"ngrok": "3.1.1"
"block_io": "2.0.3",
"bottender": "1.4.7"
},
"devDependencies": {
"@types/dotenv": "6.1.0",
"husky": "1.3.1",
"lint-staged": "8.0.3",
"nodemon": "1.18.9",
"prettier": "1.16.4",
"ts-node": "8.0.2",
"typescript": "3.3.1"
"@typescript-eslint/eslint-plugin": "3.4.0",
"@typescript-eslint/parser": "3.4.0",
"eslint": "7.3.1",
"eslint-config-prettier": "6.11.0",
"eslint-plugin-import": "2.22.0",
"eslint-plugin-prettier": "3.1.4",
"husky": "4.2.5",
"lint-staged": "10.2.11",
"prettier": "2.0.5",
"ts-node": "8.10.2",
"typescript": "3.9.4"
}
}
15 changes: 0 additions & 15 deletions src/commands/balance.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/commands/deposit.ts

This file was deleted.

17 changes: 0 additions & 17 deletions src/commands/index.ts

This file was deleted.

69 changes: 0 additions & 69 deletions src/commands/rain.ts

This file was deleted.

44 changes: 0 additions & 44 deletions src/commands/random.ts

This file was deleted.

Loading