Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
f4c38a0
Adds Latest Fixes from sfreeman422/mocker (#1)
Jun 15, 2019
37c7f3e
Remove Try Catch from `muzzle-routes` (#2)
Jun 18, 2019
8af9204
Update issue templates
Jun 25, 2019
2097e37
Blocked any @ message and added some light tests (#9)
Jun 29, 2019
89d5c64
Feature/fix @channels (#10)
Jun 29, 2019
a59afb4
Feature/fix gif (#11)
Jun 29, 2019
780e3e3
Feature/retry deletion (#12)
Jun 29, 2019
52ea59e
Bug/fix gif blocking (#13)
Jun 29, 2019
a40362c
Refactor/muzzle (#14)
Jun 29, 2019
512bd1c
Added better logging (#15)
Jun 29, 2019
5ad6601
Removed id from response (#16)
Jun 29, 2019
7a6fd5c
Feature/increase muzzle when channel (#18)
Jun 30, 2019
2679537
Block all Bots from Muzzled Users (#19)
Jun 30, 2019
2bf4eff
Added fix for channel tags (#20)
Jul 2, 2019
5cfcd50
Added fix for containsTag import (#21)
Jul 2, 2019
f80f992
Feature/add data (#22)
Jul 5, 2019
411479f
Clean up code and comments (#24)
Jul 5, 2019
ca9c921
Convert to Singleton Service Architecture (#25)
Jul 7, 2019
35170ea
Improved Tests (#26)
Jul 7, 2019
39b5c99
Fixed vulnerable npm packages (#27)
Jul 13, 2019
8318cd9
Feature/report (#28)
Jul 15, 2019
6af0c6d
Feature/fix formatting (#29)
Jul 16, 2019
b5a068e
added support for clapper, related tests and validation in controller…
Jul 22, 2019
5ec4444
Feature/report service (#31)
Jul 22, 2019
d24804c
added clapController to index (#32)
Jul 22, 2019
04e573b
Add KDR Report (#34)
Jul 27, 2019
3e8b3a3
Feature/time based reporting (#35)
Aug 7, 2019
5612309
Feature/confessions (#36)
Aug 7, 2019
6dc8a05
Feature/the list (#37)
Aug 9, 2019
420673c
Remove daily report (#40)
Aug 10, 2019
cedc184
Fixed urban dictionary multi-word definitions (#41)
Aug 22, 2019
8b3166c
Feature/list enhancements (#42)
Aug 22, 2019
9295f57
Removed (#43)
Aug 22, 2019
56a3230
Feature/remove unintentional list counter (#44)
Aug 22, 2019
a032235
Converted weeks and months to only report on the previous week/month …
Aug 22, 2019
5f6fd55
Trailing30 (#46)
Aug 22, 2019
77de687
Added fix to avoid text.like.this from not being muzzled (#47)
Sep 23, 2019
8df7cc1
fixed bug in which adding a user to a channel increases tbeir muzzle …
Sep 25, 2019
bffa33a
Fixed a bug in which a user could get stats while they were muzzled (…
Oct 14, 2019
2eb5199
Fixed spelling in the success message (#50)
Oct 14, 2019
439b974
Cleaned up logging (#51)
Oct 14, 2019
94bb379
Feature/cli (#52)
Oct 24, 2019
25b6ec7
Fixed a bug in which KDR calculated for all time reports was using at…
sfreeman422 Oct 31, 2019
d0b0d3d
Backfire Feature (#54)
sfreeman422 Nov 27, 2019
add737f
Fixed undefined error and upped percentage to 5% per muzzle (#55)
sfreeman422 Dec 7, 2019
0a56788
Backfire alerts fire immediately now and users are aware of their bac…
sfreeman422 Dec 10, 2019
83eea34
Refactor Muzzle Service and Muzzle Persistence Service (#58)
sfreeman422 Dec 19, 2019
9e3ca56
Muzzle Spacing (#59)
sfreeman422 Dec 19, 2019
cb04b73
Added support for bolded text when sent through (#60)
sfreeman422 Dec 19, 2019
55fb8ba
Added support for refreshing the local cache of users when a new user…
sfreeman422 Jan 3, 2020
adcfd03
Add Counter (#62)
sfreeman422 Jan 5, 2020
0689f81
Added logging to monitor how long it takes an event to be responded t…
sfreeman422 Jan 5, 2020
56a6b3d
Added sensible time display for counter (#64)
sfreeman422 Jan 5, 2020
58a3303
Fix Expire Message and Other Counter Bugs (#65)
sfreeman422 Jan 5, 2020
dbf54a8
Fix an issue where a user is not muzzled for changing topic nor for u…
sfreeman422 Jan 7, 2020
5a3a253
Feature/add rep (#67)
sfreeman422 Jan 24, 2020
fe45693
Fixed handler for backfire and counter when someone changes channel t…
sfreeman422 Jan 29, 2020
ffef26a
Setup cicd (#69)
sfreeman422 Feb 1, 2020
650d23f
Rep Checking (#70)
sfreeman422 Feb 1, 2020
c13fdf9
Fixed typo (#71)
sfreeman422 Feb 1, 2020
9bada7b
Add Per User Rep (#72)
sfreeman422 Feb 6, 2020
7153780
Chart first, rep last (#73)
sfreeman422 Feb 6, 2020
c76111a
Removed more than one word requirement and added an extra clap and up…
sfreeman422 Feb 19, 2020
e60f699
Feature/add walkie (#75)
sfreeman422 Mar 20, 2020
5c505f2
Feature/add better walkie (#76)
sfreeman422 Mar 21, 2020
4ff822b
Fixed callsign (#77)
sfreeman422 Mar 21, 2020
01a1666
Changed neals callsign fr
Mar 21, 2020
c42b6f7
Changed milau
Mar 21, 2020
ca45e5a
Added fix for non-existent callsigns
Mar 21, 2020
f465b59
Added support for missing nato call signs
Mar 21, 2020
f637e48
Added random chance of coughing (#78)
sfreeman422 Mar 22, 2020
7e0879d
removed bold
Mar 22, 2020
d7d4991
Removed capitalize first letter for definition
Mar 27, 2020
17cc46a
Fix/define (#79)
sfreeman422 Mar 27, 2020
fd56844
Added optional capitalization
Mar 27, 2020
df85ce8
added trim to clapper (#80)
sfreeman422 Apr 14, 2020
b1dabb4
Fix/use eslint (#82)
sfreeman422 Apr 30, 2020
77937ab
Added oof (#83)
sfreeman422 May 11, 2020
8734073
Add DockerFile (#81)
sfreeman422 May 18, 2020
a833d43
Fixed nato names
sfreeman422 May 22, 2020
7cc4d44
removed unnecessary log
sfreeman422 May 22, 2020
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
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
npm-debug.log
15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
},

extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],

rules: {},
};
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules
/dist
/dist
/src/ormconfig.ts
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
semi: true,
trailingComma: "all",
singleQuote: true,
printWidth: 120,
tabWidth: 2
};
197 changes: 197 additions & 0 deletions DB_SEED.sql

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:12

WORKDIR /usr/src/mocker
COPY package.json .
RUN npm install --only=prod
COPY . .
RUN npm run build:prod
EXPOSE 3000

CMD ["node", "./dist/index.js"]
74 changes: 69 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,72 @@

## Getting Started

1. Clone down repository and `npm install`.
2. Create a new Slack app, copy your bot token and add it to your environment variables as `muzzleBotToken`.
3. Setup `/muzzle` as a slash command as a part of your new slack app.
4. Create `/mock` and `/define` as additional slack commands and route them to your server.
5. Start making fun of your friends!
### Setting Up Your Slack Environment

1. Set up a new slack workspace for development purposes. (https://slack.com/get-started#/create)
2. Go to: https://api.slack.com/apps and click Create New App
3. Choose your newly created workspace as your Development Workspace and click Create App.
4. Configure Ngrok for your newly created bot: https://api.slack.com/tutorials/tunneling-with-ngrok
5. Add your bot oauth token as MUZZLE_BOT_TOKEN and your bot user token as MUZZLE_BOT_USER_TOKEN to your environment variables. Alternatively, you can pass these in as command line arguments.
6. Your app should have the following features per the Slack management web app:

- Slash Commands
- /mock - Request URL: `<ngrokUrl>/mock`
- /define - Request URL: `<ngrokUrl>/define`
- /muzzle - Request URL: `<ngrokUrl>/muzzle`
- /muzzlestats - Request URL: `<ngrokUrl>/muzzle/stats`
- /confess - Request URL: `<ngrokUrl>/confess`
- /list - Request URL: `<ngrokUrl>/list/add`
- /listreport - Request URL: `<ngrokUrl>/list/retrieve`
- /listremove - Request URL: `<ngrokUrl>/list/remove`
- /counter - Request URL: `<ngrokUrl>/counter`
- /repstats - Request URL: `<ngrokUrl>/rep/get`
- /walkie - Request URL: `<ngrokUrl>/walkie`

Each of the slash commands should have `Escape Channels, users and links sent to your app` checked.

- Event Subscriptions

- Request URL: `<ngrokUrl>/muzzle/handle`
- Subscribe to Workspace Events:
- messages.channels
- reaction_added
- reaction_removed
- team_join

- Permissions
- admin
- channels:history
- chat:write:bot
- chat:write:user
- commands
- files:write:user
- groups:history
- reactions:read
- users.profile:read
- users:read

### Setting Up Your MYSQL Instance

1. Be sure to have mysql installed and configured.
2. Create a database called `mockerdbdev`.
3. `mysql -u <user> -p < DB_SEED.sql`
4. You should now have a fully seeded database.

### Running Locally

1. `npm install`
2. Add the following environment variables for typeORM:

```
TYPEORM_CONNECTION: mysql,
TYPEORM_HOST: localhost,
TYPEORM_PORT: 3306,
TYPEORM_USERNAME: <USER-NAME-FOR-MYSQL>,
TYPEORM_PASSWORD: <PASSWORD-FOR-MYSQL>,
TYPEORM_DATABASE: mockerdbdev,
TYPEORM_ENTITIES: /absolute/path/to/mocker/src/shared/db/models/*.ts,
TYPEORM_SYNCHRONIZE: true
```

3. `npm run start`
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
modulePathIgnorePatterns: ["/dist"]
};
32 changes: 32 additions & 0 deletions mocker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mocker-full-suite
namespace: default
spec:
replicas: 1
selector:
matchLabels:
mocker: web
template:
metadata:
labels:
mocker: web
spec:
containers:
- name: mocker
image: mocker:latest
---
apiVersion: v1
kind: Service
metadata:
name: mocker-entrypoint
namespace: default
spec:
type: NodePort
selector:
mocker: web
ports:
- port: 8080
targetPort: 8080
nodePort: 30000
Loading