Skip to content

Conversation

@sfreeman422
Copy link
Owner

No description provided.

Steven Freeman added 30 commits June 15, 2019 17:44
* Remove Spam From Muzzled Users (#5)

* Removed unnecessary console log

* Converted muzzled array to a Map and added a muzzlers Map to track requestors. Added corresponding tests

* Added error strings to tests

* Removed isMuzzled references in favor of muzzled.has

* Removed unnecessary types

* Added a 10 message limit to muzzled users

* Adjusted linting options in package.json

* Added precommit linting for tests also

* Changed MAX_SUPPRESIONS to 7

* Bumps Axios to 0.18.1 (#6)

* Bumps axios to avoid security vulnerabilities

* adjusted package-lock.json

* Added muzzle cooldown and tests (#7)

* Max Muzzles Per Hour (#8)

* Added max muzzles per hour feature

* Converted to window.setTimeout and window.clearTimeout

* Added proper types to take advantage of NodeJS.Timeout

* Added tests for removeMuzzler

* Feature/max muzzles per hour (#9)

* Converted to window.setTimeout and window.clearTimeout

* Added proper types to take advantage of NodeJS.Timeout

* Fixed muzzle max issue

* Fixed a regression in defin in which no response was being sent (#10)

* Fix a bug with muzzle removal (#11)

* added timeout for muzzle removal

* Added timeout amount

* Added fix for removal function (#12)

* Added fit for removal function (#13)
* Removed try catach block for addUserToMuzzled

* Added lolex to successfully mock setTimeout in tests

* Added lolex cleanup

* Route cleanup

* Updated describe blocks to reflect reject rather than throw
* Added fix for @channels

* Added test for @channel fix
* Added ability to block bot_message from muzzled users. Also moved code from route to utils re: sendMessage and deleteMessage

* Changed to reference the proper authed_users

* Fixed log

* Adjusted logging

* Added comments and moved WebClient initialization into muzzle-utils

* Fixed an issue in which muzzles were getting delted while a person was muzzled

* Added comments
* Added 30 second retry for deleted items

* Adjusted timeout

* Added error handling that ignores when a message is not found

* Adjusted retry time to 5 seconds
* Added better userId and userName retrieval as well as ability to block gif

* Removed unnecessary export added logging

* Added proper resp.members

* Added support for other bots and better logging

* Adjusted tests. Still failing due to a lack of proper mock. TODO

* Added test function to slack-utils and fixed up tests
* Refactored muzzle-route and muzzle-utils

* Changed muzzlers map to requestors for better clarity

* Added support for @here
* Added removalFn as a property to muzzled users to allow tracking and moved setMuzzlerCount outside of muzzleUser

* Adjusted timeout

* Added containsAt and addMuzzleTime functions

* Exported ABUSE_PENALTY_TIME

* Adjusted getRemainingTime function

* Added addMuzzleTime interaction with muzzled map

* Added a setTimout to alerting channel about user tags

* Adjusted wording of alert

* Added siren emoji

* Adjusted shortcircuit on shouldBotMessageBeMuzzled

* Added logging on addMuzzleTime

* Adjusted getUserId

* Fixed getRemainingTime to return ms not s

* Added logging for getRemainingTime

* Added 1000x multiplier on process.uptime() for ms

* Removed logging for getRemainingTime and changed emoji to rotating_light
* Added better handling of userId inside of shouldBotMessageBeMuzzled

* Added ternary for userIdByAttachment

* Added logging

* Added some pretty terrible logic to shouldBotMessageBeMuzzled as PoC

* Changed userId to any termporarily

* Added better check on attachments

* Added logging to handle route

* More maddening logic for handling spoilers

* Added callback ID logging

* Adjusted logic for userIdByCallbackId

* Adjusted index for callback id

* Removed excessive logging and moved spoiler logic out
* Added typeorm, mysql driver, and tsconfig options to make use of typeorm

* Renamed server.ts to index.ts and adjusted package.json

* Added User and Muzzle models

* Added relationship information to to USer and Muzzle classes

* Added some base functions for interaction with mysql db via typeorm

* Added logging

* logged results

* Changed addUserToMuzzled to be async

* Added resolve/reject to inner then of addMuzzleTransaction

* Adjusted addMuzzleToTransaction call in muzzle-utils

* Reverted to try/catch

* Changed date type to play nice with mysql datetime

* Added date property on insert

* Removed User since it is not necessary

* Added log on db insert

* Changed a failed DB add to resolve with a warning rather than reject

* Added default date value and changed time to muzzleLengthMs

* Changed to milliseconds

* Added createdAt and updatedAt fields

* Added suppression counters to the db

* Added id to updateSuppressions as well as logging

* Separated updateSuppressions into two separate increment functions

* Removed old updateSuppressions import

* Added tracking for deleted messages after a user reaches their max muzzles

* Added support for incrementing muzzletime

* Adjusted order of operations on containsTag

* Added logging to containsTag

* Changed contains tag to check an entire sentence not just a single word

* Changed verbiage and handling of tags while muzzled to delete messages and not muzzle

* Changed the muzzle to fail on issues with DB

* Removed get functions from muzzle-actions. These will be addressed independent of saving data

* Removed async on sendMuzzledMessage since it is no longer necessary

* Converted from ormconfig.json to ormconfig.ts, added logging and updated gitignore

* Converted from transactionId to muzzleId

* Removed try catch in favor of catch

* Replaced addMuzzleTransaction with addMuzzleToDb

* Better naming

* Added change to make addMuzzleTime more generic
* Changed define route to avoid unnecessarily calling the API if a user is muzzled

* Added comments to muzzle-utils, renamed removeMuzzler to removeRequestor and optimized trackDeletedMessage

* Moved some of the muzzle code out into a separate utilities file to make muzzle more readable

* Separated out muzzle-utilties and muzzle tests

* added additional testing to getTimeString

* Removed direct references to muzzled

* Adjusted comments
* Added testdouble as a dev-dependency

* Converted to use jest rather than mocha/chai for tests

* Moved jest and typescript to dev-dependencies

* Removed accidental save-dev dependency

* Converted muzzle-utils to muzzle service and created web-client-service

* Converted slack-utils to slack.service and slack.service.spec

* Converted to SlackService

* Completed conversion from utils to classes and renamed from utils -> services, and routes -> controllers

* Converted to singleton classes for all service

* Added more tests for slackService

* Added tests for defineService

* mock-utils -> mock.service and corresponding tests

* Added simple tests for WebService

* Moved db calls to muzzle persistence service

* Added mocks to muzzle.service.spec

* Removed lolex dependency
* Added more tests to muzzle.service

* Fixed empty block
* added stats route and mostMuzzledByInstances

* Added logging

* Adjusted getMostMuzzledByInstances()

* Consolidated getMostMuzzledByInstances

* Changes to getMostMuzzledByInstances

* Changes to getMostMuzzledByInstances

* Added orderBy

* Added descending count

* Added getMostMuzzledByWords

* Adjusted params in getMostMuzzledByWords

* Adjusted params in getMostMuzzledByWords

* Summed the wordsSuppressed field

* Summed the wordsSuppressed field

* Summed the wordsSuppressed field

* Summed the wordsSuppressed field

* Removed groupBy for wordsSuppressed

* Added getMostMuzzledByChars

* Added getMostMuzzledByTime

* Added getMostMuzzledByMessages

* Added muzzler request data

* Fixed typo

* Fixed naming

* Added prelim kdr implementation

* Adjustment to KDR

* Changes to KDR

* Changes to KDR

* Changes to KDR

* Changes to KDR

* Changes to KDR

* Changes to KDR

* Changes to KDR

* Changes to KDR

* Fixed invalid sql statements

* Added await

* Consolidated kill and deaths to kdr

* Adjusted divison

* Adjusted divison

* Fixed typo

* Fixed typo

* Adjusted getKdr to perform count division on one line

* added casting to decimal

* Casted only the divisor

* Casted only the divisor

* Removed unnecessary async await

* Testing diff decimal

* Testing result of select call

* Testing result of select call

* Testing result of select call

* Testing total count

* Converted to using SUM

* Added kills and deaths to KDR key

* Added case statement

* Added if statement

* Changed null to 0

* Added nemesis

* Changed nemesis

* Changed groupBy for nemesis

* Changed groupBy for nemesis

* Changed groupBy to addOrderBy

* Removed addOrderBy

* Added naming for nemesis

* Added max count

* Changed groupBy

* Reverted max change

* Added limit

* Changed order of limit

* Changed order of limit again

* Swapped out typeOrm calls for custom mysql query

* Adjusted custom mysql query

* Reverting to typeorm methods

* Converting to a raw sql query

* Adjusted query and commented out the typeorm calls

* Added distinct

* Adjusted distinct

* Distinct changes

* Added custom sql query

* Added nemesis sql query

* Added name for count

* Added some mild formatting

* Added kdr and nemesis to report

* Forced controller to send back report:

* Removed table import

* Added tables

* Returning report

* Adjusted how we handle cli-table builds

* Fixed typo

* Fixed typo

* Removed TH headings

* Converted to post route

* Enabled slack message

* Converted to use easy-table instead

* Added backticks

* Added better formatting

* Adjusted SQL queries to be more easy to manage

* Backed out sql changes and did formatting in the code
* Fixed formatting

* Added type
* Removed unnecessary logging

* Converted to uploading a file rather than sending a message

* Removed unused import

* Removed filename attribute

* Added logging

* Added initial comment

* Added loging for body

* Passed in proper Id

* Added markdown formatting

* Added better formatting

* Removed formatting

* Formatting

* More formatting

* removed markdown formatting

* Added botuser token
* Separated out kdr and accuracy

* Added support for KDR and accuracy on the report

* Fixed typo

* fixed other typo

* Removed KDR calculation in getKdr temporarily

* Added groupBy

* Broke out into custom sql query

* Fixed typo

* Adjusted query'

* Adjusted query

* Adjusted query

* Remove ambiguity

* Added a.count = b.count

* Added logging

* Adjused sql

* SQL query

* Query

* Query

* SQl adjustment

* Added proper sql query

* Adjusted naming in report.service

* adjust kdr to be calculated in sql

* Added order by kdr

* Adjusted successfulMuzzles to reflect the right value

* Adjusted deaths to reflect the right value

* Adjusted naming on report

* Added nemesis by raw and by successful
* Removed last clap and support for clapping one word only

* Adjusted sql queries to be more direct

* Fixed naming added logging

* Adjusted sql query to better support date range

* Dates will be treated as strings in sql

* Fixed invalid sql syntax

* Fixed invalid KDR calculation for time based reporting

* Added error handling for invalid types

* Added formatting on error handling

* Added better reporting titles

* Fixed overflow error

* Added allowance for non-param requested reports to default to AllTime

* Fixed empty string check

* Further logic tweak

* Adjusted titling

* Added better testing for report.service

* Adjusted formatting of tables

* Added a default to 1 when calculating KDR and a user has no deaths

* Formatting

* Fixed KDR calculation

* Debugging mysql divide by 0

* Adjusted created at in kdr

* Removed verbose logging on web.service.ts

* Added log on getKdr to figure out issue with query

* Fixed KDR bug

* Removed the query log

* Cleaned up muzzle report formatting

* Further cleanup of report and logging
* Added confession controller

* Updated route name for confession controller
* Added model for List

* Added a super basic controller and service

* Added report for list

* Fixed username

* Added some slight error handling to remove

* Added removal by text instead of ID and adjusted report to have better naming

* Added limit on characters when adding items

* Fixed error text for list removal

* Adjusted message format for adding and removing from the list

* Verbiage adjustments
sfreeman422 and others added 30 commits January 5, 2020 15:28
* Added fix for expiring counters

* Added proper call for addCounter

* Added fix

* Added fix for getCounterByRequestorAndUserId

* Added log for @ while countered

* moved clearTimeout out
…sing gif (#66)

* Added fix for changing the channel topic

* fixed gif issue
* Added baseline scaffolding for rep

* Added better logging to reaction.service

* moved positive and negative reactions out to constants.ts

* Added reaction entity and began work on reaction.persistence.service

* Adjusted reaction.service and muzzle.controller to handle reactions more generically

* Moved event handling logic out of the muzzle.controller and into a event.controller

* Added eventController middleware into index.ts

* Refactored the reaction.service to solely log rep values to a db. Added a delete method to the reaction.persistence.service

* Added type

* Added log to handleReaction

* Adjusted res

* Adjusted handleRemovedReaction and removeReaction to remove rather than log an opposite reaction

* Added check to only log positve or negative reactions

* Added check for positive and negative when removing rep

* Converted array to map for performance reasons. Also consolidated valuation logic.

* Added check for user and item_user

* Added a more specific log for a no log event

* Added support for logging which channel the reaction was in

* Made use of item.channel instead:

* Added a default value to channel when channel is not available

* added support for a separate rep table that only logs numeric value of the users rep

* Added decrementRep call to removeReaction and fixed an issue where decrementRep instead incremented

* Fixed negative value in decrement rep

* Added conditional logic to removeReaction to handle both positive and negative removals
* Removed dev-utils as they were underutilized and no longer being maintained. Adjusted package.json and tsconfig.json

* Added dockerfile
* Added backfire and counter muzzle checking support to all controller

* Added support for users to check their rep

* Added reaction.controller to middleware
* Added ability to get rep on per user basis

* Updated ReactionByUser interface

* Updated report to make use of easy-table, changed verbiage and removed emoji

* Adjusted formatting

* Removed reaction.service.spec because I am lazy
* Added walkie talkie feature and controller

* spelling error

* added walkie controller

* added an initial chk

* Removes attachment

* formatting test

* More formatting

* Added logging to message

* Added muzzle message sent as user

* Made token parameter optional

* Testing

* removed muzzle tests

* Final cleanup

Co-authored-by: Steven Freeman <sfreeman422@gmail.com>
* Removes attachment

* formatting test

* More formatting

* Added logging to message

* walkie

* Removed unnecesary log

* Fixed tagging issue

* Fixed formatting

* Removed tagging functionality

Co-authored-by: Steven Freeman <sfreeman422@gmail.com>
Co-authored-by: Steven Freeman <sfreeman422@gmail.com>
Co-authored-by: Steven Freeman <sfreeman422@gmail.com>
* Added support for exact definitions instead

* Adjusted logic for multi-word capitalization in define

* Removed capitalize letter call

Co-authored-by: sfreeman422 <sfreeman422@gmail.com>
Co-authored-by: sfreeman422 <sfreeman422@gmail.com>
* Removed TSLint and related packages

* Added eslint and updated code

* Alot of eslint changes

* Fixed report generation for muzzle with new type

* Fixed report.model.ts

* Changed to slackId

* Changed in report.service

* Removed dev-utils command and tslint.json

Co-authored-by: sfreeman422 <sfreeman422@gmail.com>
* Added dockerfile. Working on understanding secret management better

* Added readme env variable config

* Added better documentation, added DB_SEED. Documentation still needs work for setting up slack env

* Movd jest-when and type to dev-dependnecies

* Added --only=prod to the npm install command

* Ran npm audit fix

* Ran npm audit fix, removed no longer necessary packages and adjusted dev dependencies

* Added TODO to readme

* added check for env variables

* Added better checks for env variables

* updated readme with everything needed for local dev

* Updated tsconfig, package.json and dockerfile

* updated readme for missing commands

* Updated tests

* Added constant for MAX_WORD_LENGTH

* Added MAX_WORD_LENGTH to counter

* Removed case sensitivity for shouldBotMessageBeMuzzled

Co-authored-by: sfreeman422 <sfreeman422@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant