Compare commits

...

153 Commits

Author SHA1 Message Date
FoxxMD
e58a0f8f21 Merge branch 'edge' 2022-03-14 12:39:05 -04:00
FoxxMD
c46fe6f128 feat(dispatch): Add cancel action in ui for delayed actions 2022-03-14 12:06:43 -04:00
FoxxMD
074c3c7340 fix(migrations): Escape prefix value before parsing to regex 2022-03-11 15:25:12 -05:00
FoxxMD
8cd8374bbe feat(filters): Add more options for filtering by flair
* Add boolean options to test for "any" or "no" flair on author or submission
* Cleanup flair testing logic
2022-03-11 15:08:37 -05:00
FoxxMD
aa0541f09b refactor(author filter): Improve caching for author filter
* Refactor main author filter logic into subredditresources to take advantage of cache provider
* Implement methods to retrieve and cache subreddit moderators and author information
2022-03-11 14:21:16 -05:00
FoxxMD
eee166467d feat(ui): Improve live stats utilization
* Refactor live stats to work for "All Subreddits" as well as individual subs
* Refactor live stats to take place of opStats and update almost all bot stats live now (only cache breakdown TODO)
* Refactor opstats to return status of bots/subreddits only for ui indicators in tabs
2022-03-11 12:41:59 -05:00
FoxxMD
95b0e529e2 fix(schema): Relax schema for source type due to issues with generation 2022-03-10 14:58:08 -05:00
FoxxMD
45be87a72a fix(item filter): Fix unknown value results
* For unknown value on activity use correct reason and add to property map
* Test for undefined property in property map (shouldn't happen)
2022-03-10 13:04:16 -05:00
FoxxMD
d632364c7d fix(item filter): Fix multiple and unknown criteria
* Log different statements based on whether value or key was undefined
* Fix for-loop break when testing multiple criteria
2022-03-10 12:49:35 -05:00
FoxxMD
9e660214eb feat(schema): Add annotations for dispatched/source 2022-03-10 12:48:27 -05:00
FoxxMD
14340b3a65 fix(ui): Include dayjs plugin for sameOrAfter comparison 2022-03-10 12:47:50 -05:00
FoxxMD
b07402628e fix(dispatch): Push activity from user through firehose so delayed activities get same behavior as from polling 2022-03-10 11:42:30 -05:00
FoxxMD
035283a596 refactor(item filter): Improve source comparison
* Move activity source normalization and verification into own function (thrown on invalid source string)
* Correct source-filter comparison by comparing source to filter rather than other way around to make sure inclusive filter is passed
2022-03-10 11:41:36 -05:00
FoxxMD
cc46f00a22 refactor(dispatch): Rename everything associated with rerun to dispatch
* Also rename item filter from 'dispatch' to 'dispatched' to match verb tense of other state properties
* Simplify identifier property name in config to just 'identifier' -- there's enough context for what it is already
2022-03-10 11:05:21 -05:00
FoxxMD
27263928cd Merge branch 'edge' into rerun 2022-03-10 10:14:58 -05:00
FoxxMD
0f122466ad feat(editor): Retrieving config schema from local URL instead of github
So that our schemas finally match whats in our code!
2022-03-10 10:12:31 -05:00
FoxxMD
32cdb29515 fix(ui): Only fetch reddit status if status element is present on page 2022-03-10 10:11:51 -05:00
FoxxMD
fe311ced32 feat(testing): Add suites for testing activity state 2022-03-09 17:15:40 -05:00
FoxxMD
e41bea7e6b fix(util): Always return false for filtered activity check if user is not a moderator 2022-03-09 17:15:21 -05:00
FoxxMD
9d169cebf3 Add test js/maps to gitignore 2022-03-09 17:14:53 -05:00
FoxxMD
ff3e704cdf fix(client): Simplify client logging to ui and fix instance name
* Correctly render system logs to html
* Simplify websocket logging so it matches how logs are received o browser from server
* Fix instance redirect name when no friendly is set for api config
2022-03-09 12:11:14 -05:00
FoxxMD
caaeb2eefb fix(ui): Set system logs as seen in special case 2022-03-09 12:09:05 -05:00
FoxxMD
8991797d35 feat(testing): WIP added initial testing framework and some util tests
Using mocha, chai, and nyc

* tests for parsing string for numeric value comparison
* tests for parsing string for durations and duration comparisons
* tests for parsing reddit entity (subreddit/user) from string
* tests for parsing submission/comment id from reddit permalink string
* tests for initial config parsing/merging

Still can't get nyc to get coverage for everything in src using "all" -- causes reporting to show 0 for everything??
2022-03-09 10:59:43 -05:00
FoxxMD
aa95c26b2a Merge branch 'edge' into rerun 2022-03-08 21:30:53 -05:00
FoxxMD
11cc90e2d5 feat: Add modnote oauth permission for auth helper 2022-03-08 21:30:37 -05:00
FoxxMD
d11e511f67 Merge branch 'edge' into rerun 2022-03-08 13:02:25 -05:00
FoxxMD
a3708ca279 refactor(ui): Improve live stats usage and add delayed item info
* Update activities and bot usage stats (just overview) with live data from websocket
* Add Delayed count with tooltip to show delayed items overview
2022-03-08 13:00:40 -05:00
FoxxMD
f7cebc013b Merge branch 'edge' 2022-03-08 09:48:06 -05:00
FoxxMD
14d0417a25 refactor(dispatch): Rename rerun to dispatch action 2022-03-07 17:04:55 -05:00
FoxxMD
f4103206db docs: some clarifications in flow control wording 2022-03-07 13:17:17 -05:00
FoxxMD
c9b1bfed40 fix(docs): mermaid issue was being inside closed detail block
For some reason. Removing blocks fixed rendering error
2022-03-07 13:11:45 -05:00
FoxxMD
7f764b4d99 fix(docs): Replace colon causing issues with mermaid diagram rendering 2022-03-07 13:06:12 -05:00
FoxxMD
fb7ddbba70 docs: Add overview for runs and flow control #73 2022-03-07 13:02:17 -05:00
FoxxMD
85b1d13718 docs: Refactor docs to use runs syntax
* Add Runs to main docs readme and concepts
* Add high level diagram in main docs readme to show CM lifecycle
* Refactor subreddit/rule examples to use runs syntax
2022-03-07 10:28:48 -05:00
FoxxMD
7f2191a11a fix: Fix bug where submission identifier was accessed via 'id' instead of 'name' property
* Was causing uncaught promise rejection in userflairaction because it should have been accessing name instead of id
* Wrap all as/is utility functions where value may be from cache (plain object) or proxy (from snoowrap) with try-catch to prevent any more uncaught promise rejections -- would rather swallow silently (for now) than crash the entire application
2022-03-06 19:30:25 -05:00
FoxxMD
c4adf4f495 feat(ui): More identifier readability and succinctness improvements 2022-03-04 21:50:48 -05:00
FoxxMD
95d146a504 feat(ui): Make dispatch action context in actioned event more succinct
Move summary into tooltip and add relevant details to header
2022-03-04 21:39:41 -05:00
FoxxMD
ccc8a0dab5 Merge branch 'edge' into rerun
# Conflicts:
#	src/Web/assets/views/events.ejs
2022-03-04 21:37:39 -05:00
FoxxMD
9b79bdbdd5 feat(ui): Make submission context in actioned event more succinct 2022-03-04 21:08:43 -05:00
FoxxMD
1f3d0b50a7 feat: Implement re-run
* Implement rerun configuration that satisfies requirements from #72
  * rerun as action
  * optional, user-defined identifier
  * cancel rerun as action
  * cancel based on re-queued sources
  * on existing behavior
  * can specify initial goto
* filter item by source (where item was retrieved from for non-cached items)
* filter item by rerun state/identifier
* Add rerun label to event logging
* Add rerun data to actioned event data
2022-03-04 15:52:05 -05:00
FoxxMD
d8d409ae6b Some rerun basics 2022-03-03 16:34:39 -05:00
FoxxMD
6b9852cc14 feat(recent activity): Implement ability to compare distinct subreddits found
Closes #77
2022-03-03 13:16:39 -05:00
FoxxMD
fbf627c971 feat(actioned event): Add more context for ui and search
* Add id and activity type to event activity data
* Include parent submission activity data if activity is a comment
* Refactor event page ui to simplify headers and move content into collapsible
  * Add context to content by including submission context for comments
2022-03-02 15:10:27 -05:00
FoxxMD
b2077132cf fix(ui): Don't strip urls from body when previewing comment in events 2022-03-02 13:31:18 -05:00
FoxxMD
f622c3ee03 fix(errors): try-catch on transform for good measure
Would rather just get top-level error than crash the app and log a bad transformation (which tells us nothing about the original error)
2022-03-02 11:22:59 -05:00
FoxxMD
ab83f3ed0c fix(errors): Another better check for respsone headers 2022-03-02 11:16:48 -05:00
FoxxMD
a021b503a0 fix(errors): Better check for response headers on error transform 2022-03-02 11:13:32 -05:00
FoxxMD
d28714aacc fix(usernote): Fix user note instantiation and link handling
* Fix argument order for new note object
* Better handling for notes without a reference link
2022-03-02 09:53:48 -05:00
FoxxMD
7632a66250 fix(user flair): Fix dry check 2022-03-01 13:45:27 -05:00
FoxxMD
bb6936d657 fix(check): Correctly get run actions for notification payload 2022-02-28 14:42:44 -05:00
FoxxMD
d4062b679a refactor(filter): Better handling for submissionState item criteria
* Allow FilterResult as a property result
* Remove pre-item testing cache optimization for submissionState to simplify flow
  * Helped reduce key count but not worth the cost of overly complex code for returning filter results
* Remove expected prop from results and instead use criteria in filter results to generate this for logs/events
* Refactor log/event generation to handle FilterResult in filter property result
2022-02-28 13:04:21 -05:00
FoxxMD
313ee0a9a3 fix(usernotes): Better handle missing moderators (no more errors thrown)
Fixes edge case where a usernote was created by a moderator that no longer mods the sub

* Store mod index so we can recreate note even if moderator is missing
* Refactor moderator hydration on usernote from raw data to just warn if moderator cannot be found
2022-02-28 12:58:24 -05:00
FoxxMD
7afc384d17 fix(ui): Fix filter numbering in events page 2022-02-28 12:56:26 -05:00
FoxxMD
fea1f240dd Merge branch 'edge' into flowControl 2022-02-28 10:01:52 -05:00
FoxxMD
1dba0e857f fix(logging): Better data shape checking for error transformer 2022-02-28 10:01:30 -05:00
FoxxMD
0966aa689f Merge branch 'edge' into flowControl 2022-02-22 15:55:00 -05:00
FoxxMD
138e237fbc fix(comment): Fix the target of the lock intention
Should be locking the created comment instead of the activity being checked
2022-02-22 13:29:58 -05:00
FoxxMD
6b38ec1669 Merge branch 'edge' into flowControl 2022-02-22 11:21:14 -05:00
FoxxMD
ae8e11feb4 Merge branch 'edge' 2022-02-22 11:11:46 -05:00
FoxxMD
5cd415e300 Bump version 2022-02-22 11:11:29 -05:00
FoxxMD
7cdaa4bf25 fix(migrations): Remove unnecessary log warning for all logs on live stats 2022-02-22 11:10:51 -05:00
FoxxMD
280ddf583b fix(migrations): Fix missing TTL for cache migration 2022-02-22 10:50:44 -05:00
FoxxMD
4969cafc97 fix(ui): Add missing dayjs plugins for timestamp formatting 2022-02-22 10:43:17 -05:00
FoxxMD
5f6e63542b feat(flow): Implement max goto depth configuration 2022-02-22 10:42:52 -05:00
FoxxMD
bca9c96468 fix(ui): Fix run summary typo 2022-02-22 09:44:49 -05:00
FoxxMD
7569c06a36 Merge branch 'edge' into flowControl
# Conflicts:
#	src/Bot/index.ts
#	src/Subreddit/Manager.ts
#	src/Web/Client/index.ts
#	src/Web/Server/routes/authenticated/user/index.ts
#	src/Web/assets/public/app.css
#	src/util.ts
2022-02-22 09:27:36 -05:00
FoxxMD
88bafbc1ac fix(ui): Fix not clearing intervals on client disconnect 2022-02-21 16:47:17 -05:00
FoxxMD
a5acd6ec83 feat: Refactor client/secret api interaction to improve fetching data and enable live stats
* Only return logs for "default viewed" subreddit/bot when fetching instance status, when specified from QS
  * Greatly reduces amount of data fetched and response time
* Return logs with formatted property for non-streaming response
* Implement server live stats endpoint to return subreddit/all stats based on QS
* Use client websocket connection to return stats for currently viewed subreddit
2022-02-21 16:14:41 -05:00
FoxxMD
d93c8bdef2 Merge branch 'docUpdates' into edge 2022-02-21 12:00:37 -05:00
FoxxMD
8a32bd6485 Merge branch 'edge' into logRefactor
# Conflicts:
#	src/Web/Client/index.ts
2022-02-18 15:45:28 -05:00
FoxxMD
425cbc4826 feat: Improve user agent reporting and version display in ui 2022-02-18 15:16:37 -05:00
FoxxMD
3a2d3f5047 refactor(logging): Use logging from CMInstance instead of client
Reduces logging complexity and has better single responsibility
2022-02-18 13:37:07 -05:00
FoxxMD
ae20b85400 refactor(client): Refactor server instance into own class
* Move from plain data with interface to class and refactor heartbeat logic into class
* Makes logging easier and cleans up client code
2022-02-18 13:09:33 -05:00
FoxxMD
e07b8cc291 Merge branch 'edge' 2022-02-18 11:58:28 -05:00
FoxxMD
e993c5d376 refactor(logging): Move log collection into bot/manager for better single responsibility
* Move "sorting" log objects into lists for retrieval from server and into bot/managers for each log object type
* Refactor log filtering and aggregration under status/log endpoints to use logs from each entity rather than pulling from server

Reduces complexity in historical log data structures at the expense of slightly more runtime data crunching. The trade-off is well worth it and paves the way for easier retrieval of single/subsets of logs
2022-02-18 11:58:13 -05:00
FoxxMD
80fabeac54 fix(usernote): Fix adding new note to user note cache AFTER clearing cache
* Fixes an issue where the cached notes for a user only contain the last added note instead of all notes + new
* Also reduced api calls by caching moderator adding new note instead of calling each time
2022-02-18 09:54:18 -05:00
FoxxMD
c001be9abf feat(ui): Add reddit status indicator with link 2022-02-17 16:14:36 -05:00
FoxxMD
639a542fb2 fix(ui): Fix default values for scopes and permissions when not available 2022-02-17 13:53:06 -05:00
FoxxMD
9299258de0 feat(ui): Add moderator permissions list to subreddit overview 2022-02-17 13:37:42 -05:00
FoxxMD
59f8ac6dd4 feat(ui): Add oauth scopes list to bot overview
Visible when user is an operator
2022-02-17 13:29:37 -05:00
FoxxMD
f16155bb1f fix(flair): Fix snoowrap function used for assigning flair template id 2022-02-17 13:17:17 -05:00
FoxxMD
e2d2f73bb3 feat: Add log warning when user has no access 2022-02-15 11:00:09 -05:00
FoxxMD
9ca5d6c8c2 fix: Fix config builder to supply more defaults for a minimal configuration
* Provide a default redirect uri
* Don't add default bot instance if no credentials were specified
2022-02-14 12:07:54 -05:00
FoxxMD
4f9d1c1ca1 docs: Some clarifications for install/run directions 2022-02-14 10:54:25 -05:00
FoxxMD
d8f673bd26 fix(remove): Only warn if item looks removed, on remove action
If the item is not actually removed (it's hard to tell from reddit api) we don't want to prematurely end remove action. Just warn and try to remove anyway
2022-02-14 09:31:50 -05:00
FoxxMD
7e2068d82a fix(author): Ensure automoderator is always detected as a moderator for author isMod test 2022-02-14 09:30:54 -05:00
FoxxMD
176611dbf3 docs: Add web interface and config onboarding 2022-02-11 23:40:28 -05:00
FoxxMD
372bae0e03 feat(ui): Implement displaying author/item filters for actioned events 2022-02-10 15:15:21 -05:00
FoxxMD
6f35ec3705 fix: Set process result error property with easier-to-read error message and include "not enabled" 2022-02-10 15:14:55 -05:00
FoxxMD
a542d80c1d feat(migration): Update cache migration for new actioned event structure 2022-02-10 13:54:49 -05:00
FoxxMD
9dcf256aa1 feat(filter): Add filters to all result data 2022-02-10 13:43:33 -05:00
FoxxMD
da206f41ad feat(filter): Refactor itemIs to use FilterCriteriaResult
Normalizes item is filter so it behaves and produces the same type of results as author filter
2022-02-10 13:37:04 -05:00
FoxxMD
550beb9baf feat: Add restricts on flow control to prevent endless loops
* Restrict checks/gotos to being run once
* Throw flow control errors instead of catching to ensure we exit flow early
2022-02-10 11:21:12 -05:00
FoxxMD
3d99406f33 Merge branch 'persistActions' into edge 2022-02-09 17:09:24 -05:00
FoxxMD
7f9adcef36 refactor: Refactor manager/run/check handling for better single responsibility 2022-02-09 16:47:57 -05:00
FoxxMD
ab355977ba fix(approve): Fix approval check target 2022-02-09 16:41:39 -05:00
FoxxMD
f24eb52697 Merge branch 'edge' into flowControl 2022-02-09 13:15:01 -05:00
FoxxMD
60dbc42148 Merge remote-tracking branch 'origin/flowControl' into flowControl
# Conflicts:
#	src/Check/index.ts
#	src/Subreddit/Manager.ts
#	src/util.ts
2022-02-09 13:12:52 -05:00
FoxxMD
8667fcdef3 fix(stats): Correctly initialize all time historical stats from cache when stat is empty 2022-02-09 13:10:05 -05:00
FoxxMD
ec20445772 refactor(ui): Use checkmark symbol that matches x symbol (no emojis) 2022-02-09 13:09:39 -05:00
FoxxMD
8d9fb29848 feat(ui): Implement run context for actioned events
* Refactor events view to show checks within runs
* Build cohesive runs server-side before rendering so user can see all checks in a run together
* Add collapse/expand behavior for activity/run/check with ability to toggle based on triggered state
* Default to collapsing all non-triggered states
* Build check summary on-the-fly instead of storing in event result data
2022-02-09 13:08:48 -05:00
FoxxMD
f7a7e817f9 feat(cache): Implement cache migrations
* Store migration state in cache instance
* Migrate on default cache init or private cache init
* Implement first migration to deal with run structure in actioned events
2022-02-08 17:00:18 -05:00
FoxxMD
e09cab6872 refactor(check): Refactor structure for storing check/action result for runs
* Use array of check result objects that contain rule/action results
* Include post behavior on check summary
2022-02-08 14:35:26 -05:00
FoxxMD
f1797f29fd Merge branch 'persistActions' into flowControl
# Conflicts:
#	src/util.ts
2022-02-08 13:39:36 -05:00
FoxxMD
4eae07f831 feat(flow): Implement basic flow control structures #73
* Add Run and postCheckBehavior config structures to schema and interfaces
* Implement parsing from config and initial flow logic for running on activities in manager
2022-02-08 13:39:02 -05:00
FoxxMD
0293928a99 feat(cache): Implement cache key manipulation based on key pattern
* Implement glob pattern or regex as argument
* Implement scan search for redis for efficiency otherwise iterate keys using generic function
* Implement cache reset based on passed item from action -- reset item crit for activities, author crit for users, and overwrite any cached activity
2022-02-08 13:01:09 -05:00
FoxxMD
b56d6dbe7c fix(actions): Only include successfully run actions in notification summary 2022-02-07 22:21:22 -05:00
FoxxMD
42d269e28d feat(actions): Mutate activities during actions for immediate use and ensure cache is synced 2022-02-07 16:21:43 -05:00
FoxxMD
8f60a1da53 feat(regex): Add option to stop rule early if current activity does not match
In order to prevent history from being pulled (and using api) if user indicates current activity must also match
2022-02-07 15:15:50 -05:00
FoxxMD
f511be7c33 fix(usernote): Throw error with cause when usernote fails instead of logging quietly
* Makes error cause easier to see in stack and fixes error now logging during action failure
* Use error with cause for logging action error for clearer stack
2022-02-07 12:41:10 -05:00
FoxxMD
ebb426e696 feat(filter): Add isRedditMediaDomain submission state criteria 2022-02-07 10:36:56 -05:00
FoxxMD
63696b746e feat(flow): Implement basic flow control structures #73
* Add Run and postCheckBehavior config structures to schema and interfaces
* Implement parsing from config and initial flow logic for running on activities in manager
2022-02-04 15:06:21 -05:00
FoxxMD
fc51928054 Merge branch 'edge' 2022-02-02 16:59:56 -05:00
FoxxMD
c07276a3be fix(logging): Fix typo in error transform 2022-02-01 13:13:27 -05:00
FoxxMD
4a2297f5cd docs: Add github sponsor link 2022-02-01 12:01:34 -05:00
FoxxMD
f8967d55c4 feat(repeat): Use newer text comparison technique to improve repeat detection
* Use same technique as repost rule which has high accuracy and let false-positives
* Implement ability to see similarity score, case sensitivity, and text transformations
2022-01-31 14:08:21 -05:00
FoxxMD
e2590e50f8 Merge branch 'edge' 2022-01-28 17:27:51 -05:00
FoxxMD
7e8745d226 fix(polling): Fix shared polling behavior for nanny mode changes
* On hard limit stop shared streams
* On nanny mode turned off restart any stopped shared streams
2022-01-27 16:49:03 -05:00
FoxxMD
e2efc85833 fix(polling): Fix running state not changed on error
* Set running to false when error is caught. Was not caught on last stream refactor which changed polling behavior to end if any error is caught rather than waiting for external source to clear interval
* Add debugging/error messages on polling start/stop
2022-01-27 16:47:43 -05:00
FoxxMD
41038b9bcd feat(logging): Implement richer errors everywhere
* Use ErrorWithCause so we can get and print a chain of error causes
* Make reddit error response in stack trace more readable by replacing them with a "translated" parent response and add them as the cause
* Properly handle error formatting for winston by looking at shape of log object for error rather than testing instanceof (see comments in errorAwareFormat)
* Fix formatting in web interface for log lines with white-space pre css and properly splitting timestamp from rest of the message
2022-01-27 16:27:03 -05:00
FoxxMD
9fe8c9568c refactor: Move SimpleError into main Errors module 2022-01-27 11:48:23 -05:00
FoxxMD
9614f7a209 refactor(logging): Implement snoowrap errors "the right way" and implement consolidated logging function
* Implement declaration file for snoowrap errors so they can be imported directly
* Implement logging function to handle boilerplate for known error responses (reddit HTTP response, rate limit, etc.)
2022-01-27 11:43:39 -05:00
FoxxMD
8dbaaf6798 fix(logging): Defaults for log file dir 2022-01-26 12:28:56 -05:00
FoxxMD
c14ad6cb76 feat(logging): Implement separate logging options for each transport type
* Add properties for file, console, and stream in logging object of operator config
* Each property inherits a (useful) subset of winston transport options
2022-01-26 12:09:03 -05:00
FoxxMD
adda280dd3 fix(logging): Fix parsing log dir
* Correct else condition to use log dir when value is not true
* Set level to 'debug' on init logger if no value is provided to help with debugging
2022-01-26 10:27:01 -05:00
FoxxMD
15fd47bdb4 fix(polling): Correct typings for stream getter and check isFinished for Listing 2022-01-26 10:11:06 -05:00
FoxxMD
78b6d8b7b6 feat(polling): Add debug messages when streams are stopped 2022-01-26 10:00:09 -05:00
FoxxMD
61bc63ccc5 fix(polling): Emit config change event to bot only after manager has rebuilt polling 2022-01-26 09:50:30 -05:00
FoxxMD
05df8b7fe2 fix(polling): Use manager eventState to control shared stream callback rather than removing callback when events are stopped
Should prevent edge cases where shared streams are re-parsed while managers are stopped (hard limit) and then removed due to there being no callbacks
2022-01-25 18:07:15 -05:00
FoxxMD
3cb7dffb90 fix(polling): Prevent endless loop when trying to enforce continuity on a stream with no items returned 2022-01-25 09:25:59 -05:00
FoxxMD
d0aafc34b9 feat(remove): Add option to mark activity as spam 2022-01-21 13:03:05 -05:00
FoxxMD
d2e1b5019f chore: Update packages 2022-01-21 13:02:31 -05:00
FoxxMD
aaed0d3419 Merge branch 'edge' 2022-01-21 10:46:11 -05:00
FoxxMD
2a77c71645 fix(usernotes): Fix wiki entity handling to avoid unhandled rejection
Since snoowrap's WikiPage isn't a "real" object setting it as a property on the class means if it rejects the whole application crashes. Fix this by building wiki proxy every time we need it before awaiting promise for edit/retrieval so that promise scope is bound to the function we are in (that has try-catch)
2022-01-20 14:10:39 -05:00
FoxxMD
780e5c185e refactor(author filter): Strongly structure comparison/matching data for more consistent manipulation and output
* Use interface for comparison results at both criteria property level and criteria level
* Implement summary functions to build string results of comparisons
* Output all comparisons to debug and provide summaries to verbose (when applicable)
2022-01-20 14:08:54 -05:00
FoxxMD
38e2a4e69a fix(filter): Missing return on flair failure comparison 2022-01-19 15:49:44 -05:00
FoxxMD
7e0c34b6a3 fix(userflair): Fix wrong assignment for css 2022-01-19 13:10:11 -05:00
FoxxMD
e3ceb90d6f fix(filter): Fix default excludeCondition type
* Expected (prior) behavior is that all exclude criteria must pass, not just one
* Fix missing AND condition logic when all conditions pass
2022-01-19 13:09:45 -05:00
FoxxMD
6977e3bcdf feat(author): Add flair template criteria for author/submission
* Add filtering by flairTemplate id for author/submission
* Refactor flair properties for author/submission to accept string or array of strings
2022-01-19 12:48:58 -05:00
FoxxMD
f382cddc2a fix(filter): Change array merging behavior for authorIs defaults to be more sane
* Don't just overwrite (duh)
* Drop any default filters that include object keys that are also present in user-defined filters -- this way user-defined always takes precedence on merge
2022-01-19 11:52:18 -05:00
FoxxMD
99a5642bdf fix(ui): Change time formatting from 12 to 24 hour 2022-01-18 16:49:07 -05:00
FoxxMD
174d832ab0 docs: Pretty up readme header 2022-01-18 16:08:40 -05:00
FoxxMD
3ee7586fe2 fix(approve): Fix touched entity 2022-01-18 13:37:56 -05:00
FoxxMD
e2c724b4ae feat(approve): Implement approving parent submission of comment 2022-01-18 13:37:22 -05:00
FoxxMD
d581f19a36 feat(logs): Use log objects in api to improve parsing client-side
* Add options for /logs endpoint to stream objects instead of strings
* Always return log objects from /status endpoint -- fixes bug where all bots/subreddits got lines from logs that had newlines
* Return context-aware, formatted log lines to client to reduce line length IE if returning to botA -> subA then do not need to include labels for botA,subA #40
* Shorten timestamp to just time and wrap full timestamp in tooltip #40
* Emit log objects to client to reduce parsing complexity (don't have to regex for bot/subreddit name)
2022-01-18 12:59:59 -05:00
FoxxMD
48dea24bea feat: Improve first-run display in ui and add system view
* Fix bugs in UI when bot does not have a name (configured incorrectly)
* Implement instance system log view for operators
2022-01-18 10:38:39 -05:00
FoxxMD
5fc2a693a0 fix(config): Fix empty yaml config document initialization 2022-01-18 00:06:52 -05:00
FoxxMD
7be0722140 fix(bot): Fix limit rate expiration getter when there is no client initialized 2022-01-18 00:06:24 -05:00
FoxxMD
6ab9fe4bf4 feat(config): Implement persisting bots from invite process to application and config
* write to config when bot is added
* replace/add based on existing bot
* implement specify instance from instances user is operator of
* implement specify subreddits to run on using comma-separated list
* rewrite invite flow ending to be more clear on results and next steps
2022-01-17 17:47:27 -05:00
FoxxMD
5811af0342 feat(config): Refactor config parsing to preserve comments and enable writing
* use node-comment and yaml@next to keep comment information intact
* store ast/source version of parsed config for operator
* implement generic yaml/json operator config classes to keep everything organized and simplify marshalling source to js/string
* refactor file parsing and json/yaml parsing to have better single responsibility
2022-01-17 15:51:43 -05:00
FoxxMD
ed2924264a feat(util): Better check for file/dir permissions 2022-01-17 11:18:23 -05:00
FoxxMD
e9394ccf2e refactor(tooling): Ignore sqlite files 2022-01-17 09:52:18 -05:00
FoxxMD
dec72f95c6 docs: Add discord invite link 2022-01-14 16:42:01 -05:00
173 changed files with 16335 additions and 4722 deletions

View File

@@ -6,3 +6,4 @@ src/logs
.github
/docs/
/node_modules/
coverage

2
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
github: [FoxxMD]
custom: ["bitcoincash:qqmpsh365r8n9jhp4p8ks7f7qdr7203cws4kmkmr8q"]

11
.gitignore vendored
View File

@@ -381,5 +381,16 @@ dist
.pnp.*
**/src/**/*.js
**/tests/**/*.js
**/tests/**/*.map
!src/Web/assets/public/yaml/*
**/src/**/*.map
/**/*.sqlite
/**/*.bak
*.yaml
*.json5
!src/Schema/*.json
!docs/**/*.json5
!docs/**/*.yaml
!docs/**/*.json

View File

@@ -2,10 +2,13 @@
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
<excludeFolder url="file://$MODULE_DIR$/src/logs" />
<excludeFolder url="file://$MODULE_DIR$/coverage" />
<excludeFolder url="file://$MODULE_DIR$/.nyc_output" />
</content>
<content url="file://$MODULE_DIR$/node_modules" />
<orderEntry type="inheritedJdk" />

4
.mocharc.json Normal file
View File

@@ -0,0 +1,4 @@
{
"require": ["./register.js", "source-map-support/register"],
"reporter": "dot"
}

24
.nycrc.json Normal file
View File

@@ -0,0 +1,24 @@
{
"extends": "@istanbuljs/nyc-config-typescript",
"exclude": [
"node_modules/",
"**/src/Schema/**",
"**/src/Web/assets/**",
"**/tests/**",
"register.js",
"**/src/**/*.d.ts"
],
"include": [
"**/src/**/*.ts",
"**/src/**/*.js",
"**/src/**/*.js.map"
],
"extension": [
".ts"
],
"reporter": [
"text-summary",
"html"
],
"report-dir": "./coverage"
}

View File

@@ -1,6 +1,7 @@
[![Latest Release](https://img.shields.io/github/v/release/foxxmd/context-mod)](https://github.com/FoxxMD/context-mod/releases)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Docker Pulls](https://img.shields.io/docker/pulls/foxxmd/context-mod)](https://hub.docker.com/r/foxxmd/context-mod)
# ContextMod [![Latest Release](https://img.shields.io/github/v/release/foxxmd/context-mod)](https://github.com/FoxxMD/context-mod/releases) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Docker Pulls](https://img.shields.io/docker/pulls/foxxmd/context-mod)](https://hub.docker.com/r/foxxmd/context-mod)
<img src="/docs/logo.png" align="right"
alt="ContextMod logo" width="180" height="176">
**Context Mod** (CM) is an event-based, [reddit](https://reddit.com) moderation bot built on top of [snoowrap](https://github.com/not-an-aardvark/snoowrap) and written in [typescript](https://www.typescriptlang.org/).
@@ -108,7 +109,7 @@ CM comes equipped with a dashboard designed for use by both moderators and bot o
* View **real-time logs** of what the bot is doing on your subreddit
* **Run bot on any permalink**
![Subreddit View](docs/screenshots/subredditStatus.jpg)
![Subreddit View](docs/images/subredditStatus.jpg)
### Bot Setup/Authentication
@@ -116,11 +117,11 @@ A bot oauth helper allows operators to define oauth credentials/permissions and
Operator view/invite link generation:
![Oauth View](docs/screenshots/oauth.jpg)
![Oauth View](docs/images/oauth.jpg)
Moderator view/invite and authorization:
![Invite View](docs/screenshots/oauth-invite.jpg)
![Invite View](docs/images/oauth-invite.jpg)
### Configuration Editor
@@ -133,7 +134,7 @@ A built-in editor using [monaco-editor](https://microsoft.github.io/monaco-edito
* Authenticated view loads subreddit configurations by simple link found on the subreddit dashboard
* Switch schemas to edit either subreddit or operator configurations
![Configuration View](docs/screenshots/editor.jpg)
![Configuration View](docs/images/editor.jpg)
## License

View File

@@ -5,6 +5,7 @@
* [Getting Started](#getting-started)
* [How It Works](#how-it-works)
* [Concepts](#concepts)
* [Run](#runs)
* [Check](#checks)
* [Rule](#rule)
* [Examples](#available-rules)
@@ -36,31 +37,61 @@ Review **at least** the **How It Works** and **Concepts** below, then:
Where possible Context Mod (CM) uses the same terminology as, and emulates the behavior, of **automoderator** so if you are familiar with that much of this may seem familiar to you.
### Diagram
Expand the section below for a simplified flow diagram of how CM processes an incoming Activity. Then refer the text description of the diagram below as well as [Concepts](#Concepts) for descriptions of individual components.
<details>
<summary>Diagram</summary>
![Flow Diagram](/docs/images/diagram-highlevel.jpg)
</details>
CM's lifecycle looks like this:
#### 1) A new event in your subreddit is received by CM
The events CM watches for are configured by you. These can be new modqueue/unmoderated items, submissions, or comments.
#### 2) CM sequentially processes each Check in your configuration
#### 2) CM sequentially processes each Run in your configuration
A [**Run**](#Runs) is made up of a set of [**Checks**](#Checks)
#### 3) CM sequentially processes each Check in the current Run
A **Check** is a set of:
* One or more **Rules** that define what conditions should **trigger** this Check
* One or more **Actions** that define what the bot should do once the Check is **triggered**
* One or more [**Rules**](#Rule) that define what conditions should **trigger** this Check
* One or more [**Actions**](#Action) that define what the bot should do once the Check is **triggered**
#### 3) Each Check is processed, *in order*, until a Check is triggered
#### 4) Each Check is processed, *in order*, until a Check is **triggered**
Once a Check is **triggered** no more Checks will be processed. This means all subsequent Checks in your configuration (in the order you listed them) are basically skipped.
In CM's default configuration, once a Check is **triggered** no more Checks will be processed. This means all subsequent Checks in this Run (in the order you listed them) are skipped.
#### 4) All Actions from that Check are executed
#### 5) All Actions from the triggered Check are executed
After all Actions are executed CM returns to waiting for the next Event.
After all **Actions** from the triggered **Check** are executed CM begins processing the next **Run**
#### 6) Rinse and Repeat from #3
Until all Runs have been processed.
## Concepts
Core, high-level concepts regarding how CM works.
### Runs
A **Run** is made up of a set of **Checks** that represent a group of related behaviors the bot should check for or perform -- that are independent of any other behaviors the Bot should perform.
An example of Runs:
* A group of Checks that look for missing flairs on a user or a new submission and flair accordingly
* A group of Checks that detect spam or self-promotion and then remove those activities
Both group of Checks are independent of each other (don't have any patterns or actions in common). Learn more about using [Runs and **Flow Control** to control how CM behaves.](/docs/examples/advancedConcepts/flowControl.md)
### Checks
A **Check** is the main logical unit of behavior for the bot. It is equivalent to "if X then Y". A Check is comprised of:
@@ -68,7 +99,7 @@ A **Check** is the main logical unit of behavior for the bot. It is equivalent t
* One or more **Rules** that are tested against an **Activity**
* One of more **Actions** that are performed when the **Rules** are satisfied
The bot's configuration can be made up of one or more **Checks** that are processed **in the order they are listed in the configuration.**
A Run can be made up of one or more **Checks** that are processed **in the order they are listed in the Run.**
Once a Check is **triggered** (its Rules are satisfied and Actions performed) all subsequent Checks are skipped.
@@ -87,7 +118,7 @@ A **Rule** is some set of **criteria** (conditions) that are tested against an A
There are generally three main properties for a Rule:
* **Critiera** -- The conditions/values you want to test for.
* **Criteria** -- The conditions/values you want to test for.
* **Activities Window** -- If applicable, the range of activities that the **criteria** will be tested against.
* **Rule-specific options** -- Any number of options that modify how the **criteria** are tested.
@@ -149,6 +180,7 @@ An **Action** is some action the bot can take against the checked Activity (comm
* Remove (Comment/Submission)
* Flair (Submission)
* User Flair (Submission/Comment)
* Ban (User)
* Approve (Comment/Submission)
* Comment (Reply to Comment/Submission)
@@ -160,12 +192,12 @@ For detailed explanation and options of what individual Actions can do [see the
### Filters
**Checks, Rules, and Actions** all have two additional (optional) criteria "tests". These tests behave differently than rule/check triggers in that:
**Runs, Checks, Rules, and Actions** all have two additional (optional) criteria "tests". These tests behave differently than rule/check triggers in that:
* When they **pass** the thing being tested continues to process as usual
* When they **fail** the thing being tested **is skipped, not failed.**
For **Checks** and **Actions** skipping means that the thing is not processed. The Action is not run, the Check is not triggered.
For **Runs**, **Checks**, and **Actions** skipping means that the thing is not processed. The Action is not run, the Check is not triggered.
In the context of **Rules** (in a Check) skipping means the Rule does not get run BUT it does not fail. The Check will continue processing as if the Rule did not exist. However, if ALL Rules in a Check are skipped then the Check does "fail" (is not triggered).

View File

@@ -21,6 +21,7 @@ This directory contains example of valid, ready-to-go configurations for Context
* [Author and post flairs](/docs/examples/onlyfansFlair)
* [Toolbox User Notes](/docs/examples/userNotes)
* [Advanced Concepts](/docs/examples/advancedConcepts)
* [Flow Control](/docs/examples/advancedConcepts/flowControl.md)
* [Rule Sets](/docs/examples/advancedConcepts/ruleSets.json5)
* [Name Rules](/docs/examples/advancedConcepts/ruleNameReuse.json5)
* [Check Ordering](/docs/examples/advancedConcepts)

View File

@@ -2,11 +2,13 @@
See **Rule Name Reuse Examples [YAML](/docs/examples/advancedConcepts/ruleNameReuse.yaml) | [JSON](/docs/examples/advancedConcepts/ruleNameReuse.json5)**
### Check Order
### Check Order and Flow Control
Checks are run in the order they appear in your configuration, therefore you should place your highest requirement/severe action checks at the top and lowest requirement/moderate actions at the bottom.
This is so that if an Activity warrants a more serious reaction that Check is triggered first rather than having a lower requirement check with less severe actions triggered and causing all subsequent Checks to be skipped.
This is so that if an Activity warrants a more serious reaction that Check is triggered first rather than having a lower requirement check with less severe actions triggered and causing all subsequent Checks to be skipped.
This behavior can also be controlled modified using [Flow Control](/docs/examples/advancedConcepts/flowControl.md)
* Attribution >50% AND Repeat Activity 8x AND Recent Activity in 2 subs => remove submission + ban
* Attribution >20% AND Repeat Activity 4x AND Recent Activity in 5 subs => remove submission + flair user restricted

View File

@@ -0,0 +1,228 @@
Context Mod's behavior after a **Check** has been processed can be configured by a user. This allows a subreddit to control exactly what Runs/Checks will be processed based on the outcome (triggered or not) of a Check.
# Table of Contents
- [Post-Check Properties](#post-check-properties)
* [State](#state)
* [Behavior](#behavior)
+ [Next](#next)
+ [Next Run](#next-run)
+ [Stop](#stop)
+ [Goto](#goto)
- [Goto Syntax](#goto-syntax)
- [Default Behaviors](#default-behaviors)
* [Defining Default Behaviors](#defining-default-behaviors)
- [Examples](#examples)
# Post-Check Properties
## State
When a Check is finished processing it can be in one of two states:
* **Triggered** -- The **Rules** defined in the Check were **triggered** which caused the **Actions** for the Check to be run
* **Failure** -- The **Rules** defined in the check were **not triggered**, based on the conditions that were set (either from the [Check condition](/docs/README.md#Checks) or [Rule Sets](/docs/examples/advancedConcepts/README.md#Rule-Sets)), and no **Actions** were run
The behavior CM follows is based on which state it is in. The behavior can be specified **by one or both** of these **state properties** on the Check configuration:
* `postTrigger` -- Specifies what behavior to take when the check is **triggered**
* `postFail` -- Specifies what behavior to take when the check is **not triggered**
## Behavior
There are **four** behaviors CM can take. Both/either **state properties** can be defined with **any behavior.**
### Next
The **Next** behavior tells CM to continue to whatever comes *after the Check that was just processed.* This could be another Check or, if this is the last Check in a Run, the next Run.
NOTE: `next` is the **default behavior** for the `postFail` state
Example
```yaml
- name: MyCheck
# ...
postFail: next # if Check is not triggered then CM will start processing AnotherCheck
- name: AnotherCheck
# ...
```
### Next Run
The **Next Run** behavior tells CM to **skip all remaining Checks in the current Run and start processing the next Run in order.**
NOTE: `nextRun` is the **default behavior** for the `postTrigger` state
Example
```yaml
runs:
- name: MyFirstRun
checks:
- name: MyCheck
# ...
postTrigger: nextRun # if Check is triggered then CM will SKIP mySecondCheck and instead start processing MySecondRun
- name: MySecondCheck
# ...
- name: MySecondRun
checks:
- name: FooCheck
# ...
```
### Stop
The **Stop** behavior tells CM to **stop processing the Activity entirely.** This means all remaining Checks and Runs will not be processed.
Example
```yaml
runs:
- name: MyFirstRun
checks:
- name: MyCheck
# ...
postTrigger: stop # if Check is triggered CM will NOT process MySecondCheck OR MySecondRun. The activity is "done" being processed at this point
- name: MySecondCheck
# ...
- name: MySecondRun
checks:
- name: FooCheck
# ...
```
### Goto
The **Goto** behavior is an **advanced** behavior that allows you to specify that CM should "jump to" a specific place in your configuration, regardless of order/location, and continue processing the Activity from there. It can be used to do things like:
* create a loop/iteration to have CM re-process the Activity on an earlier executed part of your configuration because a later part modified the Activity (flaired, etc...)
* use a Check as a simplified *switch statement*
**Goto should be use with care.** If you do not fully understand how this mechanism works you should avoid using it as **most** behaviors can be accomplished using the other behaviors.
As an additional protection **goto depth is limited to 1 by default** which means if a `goto` would be executed more than once during an Activity's lifecycle CM will automatically stop processing that Activity. The `maxGotoDepth` can be raised by the [**Bot Operator**](/docs/gettingStartedOperator.md) per subreddit.
#### Goto Syntax
Location to "jump to" can be specified as:
* **Run** -- `goto:myRunName`
* **Check inside a different Run** -- `goto:myRunName.aCheckInsideTheRun`
* **Check inside the current Run** -- `goto:.myCheck`
Example
```yaml
runs:
- name: MyFirstRun
checks:
- name: FirstCheck
# ...
- name: MyCheck
# ...
postTrigger: 'goto:MyThirdRun' # jump to the run MyThirdRun
postFail: 'goto:MySecondRun.BuzzCheck' # jump to the Check BuzzCheck inside the Run MySecondRun
- name: MySecondRun
checks:
- name: FooCheck
# ...
- name: BuzzCheck
# ...
- name: MyThirdRun
checks:
- name: BarCheck
# ...
```
# Default Behaviors
It is **not required** to define post-Check behavior. CM uses sane defaults to mimic the behavior of automoderator as well as what is "intuitive" when reading a configuration -- that logic flows from top-to-bottom in the order it was defined. For each Check like this:
```yaml
- name: MyCheck
kind: comment
rules:
# ...
actions:
# ...
```
`postTrigger` and `postFail` have default behaviors (mentioned in the sections above) that make the Check end up working like this:
```yaml
- name: MyCheck
kind: comment
rules:
# ...
actions:
# ...
postTrigger: nextRun # check is triggered and actions were performed, skip remaining checks and go to the next Run
postFail: next # check is not triggered and no actions performed, continue to the next check in this Run
```
**So if you are fine with all Checks running in order until one triggered there is no need to define post-Check behaviors at all.**
## Defining Default Behaviors
Defining `postTrigger` and/or `postFail` on a **Run** will set the default behavior for any **Checks** in the Run that **do not have an explicit behavior set.**
```yaml
runs:
- name: MyFirstRun
postTrigger: stop # all Checks without postTrigger defined will have 'stop' as their behavior
checks:
- name: FooCheck # postTrigger is 'stop' since it is not defined
# ...
- name: BarCheck
# ...
postTrigger: next # overrides default behavior
```
# Examples
One **Run** with **default behavior** (no post-Check behavior explicitly defined)
```mermaid
flowchart TB
subgraph spam ["(Run) Spam"]
b1["(Check) self-promotion"] -- "postFail: next" --> b2
b2["(Check) repeat spam"] -- "postFail: next" --> b3
b3["(Check) Good user"]
end
b1 -- "postTrigger: nextRun" --> finish
b2 -- "postTrigger: nextRun" --> finish
b3 -- "postFail: next" --> finish
b3 -- "postTrigger: nextRun" --> finish
finish[Processing Finished]
```
Two **Runs** with **default behavior** (no post-Check behavior explicitly defined)
```mermaid
flowchart TB
subgraph flair ["(Run) Flairing"]
a1["(Check) Flair Submission based on history"]-- "postFail: next" -->a2
a2["(Check) Flair Submission based on user profile"] -- "postFail: next" --> a3
a3["(Check) Flair Submission based on self text"]
end
a1 -- "postTrigger: nextRun" --> b1
a2 -- "postTrigger: nextRun" --> b1
a3 -- "postFail: next" --> b1
a3 -- "postTrigger: nextRun" --> b1
subgraph spam ["(Run) Spam"]
b1["(Check) self-promotion"] -- "postFail: next" -->b2
b2["(Check) repeat spam"] -- "postFail: next" -->b3
b3["(Check) Good user"]
end
b1 -- "postTrigger: nextRun" --> finish
b2 -- "postTrigger: nextRun" --> finish
b3 -- "postFail: next" --> finish
b3 -- "postTrigger: nextRun" --> finish
finish[Processing Finished]
```

View File

@@ -0,0 +1,96 @@
runs:
- name: flairAndCategory
# Runs inherit the same filters as checks/rules/actions
# If these filters fail the Run is skipped and CM processes the next run in order
# authorIs:
# itemIs:
# Set the default behavior for check trigger/fail
# postTrigger:
# postFail:
# Defaults can also be set for check authorIs/itemIs
# same as at operator/subreddit level - any defined here will override "higher" defaults
# filterCriteriaDefaults:
checks:
- name: goodUserFlair
description: flair user if they have decent history in sub
kind: submission
authorIs:
exclude:
- flairText: 'Good User'
rules:
- kind: recentActivity
thresholds:
- threshold: '> 5'
karma: '> 10'
subreddits:
- mySubreddit
actions:
- kind: userflair
text: 'Good User'
# post-behavior after a check has run. Either the check is TRIGGERED or FAIL
# there are 4 possible behaviors for each post-behavior type:
#
# 'next' => Continue to next check in order
# 'nextRun' => Exit the current Run (skip all remaining Checks) and go to the next Run in order
# 'stop' => Exit the current Run and finish activity processing immediately (skip all remaining Runs)
# 'goto:run[.check]' => Specify a run[.check] to jump to. This can be anywhere in your config. CM will continue to process in order from the specified point.
#
# GOTO syntax --
# 'goto:normalFilters' => go to run "normalFilters"
# 'goto:normalFilters.myCheck' => go to run "normalFilters" and start at check "myCheck"
# 'goto:.goodUserFlair' => go to check 'goodUserFlair' IN THE SAME RUN currently processing
#
# this means if the check triggers then continue to 'good submission flair'
postTrigger: next # default is 'nextRun'
# postFail: # default is 'next'
- name: good submission flair
description: flair submission if from good user
kind: submission
authorIs:
include:
- flairText: 'Good User'
actions:
- kind: flair
text: 'Trusted Source'
- kind: approve
# this means if the check is triggered then stop processing the activity entirely
postTrigger: stop
- name: Determine Suspect
checks:
- name: is suspect
kind: submission
rules:
- kind: recentActivity
thresholds:
- subreddits:
- over_18: true
actions:
# do some actions
# if check is triggered then go to run 'suspectFilters'
postTrigger: 'goto:suspectFilters'
# if check is not triggered then go to run 'normalFilters'
postFail: 'goto:normalFilters'
- name: suspectFilters
postTrigger: stop
authorIs:
exclude:
- flairText: 'Good User'
checks:
# some checks for users that are suspicious
- name: normalFilters
authorIs:
exclude:
- flairText: 'Good User'
checks:
# some checks for general activities

View File

@@ -1,75 +1,79 @@
{
"checks": [
"runs": [
{
"name": "Auto Remove SP Karma",
"description": "Remove submission because author has self-promo >10% and posted in karma subs recently",
"kind": "submission",
"rules": [
// named rules can be referenced at any point in the configuration (where they occur does not matter)
// and can be used in any Check
// Note: rules do not transfer between subreddit configurations
"freekarmasub",
"checks": [
{
"name": "attr10all",
"kind": "attribution",
"criteria": [
"name": "Auto Remove SP Karma",
"description": "Remove submission because author has self-promo >10% and posted in karma subs recently",
"kind": "submission",
"rules": [
// named rules can be referenced at any point in the configuration (where they occur does not matter)
// and can be used in any Check
// Note: rules do not transfer between subreddit configurations
"freekarmasub",
{
"threshold": "> 10%",
"window": "90 days"
"name": "attr10all",
"kind": "attribution",
"criteria": [
{
"threshold": "> 10%",
"window": "90 days"
},
{
"threshold": "> 10%",
"window": 100
}
],
}
],
"actions": [
{
"kind": "remove"
},
{
"threshold": "> 10%",
"window": 100
"kind": "comment",
"content": "Your submission was removed because you are over reddit's threshold for self-promotion and recently posted this content in a karma sub"
}
],
}
],
"actions": [
{
"kind": "remove"
]
},
{
"kind": "comment",
"content": "Your submission was removed because you are over reddit's threshold for self-promotion and recently posted this content in a karma sub"
}
]
},
{
"name": "Free Karma On Submission Alert",
"description": "Check if author has posted this submission in 'freekarma' subreddits",
"kind": "submission",
"rules": [
{
// rules can be re-used throughout a configuration by referencing them by name
//
// The rule name itself can only contain spaces, hyphens and underscores
// The value used to reference it will have all of these removed, and lower-cased
//
// so to reference this rule use the value 'freekarmasub'
"name": "Free_Karma-SUB",
"kind": "recentActivity",
"lookAt": "submissions",
"useSubmissionAsReference":true,
"thresholds": [
"name": "Free Karma On Submission Alert",
"description": "Check if author has posted this submission in 'freekarma' subreddits",
"kind": "submission",
"rules": [
{
"threshold": ">= 1",
"subreddits": [
"DeFreeKarma",
"FreeKarma4U",
"FreeKarma4You",
"upvote"
]
// rules can be re-used throughout a configuration by referencing them by name
//
// The rule name itself can only contain spaces, hyphens and underscores
// The value used to reference it will have all of these removed, and lower-cased
//
// so to reference this rule use the value 'freekarmasub'
"name": "Free_Karma-SUB",
"kind": "recentActivity",
"lookAt": "submissions",
"useSubmissionAsReference":true,
"thresholds": [
{
"threshold": ">= 1",
"subreddits": [
"DeFreeKarma",
"FreeKarma4U",
"FreeKarma4You",
"upvote"
]
}
],
"window": "7 days"
}
],
"window": "7 days"
}
],
"actions": [
{
"kind": "report",
"content": "Submission posted {{rules.freekarmasub.totalCount}} times in karma {{rules.freekarmasub.subCount}} subs over {{rules.freekarmasub.window}}: {{rules.freekarmasub.subSummary}}"
}
"actions": [
{
"kind": "report",
"content": "Submission posted {{rules.freekarmasub.totalCount}} times in karma {{rules.freekarmasub.subCount}} subs over {{rules.freekarmasub.window}}: {{rules.freekarmasub.subSummary}}"
}
]
},
]
},
}
]
}

View File

@@ -1,52 +1,53 @@
checks:
- name: Auto Remove SP Karma
description: >-
Remove submission because author has self-promo >10% and posted in karma
subs recently
kind: submission
rules:
# named rules can be referenced at any point in the configuration (where they occur does not matter)
# and can be used in any Check
# Note: rules do not transfer between subreddit configurations
- freekarmasub
- name: attr10all
kind: attribution
criteria:
- threshold: '> 10%'
window: 90 days
- threshold: '> 10%'
window: 100
actions:
- kind: remove
- kind: comment
content: >-
Your submission was removed because you are over reddit's threshold
for self-promotion and recently posted this content in a karma sub
- name: Free Karma On Submission Alert
description: Check if author has posted this submission in 'freekarma' subreddits
kind: submission
rules:
# rules can be re-used throughout a configuration by referencing them by name
#
# The rule name itself can only contain spaces, hyphens and underscores
# The value used to reference it will have all of these removed, and lower-cased
#
# so to reference this rule use the value 'freekarmasub'
- name: Free_Karma-SUB
kind: recentActivity
lookAt: submissions
useSubmissionAsReference: true
thresholds:
- threshold: '>= 1'
subreddits:
- DeFreeKarma
- FreeKarma4U
- FreeKarma4You
- upvote
window: 7 days
actions:
- kind: report
content: >-
Submission posted {{rules.freekarmasub.totalCount}} times in karma
{{rules.freekarmasub.subCount}} subs over
{{rules.freekarmasub.window}}: {{rules.freekarmasub.subSummary}}
runs:
- checks:
- name: Auto Remove SP Karma
description: >-
Remove submission because author has self-promo >10% and posted in karma
subs recently
kind: submission
rules:
# named rules can be referenced at any point in the configuration (where they occur does not matter)
# and can be used in any Check
# Note: rules do not transfer between subreddit configurations
- freekarmasub
- name: attr10all
kind: attribution
criteria:
- threshold: '> 10%'
window: 90 days
- threshold: '> 10%'
window: 100
actions:
- kind: remove
- kind: comment
content: >-
Your submission was removed because you are over reddit's threshold
for self-promotion and recently posted this content in a karma sub
- name: Free Karma On Submission Alert
description: Check if author has posted this submission in 'freekarma' subreddits
kind: submission
rules:
# rules can be re-used throughout a configuration by referencing them by name
#
# The rule name itself can only contain spaces, hyphens and underscores
# The value used to reference it will have all of these removed, and lower-cased
#
# so to reference this rule use the value 'freekarmasub'
- name: Free_Karma-SUB
kind: recentActivity
lookAt: submissions
useSubmissionAsReference: true
thresholds:
- threshold: '>= 1'
subreddits:
- DeFreeKarma
- FreeKarma4U
- FreeKarma4You
- upvote
window: 7 days
actions:
- kind: report
content: >-
Submission posted {{rules.freekarmasub.totalCount}} times in karma
{{rules.freekarmasub.subCount}} subs over
{{rules.freekarmasub.window}}: {{rules.freekarmasub.subSummary}}

View File

@@ -1,84 +1,88 @@
{
"checks": [
"runs": [
{
"name": "Self Promo All or low comment",
"description": "SP >10% of all activities or >10% of submissions with low comment engagement",
"kind": "submission",
"rules": [
"checks": [
{
// this attribution rule is looking at all activities
//
// we want want this one rule to trigger the check because >10% of all activity (submission AND comments) is a good requirement
"name": "attr10all",
"kind": "attribution",
"criteria": [
{
"threshold": "> 10%",
"window": "90 days"
},
{
"threshold": "> 10%",
"window": 100
}
],
},
{
// this is a **Rule Set**
//
// it is made up of "nested" rules with a pass condition (AND/OR)
// if the nested rules pass the condition then the Rule Set triggers the Check
//
// AND = all nested rules must be triggered to make the Rule Set trigger
// AND = any of the nested Rules will be the Rule Set trigger
"condition": "AND",
// in this check we use an Attribution >10% on ONLY submissions, which is a lower requirement then the above attribution rule
// and combine it with a History rule looking for low comment engagement
// to make a "higher" requirement Rule Set our of two low requirement Rules
"name": "Self Promo All or low comment",
"description": "SP >10% of all activities or >10% of submissions with low comment engagement",
"kind": "submission",
"rules": [
{
"name": "attr20sub",
// this attribution rule is looking at all activities
//
// we want want this one rule to trigger the check because >10% of all activity (submission AND comments) is a good requirement
"name": "attr10all",
"kind": "attribution",
"criteria": [
{
"threshold": "> 10%",
"thresholdOn": "submissions",
"window": "90 days"
},
{
"threshold": "> 10%",
"thresholdOn": "submissions",
"window": 100
}
],
"lookAt": "media"
},
{
"name": "lowOrOpComm",
"kind": "history",
"criteriaJoin": "OR",
"criteria": [
// this is a **Rule Set**
//
// it is made up of "nested" rules with a pass condition (AND/OR)
// if the nested rules pass the condition then the Rule Set triggers the Check
//
// AND = all nested rules must be triggered to make the Rule Set trigger
// AND = any of the nested Rules will be the Rule Set trigger
"condition": "AND",
// in this check we use an Attribution >10% on ONLY submissions, which is a lower requirement then the above attribution rule
// and combine it with a History rule looking for low comment engagement
// to make a "higher" requirement Rule Set our of two low requirement Rules
"rules": [
{
"window": "90 days",
"comment": "< 50%"
"name": "attr20sub",
"kind": "attribution",
"criteria": [
{
"threshold": "> 10%",
"thresholdOn": "submissions",
"window": "90 days"
},
{
"threshold": "> 10%",
"thresholdOn": "submissions",
"window": 100
}
],
"lookAt": "media"
},
{
"window": "90 days",
"comment": "> 40% OP"
"name": "lowOrOpComm",
"kind": "history",
"criteriaJoin": "OR",
"criteria": [
{
"window": "90 days",
"comment": "< 50%"
},
{
"window": "90 days",
"comment": "> 40% OP"
}
]
}
]
}
],
"actions": [
{
"kind": "remove"
},
{
"kind": "comment",
"content": "Your submission was removed because you are over reddit's threshold for self-promotion or exhibit low comment engagement"
}
]
}
],
"actions": [
{
"kind": "remove"
},
{
"kind": "comment",
"content": "Your submission was removed because you are over reddit's threshold for self-promotion or exhibit low comment engagement"
}
]
},
],
}
]
}

View File

@@ -1,53 +1,54 @@
checks:
- name: Self Promo All or low comment
description: >-
SP >10% of all activities or >10% of submissions with low comment
engagement
kind: submission
rules:
# this attribution rule is looking at all activities
#
# we want want this one rule to trigger the check because >10% of all activity (submission AND comments) is a good requirement
- name: attr10all
kind: attribution
criteria:
- threshold: '> 10%'
window: 90 days
- threshold: '> 10%'
window: 100
# this is a RULE SET
#
# it is made up of "nested" rules with a pass condition (AND/OR)
# if the nested rules pass the condition then the Rule Set triggers the Check
#
# AND = all nested rules must be triggered to make the Rule Set trigger
# AND = any of the nested Rules will be the Rule Set trigger
- condition: AND
# in this check we use an Attribution >10% on ONLY submissions, which is a lower requirement then the above attribution rule
# and combine it with a History rule looking for low comment engagement
# to make a "higher" requirement Rule Set our of two low requirement Rules
runs:
- checks:
- name: Self Promo All or low comment
description: >-
SP >10% of all activities or >10% of submissions with low comment
engagement
kind: submission
rules:
- name: attr20sub
# this attribution rule is looking at all activities
#
# we want want this one rule to trigger the check because >10% of all activity (submission AND comments) is a good requirement
- name: attr10all
kind: attribution
criteria:
- threshold: '> 10%'
thresholdOn: submissions
window: 90 days
- threshold: '> 10%'
thresholdOn: submissions
window: 100
lookAt: media
- name: lowOrOpComm
kind: history
criteriaJoin: OR
criteria:
- window: 90 days
comment: < 50%
- window: 90 days
comment: '> 40% OP'
actions:
- kind: remove
- kind: comment
content: >-
Your submission was removed because you are over reddit's threshold
for self-promotion or exhibit low comment engagement
# this is a RULE SET
#
# it is made up of "nested" rules with a pass condition (AND/OR)
# if the nested rules pass the condition then the Rule Set triggers the Check
#
# AND = all nested rules must be triggered to make the Rule Set trigger
# AND = any of the nested Rules will be the Rule Set trigger
- condition: AND
# in this check we use an Attribution >10% on ONLY submissions, which is a lower requirement then the above attribution rule
# and combine it with a History rule looking for low comment engagement
# to make a "higher" requirement Rule Set our of two low requirement Rules
rules:
- name: attr20sub
kind: attribution
criteria:
- threshold: '> 10%'
thresholdOn: submissions
window: 90 days
- threshold: '> 10%'
thresholdOn: submissions
window: 100
lookAt: media
- name: lowOrOpComm
kind: history
criteriaJoin: OR
criteria:
- window: 90 days
comment: < 50%
- window: 90 days
comment: '> 40% OP'
actions:
- kind: remove
- kind: comment
content: >-
Your submission was removed because you are over reddit's threshold
for self-promotion or exhibit low comment engagement

View File

@@ -1,37 +1,41 @@
{
"checks": [
"runs": [
{
"name": "Self Promo Activities",
"description": "Check if any of Author's aggregated submission origins are >10% of entire history",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
"checks": [
{
"name": "attr10all",
"kind": "attribution",
// criteria defaults to OR -- so either of these criteria will trigger the rule
"criteria": [
"name": "Self Promo Activities",
"description": "Check if any of Author's aggregated submission origins are >10% of entire history",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
{
// threshold can be a percent or an absolute number
"threshold": "> 10%",
// The default is "all" -- calculate percentage of entire history (submissions & comments)
// "thresholdOn": "all",
"name": "attr10all",
"kind": "attribution",
// criteria defaults to OR -- so either of these criteria will trigger the rule
"criteria": [
{
// threshold can be a percent or an absolute number
"threshold": "> 10%",
// The default is "all" -- calculate percentage of entire history (submissions & comments)
// "thresholdOn": "all",
// look at last 90 days of Author's activities (comments and submissions)
"window": "90 days"
},
{
"threshold": "> 10%",
// look at Author's last 100 activities (comments and submissions)
"window": 100
// look at last 90 days of Author's activities (comments and submissions)
"window": "90 days"
},
{
"threshold": "> 10%",
// look at Author's last 100 activities (comments and submissions)
"window": 100
}
],
}
],
}
],
"actions": [
{
"kind": "report",
"content": "{{rules.attr10all.largestPercent}}% of {{rules.attr10all.activityTotal}} items over {{rules.attr10all.window}}"
"actions": [
{
"kind": "report",
"content": "{{rules.attr10all.largestPercent}}% of {{rules.attr10all.activityTotal}} items over {{rules.attr10all.window}}"
}
]
}
]
}

View File

@@ -1,27 +1,28 @@
checks:
- name: Self Promo Activities
description: >-
Check if any of Author's aggregated submission origins are >10% of entire
history
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: attr10all
kind: attribution
# criteria defaults to OR -- so either of these criteria will trigger the rule
criteria:
- threshold: '> 10%' # threshold can be a percent or an absolute number
# The default is "all" -- calculate percentage of entire history (submissions & comments)
#thresholdOn: all
#
# look at last 90 days of Author's activities (comments and submissions)
window: 90 days
- threshold: '> 10%'
# look at Author's last 100 activities (comments and submissions)
window: 100
actions:
- kind: report
content: >-
{{rules.attr10all.largestPercent}}% of
{{rules.attr10all.activityTotal}} items over
{{rules.attr10all.window}}
runs:
- checks:
- name: Self Promo Activities
description: >-
Check if any of Author's aggregated submission origins are >10% of entire
history
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: attr10all
kind: attribution
# criteria defaults to OR -- so either of these criteria will trigger the rule
criteria:
- threshold: '> 10%' # threshold can be a percent or an absolute number
# The default is "all" -- calculate percentage of entire history (submissions & comments)
#thresholdOn: all
#
# look at last 90 days of Author's activities (comments and submissions)
window: 90 days
- threshold: '> 10%'
# look at Author's last 100 activities (comments and submissions)
window: 100
actions:
- kind: report
content: >-
{{rules.attr10all.largestPercent}}% of
{{rules.attr10all.activityTotal}} items over
{{rules.attr10all.window}}

View File

@@ -1,24 +1,25 @@
checks:
- name: Self Promo Submissions
description: >-
Check if any of Author's aggregated submission origins are >10% of their
submissions
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: attr10sub
kind: attribution
# criteria defaults to OR -- so either of these criteria will trigger the rule
criteria:
- threshold: '> 10%' # threshold can be a percent or an absolute number
thresholdOn: submissions # calculate percentage of submissions, rather than entire history (submissions & comments)
window: 90 days # look at last 90 days of Author's activities (comments and submissions)
- threshold: '> 10%'
thresholdOn: submissions
window: 100 # look at Author's last 100 activities (comments and submissions)
actions:
- kind: report
content: >-
{{rules.attr10sub.largestPercent}}% of
{{rules.attr10sub.activityTotal}} items over
{{rules.attr10sub.window}}
runs:
- checks:
- name: Self Promo Submissions
description: >-
Check if any of Author's aggregated submission origins are >10% of their
submissions
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: attr10sub
kind: attribution
# criteria defaults to OR -- so either of these criteria will trigger the rule
criteria:
- threshold: '> 10%' # threshold can be a percent or an absolute number
thresholdOn: submissions # calculate percentage of submissions, rather than entire history (submissions & comments)
window: 90 days # look at last 90 days of Author's activities (comments and submissions)
- threshold: '> 10%'
thresholdOn: submissions
window: 100 # look at Author's last 100 activities (comments and submissions)
actions:
- kind: report
content: >-
{{rules.attr10sub.largestPercent}}% of
{{rules.attr10sub.activityTotal}} items over
{{rules.attr10sub.window}}

View File

@@ -1,38 +1,42 @@
{
"checks": [
"runs": [
{
"name": "Self Promo Submissions",
"description": "Check if any of Author's aggregated submission origins are >10% of their submissions",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
"checks": [
{
"name": "attr10sub",
"kind": "attribution",
// criteria defaults to OR -- so either of these criteria will trigger the rule
"criteria": [
"name": "Self Promo Submissions",
"description": "Check if any of Author's aggregated submission origins are >10% of their submissions",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
{
// threshold can be a percent or an absolute number
"threshold": "> 10%",
// calculate percentage of submissions, rather than entire history (submissions & comments)
"thresholdOn": "submissions",
"name": "attr10sub",
"kind": "attribution",
// criteria defaults to OR -- so either of these criteria will trigger the rule
"criteria": [
{
// threshold can be a percent or an absolute number
"threshold": "> 10%",
// calculate percentage of submissions, rather than entire history (submissions & comments)
"thresholdOn": "submissions",
// look at last 90 days of Author's activities (comments and submissions)
"window": "90 days"
},
{
"threshold": "> 10%",
"thresholdOn": "submissions",
// look at Author's last 100 activities (comments and submissions)
"window": 100
// look at last 90 days of Author's activities (comments and submissions)
"window": "90 days"
},
{
"threshold": "> 10%",
"thresholdOn": "submissions",
// look at Author's last 100 activities (comments and submissions)
"window": 100
}
],
}
],
}
],
"actions": [
{
"kind": "report",
"content": "{{rules.attr10sub.largestPercent}}% of {{rules.attr10sub.activityTotal}} items over {{rules.attr10sub.window}}"
"actions": [
{
"kind": "report",
"content": "{{rules.attr10sub.largestPercent}}% of {{rules.attr10sub.activityTotal}} items over {{rules.attr10sub.window}}"
}
]
}
]
}

View File

@@ -1,67 +1,71 @@
{
"checks": [
"runs": [
{
"name": "Karma/Meme Sub Activity",
"description": "Report on karma sub activity or meme sub activity if user isn't a memelord",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
"checks": [
{
"name": "freekarma",
"kind": "recentActivity",
"lookAt": "submissions",
"thresholds": [
"name": "Karma/Meme Sub Activity",
"description": "Report on karma sub activity or meme sub activity if user isn't a memelord",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
{
"threshold": ">= 1",
"subreddits": [
"DeFreeKarma",
"FreeKarma4U",
]
}
],
"window": "7 days"
},
{
"name": "noobmemer",
"kind": "recentActivity",
// authors filter will be checked before a rule is run. If anything passes then the Rule is skipped -- it is not failed or triggered.
// if *all* Rules for a Check are skipped due to authors filter then the Check will fail
"authorIs": {
// each property (include/exclude) can contain multiple AuthorCriteria
// if any AuthorCriteria passes its test the Rule is skipped
//
// for an AuthorCriteria to pass all properties present on it must pass
//
// if "include" is present it will always run and exclude will be skipped
// "include:" []
"exclude": [
// for this to pass the Author of the Submission must not have the flair "Supreme Memer" and have the name "user1" or "user2"
{
"flairText": ["Supreme Memer"],
"names": ["user1","user2"]
"name": "freekarma",
"kind": "recentActivity",
"lookAt": "submissions",
"thresholds": [
{
"threshold": ">= 1",
"subreddits": [
"DeFreeKarma",
"FreeKarma4U",
]
}
],
"window": "7 days"
},
{
"name": "noobmemer",
"kind": "recentActivity",
// authors filter will be checked before a rule is run. If anything passes then the Rule is skipped -- it is not failed or triggered.
// if *all* Rules for a Check are skipped due to authors filter then the Check will fail
"authorIs": {
// each property (include/exclude) can contain multiple AuthorCriteria
// if any AuthorCriteria passes its test the Rule is skipped
//
// for an AuthorCriteria to pass all properties present on it must pass
//
// if "include" is present it will always run and exclude will be skipped
// "include:" []
"exclude": [
// for this to pass the Author of the Submission must not have the flair "Supreme Memer" and have the name "user1" or "user2"
{
"flairText": ["Supreme Memer"],
"names": ["user1","user2"]
},
{
// for this to pass the Author of the Submission must not have the flair "Decent Memer"
"flairText": ["Decent Memer"]
}
]
},
{
// for this to pass the Author of the Submission must not have the flair "Decent Memer"
"flairText": ["Decent Memer"]
}
]
},
"lookAt": "submissions",
"thresholds": [
{
"threshold": ">= 1",
"subreddits": [
"dankmemes",
]
"lookAt": "submissions",
"thresholds": [
{
"threshold": ">= 1",
"subreddits": [
"dankmemes",
]
}
],
"window": "7 days"
}
],
"window": "7 days"
}
],
"actions": [
{
"kind": "report",
"content": "Author has posted in free karma sub, or in /r/dankmemes and does not have meme flair in this subreddit"
"actions": [
{
"kind": "report",
"content": "Author has posted in free karma sub, or in /r/dankmemes and does not have meme flair in this subreddit"
}
]
}
]
}

View File

@@ -1,48 +1,49 @@
checks:
- name: Karma/Meme Sub Activity
description: Report on karma sub activity or meme sub activity if user isn't a memelord
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: freekarma
kind: recentActivity
lookAt: submissions
thresholds:
- threshold: '>= 1'
subreddits:
- DeFreeKarma
- FreeKarma4U
window: 7 days
- name: noobmemer
kind: recentActivity
# authors filter will be checked before a rule is run. If anything passes then the Rule is skipped -- it is not failed or triggered.
# if *all* Rules for a Check are skipped due to authors filter then the Check will fail
authorIs:
# each property (include/exclude) can contain multiple AuthorCriteria
# if any AuthorCriteria passes its test the Rule is skipped
#
# for an AuthorCriteria to pass all properties present on it must pass
#
# if include is present it will always run and exclude will be skipped
#-include:
exclude:
# for this to pass the Author of the Submission must not have the flair "Supreme Memer" and have the name "user1" or "user2"
- flairText:
- Supreme Memer
names:
- user1
- user2
# for this to pass the Author of the Submission must not have the flair "Decent Memer"
- flairText:
- Decent Memer
lookAt: submissions
thresholds:
- threshold: '>= 1'
subreddits:
- dankmemes
window: 7 days
actions:
- kind: report
content: >-
Author has posted in free karma sub, or in /r/dankmemes and does not
have meme flair in this subreddit
runs:
- checks:
- name: Karma/Meme Sub Activity
description: Report on karma sub activity or meme sub activity if user isn't a memelord
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: freekarma
kind: recentActivity
lookAt: submissions
thresholds:
- threshold: '>= 1'
subreddits:
- DeFreeKarma
- FreeKarma4U
window: 7 days
- name: noobmemer
kind: recentActivity
# authors filter will be checked before a rule is run. If anything passes then the Rule is skipped -- it is not failed or triggered.
# if *all* Rules for a Check are skipped due to authors filter then the Check will fail
authorIs:
# each property (include/exclude) can contain multiple AuthorCriteria
# if any AuthorCriteria passes its test the Rule is skipped
#
# for an AuthorCriteria to pass all properties present on it must pass
#
# if include is present it will always run and exclude will be skipped
#-include:
exclude:
# for this to pass the Author of the Submission must not have the flair "Supreme Memer" and have the name "user1" or "user2"
- flairText:
- Supreme Memer
names:
- user1
- user2
# for this to pass the Author of the Submission must not have the flair "Decent Memer"
- flairText:
- Decent Memer
lookAt: submissions
thresholds:
- threshold: '>= 1'
subreddits:
- dankmemes
window: 7 days
actions:
- kind: report
content: >-
Author has posted in free karma sub, or in /r/dankmemes and does not
have meme flair in this subreddit

View File

@@ -1,28 +1,32 @@
{
"checks": [
"runs": [
{
"name": "Flair New User Sub",
"description": "Flair submission as sketchy if user does not have vet flair",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
"checks": [
{
"name": "newflair",
"kind": "author",
// rule will trigger if Author does not have "vet" flair text
"exclude": [
"name": "Flair New User Sub",
"description": "Flair submission as sketchy if user does not have vet flair",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
{
"flairText": ["vet"]
"name": "newflair",
"kind": "author",
// rule will trigger if Author does not have "vet" flair text
"exclude": [
{
"flairText": ["vet"]
}
]
}
],
"actions": [
{
"kind": "flair",
"text": "New User",
"css": "orange"
}
]
}
],
"actions": [
{
"kind": "flair",
"text": "New User",
"css": "orange"
}
]
}
]

View File

@@ -1,16 +1,17 @@
checks:
- name: Flair New User Sub
description: Flair submission as sketchy if user does not have vet flair
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: newflair
kind: author
# rule will trigger if Author does not have "vet" flair text
exclude:
- flairText:
- vet
actions:
- kind: flair
text: New User
css: orange
runs:
- checks:
- name: Flair New User Sub
description: Flair submission as sketchy if user does not have vet flair
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: newflair
kind: author
# rule will trigger if Author does not have "vet" flair text
exclude:
- flairText:
- vet
actions:
- kind: flair
text: New User
css: orange

View File

@@ -1,28 +1,32 @@
{
"checks": [
"runs": [
{
"name": "Flair Vetted User Submission",
"description": "Flair submission as Approved if user has vet flair",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
"checks": [
{
"name": "newflair",
"kind": "author",
// rule will trigger if Author has "vet" flair text
"include": [
"name": "Flair Vetted User Submission",
"description": "Flair submission as Approved if user has vet flair",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
{
"flairText": ["vet"]
"name": "newflair",
"kind": "author",
// rule will trigger if Author has "vet" flair text
"include": [
{
"flairText": ["vet"]
}
]
}
],
"actions": [
{
"kind": "flair",
"text": "Vetted",
"css": "green"
}
]
}
],
"actions": [
{
"kind": "flair",
"text": "Vetted",
"css": "green"
}
]
}
]

View File

@@ -1,16 +1,17 @@
checks:
- name: Flair Vetted User Submission
description: Flair submission as Approved if user has vet flair
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: newflair
kind: author
# rule will trigger if Author has "vet" flair text
include:
- flairText:
- vet
actions:
- kind: flair
text: Vetted
css: green
runs:
- checks:
- name: Flair Vetted User Submission
description: Flair submission as Approved if user has vet flair
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: newflair
kind: author
# rule will trigger if Author has "vet" flair text
include:
- flairText:
- vet
actions:
- kind: flair
text: Vetted
css: green

View File

@@ -1,73 +1,77 @@
{
"checks": [
"runs": [
{
"name": "non-vetted karma/meme activity",
"description": "Report if Author has SP and has recent karma/meme sub activity and isn't vetted",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
"checks": [
{
// The Author Rule is best used in conjunction with other Rules --
// instead of having to write an AuthorFilter for every Rule where you want to skip it based on Author criteria
// you can write one Author Rule and make it fail on the required criteria
// so that the check fails and Actions don't run
"name": "nonvet",
"kind": "author",
"exclude": [
"name": "non-vetted karma/meme activity",
"description": "Report if Author has SP and has recent karma/meme sub activity and isn't vetted",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
{
"flairText": ["vet"]
}
]
},
{
"name": "attr10",
"kind": "attribution",
"criteria": [
{
"threshold": "> 10%",
"window": "90 days"
// The Author Rule is best used in conjunction with other Rules --
// instead of having to write an AuthorFilter for every Rule where you want to skip it based on Author criteria
// you can write one Author Rule and make it fail on the required criteria
// so that the check fails and Actions don't run
"name": "nonvet",
"kind": "author",
"exclude": [
{
"flairText": ["vet"]
}
]
},
{
"threshold": "> 10%",
"window": 100
}
],
},
{
"name": "freekarma",
"kind": "recentActivity",
"lookAt": "submissions",
"thresholds": [
"name": "attr10",
"kind": "attribution",
"criteria": [
{
"threshold": "> 10%",
"window": "90 days"
},
{
"threshold": "> 10%",
"window": 100
}
],
},
{
"threshold": ">= 1",
"subreddits": [
"DeFreeKarma",
"FreeKarma4U",
]
}
],
"window": "7 days"
},
{
"name": "memes",
"kind": "recentActivity",
"lookAt": "submissions",
"thresholds": [
"name": "freekarma",
"kind": "recentActivity",
"lookAt": "submissions",
"thresholds": [
{
"threshold": ">= 1",
"subreddits": [
"DeFreeKarma",
"FreeKarma4U",
]
}
],
"window": "7 days"
},
{
"threshold": ">= 3",
"subreddits": [
"dankmemes",
]
"name": "memes",
"kind": "recentActivity",
"lookAt": "submissions",
"thresholds": [
{
"threshold": ">= 3",
"subreddits": [
"dankmemes",
]
}
],
"window": "7 days"
}
],
"window": "7 days"
}
],
// will NOT run if the Author for this Submission has the flair "vet"
"actions": [
{
"kind": "report",
"content": "Author has posted in free karma or meme subs recently"
// will NOT run if the Author for this Submission has the flair "vet"
"actions": [
{
"kind": "report",
"content": "Author has posted in free karma or meme subs recently"
}
]
}
]
}

View File

@@ -1,45 +1,46 @@
checks:
- name: non-vetted karma/meme activity
description: >-
Report if Author has SP and has recent karma/meme sub activity and isn't
vetted
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
# The Author Rule is best used in conjunction with other Rules --
# instead of having to write an AuthorFilter for every Rule where you want to skip it based on Author criteria
# you can write one Author Rule and make it fail on the required criteria
# so that the check fails and Actions don't run
- name: nonvet
kind: author
exclude:
- flairText:
- vet
- name: attr10
kind: attribution
criteria:
- threshold: '> 10%'
window: 90 days
- threshold: '> 10%'
window: 100
- name: freekarma
kind: recentActivity
lookAt: submissions
thresholds:
- threshold: '>= 1'
subreddits:
- DeFreeKarma
- FreeKarma4U
window: 7 days
- name: memes
kind: recentActivity
lookAt: submissions
thresholds:
- threshold: '>= 3'
subreddits:
- dankmemes
window: 7 days
# will NOT run if the Author for this Submission has the flair "vet"
actions:
- kind: report
content: Author has posted in free karma or meme subs recently
runs:
- checks:
- name: non-vetted karma/meme activity
description: >-
Report if Author has SP and has recent karma/meme sub activity and isn't
vetted
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
# The Author Rule is best used in conjunction with other Rules --
# instead of having to write an AuthorFilter for every Rule where you want to skip it based on Author criteria
# you can write one Author Rule and make it fail on the required criteria
# so that the check fails and Actions don't run
- name: nonvet
kind: author
exclude:
- flairText:
- vet
- name: attr10
kind: attribution
criteria:
- threshold: '> 10%'
window: 90 days
- threshold: '> 10%'
window: 100
- name: freekarma
kind: recentActivity
lookAt: submissions
thresholds:
- threshold: '>= 1'
subreddits:
- DeFreeKarma
- FreeKarma4U
window: 7 days
- name: memes
kind: recentActivity
lookAt: submissions
thresholds:
- threshold: '>= 3'
subreddits:
- dankmemes
window: 7 days
# will NOT run if the Author for this Submission has the flair "vet"
actions:
- kind: report
content: Author has posted in free karma or meme subs recently

View File

@@ -1,29 +1,33 @@
{
"checks": [
"runs": [
{
"name": "Low Comment Engagement",
"description": "Check if Author is submitting much more than they comment",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
"checks": [
{
"name": "lowComm",
"kind": "history",
"criteria": [
"name": "Low Comment Engagement",
"description": "Check if Author is submitting much more than they comment",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
{
// look at last 90 days of Author's activities
"window": "90 days",
// trigger if less than 30% of their activities in this time period are comments
"comment": "< 30%"
},
"name": "lowComm",
"kind": "history",
"criteria": [
{
// look at last 90 days of Author's activities
"window": "90 days",
// trigger if less than 30% of their activities in this time period are comments
"comment": "< 30%"
},
]
}
],
"actions": [
{
"kind": "report",
"content": "Low engagement: comments were {{rules.lowcomm.commentPercent}} of {{rules.lowcomm.activityTotal}} over {{rules.lowcomm.window}}"
}
]
}
],
"actions": [
{
"kind": "report",
"content": "Low engagement: comments were {{rules.lowcomm.commentPercent}} of {{rules.lowcomm.activityTotal}} over {{rules.lowcomm.window}}"
}
]
}
]

View File

@@ -1,21 +1,22 @@
checks:
- name: Low Comment Engagement
description: Check if Author is submitting much more than they comment
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: lowComm
kind: history
criteria:
- comment: '< 30%'
window:
# get author's last 90 days of activities or 100 activities, whichever is less
duration: 90 days
count: 100
# trigger if less than 30% of their activities in this time period are comments
runs:
- checks:
- name: Low Comment Engagement
description: Check if Author is submitting much more than they comment
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: lowComm
kind: history
criteria:
- comment: '< 30%'
window:
# get author's last 90 days of activities or 100 activities, whichever is less
duration: 90 days
count: 100
# trigger if less than 30% of their activities in this time period are comments
actions:
- kind: report
content: >-
Low engagement: comments were {{rules.lowcomm.commentPercent}} of
{{rules.lowcomm.activityTotal}} over {{rules.lowcomm.window}}
actions:
- kind: report
content: >-
Low engagement: comments were {{rules.lowcomm.commentPercent}} of
{{rules.lowcomm.activityTotal}} over {{rules.lowcomm.window}}

View File

@@ -1,29 +1,33 @@
{
"checks": [
"runs": [
{
"name": "Engaging Own Content Only",
"description": "Check if Author is mostly engaging in their own content only",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
"checks": [
{
"name": "opOnly",
"kind": "history",
"criteria": [
"name": "Engaging Own Content Only",
"description": "Check if Author is mostly engaging in their own content only",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
{
// look at last 90 days of Author's activities
"window": "90 days",
// trigger if more than 60% of their activities in this time period are comments as OP
"comment": "> 60% OP"
},
"name": "opOnly",
"kind": "history",
"criteria": [
{
// look at last 90 days of Author's activities
"window": "90 days",
// trigger if more than 60% of their activities in this time period are comments as OP
"comment": "> 60% OP"
},
]
}
],
"actions": [
{
"kind": "report",
"content": "Selfish OP: {{rules.oponly.opPercent}} of {{rules.oponly.commentTotal}} comments over {{rules.oponly.window}} are as OP"
}
]
}
],
"actions": [
{
"kind": "report",
"content": "Selfish OP: {{rules.oponly.opPercent}} of {{rules.oponly.commentTotal}} comments over {{rules.oponly.window}} are as OP"
}
]
}
]

View File

@@ -1,22 +1,23 @@
checks:
- name: Engaging Own Content Only
description: Check if Author is mostly engaging in their own content only
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: opOnly
kind: history
criteria:
# trigger if more than 60% of their activities in this time period are comments as OP
- comment: '> 60% OP'
window:
# get author's last 90 days of activities or 100 activities, whichever is less
duration: 90 days
count: 100
runs:
- checks:
- name: Engaging Own Content Only
description: Check if Author is mostly engaging in their own content only
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: opOnly
kind: history
criteria:
# trigger if more than 60% of their activities in this time period are comments as OP
- comment: '> 60% OP'
window:
# get author's last 90 days of activities or 100 activities, whichever is less
duration: 90 days
count: 100
actions:
- kind: report
content: >-
Selfish OP: {{rules.oponly.opPercent}} of
{{rules.oponly.commentTotal}} comments over {{rules.oponly.window}}
are as OP
actions:
- kind: report
content: >-
Selfish OP: {{rules.oponly.opPercent}} of
{{rules.oponly.commentTotal}} comments over {{rules.oponly.window}}
are as OP

View File

@@ -1,66 +1,70 @@
{
"checks": [
"runs": [
{
"name": "Flair OF submitters",
"description": "Flair submission as OF if user does not have Verified flair and has certain keywords in their profile",
"kind": "submission",
"authorIs": {
"exclude": [
{
"flairCssClass": ["verified"]
}
]
},
"rules": [
"checks": [
{
"name": "OnlyFans strings in description",
"kind": "author",
"include": [
"name": "Flair OF submitters",
"description": "Flair submission as OF if user does not have Verified flair and has certain keywords in their profile",
"kind": "submission",
"authorIs": {
"exclude": [
{
"flairCssClass": ["verified"]
}
]
},
"rules": [
{
"description": [
"/(cashapp|allmylinks|linktr|onlyfans\\.com)/i",
"/(see|check|my|view) (out|of|onlyfans|kik|skype|insta|ig|profile|links)/i",
"my links",
"$"
"name": "OnlyFans strings in description",
"kind": "author",
"include": [
{
"description": [
"/(cashapp|allmylinks|linktr|onlyfans\\.com)/i",
"/(see|check|my|view) (out|of|onlyfans|kik|skype|insta|ig|profile|links)/i",
"my links",
"$"
]
}
]
}
]
}
],
"actions": [
{
"name": "Set OnlyFans user flair",
"kind": "userflair",
"flair_template_id": "put-your-onlyfans-user-flair-id-here"
},
{
"name":"Set OF Creator SUBMISSION flair",
"kind": "flair",
"flair_template_id": "put-your-onlyfans-post-flair-id-here"
}
]
},
{
"name": "Flair posts of OF submitters",
"description": "Flair submission as OnlyFans if submitter has OnlyFans userflair (override post flair set by submitter)",
"kind": "submission",
"rules": [
{
"name": "Include OF submitters",
"kind": "author",
"include": [
],
"actions": [
{
"flairCssClass": ["onlyfans"]
"name": "Set OnlyFans user flair",
"kind": "userflair",
"flair_template_id": "put-your-onlyfans-user-flair-id-here"
},
{
"name":"Set OF Creator SUBMISSION flair",
"kind": "flair",
"flair_template_id": "put-your-onlyfans-post-flair-id-here"
}
]
}
],
"actions": [
},
{
"name":"Set OF Creator SUBMISSION flair",
"kind": "flair",
"flair_template_id": "put-your-onlyfans-post-flair-id-here"
"name": "Flair posts of OF submitters",
"description": "Flair submission as OnlyFans if submitter has OnlyFans userflair (override post flair set by submitter)",
"kind": "submission",
"rules": [
{
"name": "Include OF submitters",
"kind": "author",
"include": [
{
"flairCssClass": ["onlyfans"]
}
]
}
],
"actions": [
{
"name":"Set OF Creator SUBMISSION flair",
"kind": "flair",
"flair_template_id": "put-your-onlyfans-post-flair-id-here"
}
]
}
]
}

View File

@@ -1,38 +1,39 @@
checks:
- name: Flair OF submitters
description: Flair submission as OF if user does not have Verified flair and has
certain keywords in their profile
kind: submission
authorIs:
exclude:
- flairCssClass:
- verified
rules:
- name: OnlyFans strings in description
kind: author
include:
- description:
- '/(cashapp|allmylinks|linktr|onlyfans\.com)/i'
- '/(see|check|my|view) (out|of|onlyfans|kik|skype|insta|ig|profile|links)/i'
- my links
- "$"
actions:
- name: Set OnlyFans user flair
kind: userflair
flair_template_id: put-your-onlyfans-user-flair-id-here
- name: Set OF Creator SUBMISSION flair
kind: flair
flair_template_id: put-your-onlyfans-post-flair-id-here
- name: Flair posts of OF submitters
description: Flair submission as OnlyFans if submitter has OnlyFans userflair (override post flair set by submitter)
kind: submission
rules:
- name: Include OF submitters
kind: author
include:
- flairCssClass:
- onlyfans
actions:
- name: Set OF Creator SUBMISSION flair
kind: flair
flair_template_id: put-your-onlyfans-post-flair-id-here
runs:
- checks:
- name: Flair OF submitters
description: Flair submission as OF if user does not have Verified flair and has
certain keywords in their profile
kind: submission
authorIs:
exclude:
- flairCssClass:
- verified
rules:
- name: OnlyFans strings in description
kind: author
include:
- description:
- '/(cashapp|allmylinks|linktr|onlyfans\.com)/i'
- '/(see|check|my|view) (out|of|onlyfans|kik|skype|insta|ig|profile|links)/i'
- my links
- "$"
actions:
- name: Set OnlyFans user flair
kind: userflair
flair_template_id: put-your-onlyfans-user-flair-id-here
- name: Set OF Creator SUBMISSION flair
kind: flair
flair_template_id: put-your-onlyfans-post-flair-id-here
- name: Flair posts of OF submitters
description: Flair submission as OnlyFans if submitter has OnlyFans userflair (override post flair set by submitter)
kind: submission
rules:
- name: Include OF submitters
kind: author
include:
- flairCssClass:
- onlyfans
actions:
- name: Set OF Creator SUBMISSION flair
kind: flair
flair_template_id: put-your-onlyfans-post-flair-id-here

View File

@@ -1,38 +1,42 @@
{
"checks": [
"runs": [
{
"name": "Free Karma Alert",
"description": "Check if author has posted in 'freekarma' subreddits",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
"checks": [
{
"name": "freekarma",
"kind": "recentActivity",
"useSubmissionAsReference": false,
// when `lookAt` is not present this rule will look for submissions and comments
// lookAt: "submissions"
// lookAt: "comments"
"thresholds": [
"name": "Free Karma Alert",
"description": "Check if author has posted in 'freekarma' subreddits",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
{
// for all subreddits, if the number of activities (sub/comment) is equal to or greater than 1 then the rule is triggered
"threshold": ">= 1",
"subreddits": [
"DeFreeKarma",
"FreeKarma4U",
"FreeKarma4You",
"upvote"
]
"name": "freekarma",
"kind": "recentActivity",
"useSubmissionAsReference": false,
// when `lookAt` is not present this rule will look for submissions and comments
// lookAt: "submissions"
// lookAt: "comments"
"thresholds": [
{
// for all subreddits, if the number of activities (sub/comment) is equal to or greater than 1 then the rule is triggered
"threshold": ">= 1",
"subreddits": [
"DeFreeKarma",
"FreeKarma4U",
"FreeKarma4You",
"upvote"
]
}
],
// will look at all of the Author's activities in the last 7 days
"window": "7 days"
}
],
// will look at all of the Author's activities in the last 7 days
"window": "7 days"
}
],
"actions": [
{
"kind": "report",
"content": "{{rules.freekarma.totalCount}} activities in karma {{rules.freekarma.subCount}} subs over {{rules.freekarma.window}}: {{rules.freekarma.subSummary}}"
"actions": [
{
"kind": "report",
"content": "{{rules.freekarma.totalCount}} activities in karma {{rules.freekarma.subCount}} subs over {{rules.freekarma.window}}: {{rules.freekarma.subSummary}}"
}
]
}
]
}

View File

@@ -1,27 +1,28 @@
checks:
- name: Free Karma Alert
description: Check if author has posted in 'freekarma' subreddits
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: freekarma
kind: recentActivity
# // when lookAt is not present this rule will look for submissions and comments
#lookAt: comments
useSubmissionAsReference: false
thresholds:
# if the number of activities (sub/comment) found CUMULATIVELY in the subreddits listed is
# equal to or greater than 1 then the rule is triggered
- threshold: '>= 1'
subreddits:
- DeFreeKarma
- FreeKarma4U
- FreeKarma4You
- upvote
window: 7 days
actions:
- kind: report
content: >-
{{rules.freekarma.totalCount}} activities in karma
{{rules.freekarma.subCount}} subs over {{rules.freekarma.window}}:
{{rules.freekarma.subSummary}}
runs:
- checks:
- name: Free Karma Alert
description: Check if author has posted in 'freekarma' subreddits
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: freekarma
kind: recentActivity
# // when lookAt is not present this rule will look for submissions and comments
#lookAt: comments
useSubmissionAsReference: false
thresholds:
# if the number of activities (sub/comment) found CUMULATIVELY in the subreddits listed is
# equal to or greater than 1 then the rule is triggered
- threshold: '>= 1'
subreddits:
- DeFreeKarma
- FreeKarma4U
- FreeKarma4You
- upvote
window: 7 days
actions:
- kind: report
content: >-
{{rules.freekarma.totalCount}} activities in karma
{{rules.freekarma.subCount}} subs over {{rules.freekarma.window}}:
{{rules.freekarma.subSummary}}

View File

@@ -1,39 +1,43 @@
{
"checks": [
"runs": [
{
"name": "Free Karma On Submission Alert",
"description": "Check if author has posted this submission in 'freekarma' subreddits",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
"checks": [
{
"name": "freekarmasub",
"kind": "recentActivity",
// rule will only look at Author's submissions in these subreddits
"lookAt": "submissions",
// rule will only look at Author's submissions in these subreddits that have the same content (link) as the submission this event was made on
// In simpler terms -- rule will only check to see if the same link the author just posted is also posted in these subreddits
"useSubmissionAsReference":true,
"thresholds": [
"name": "Free Karma On Submission Alert",
"description": "Check if author has posted this submission in 'freekarma' subreddits",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
{
// for all subreddits, if the number of activities (sub/comment) is equal to or greater than 1 then the rule is triggered
"threshold": ">= 1",
"subreddits": [
"DeFreeKarma",
"FreeKarma4U",
"FreeKarma4You",
"upvote"
]
"name": "freekarmasub",
"kind": "recentActivity",
// rule will only look at Author's submissions in these subreddits
"lookAt": "submissions",
// rule will only look at Author's submissions in these subreddits that have the same content (link) as the submission this event was made on
// In simpler terms -- rule will only check to see if the same link the author just posted is also posted in these subreddits
"useSubmissionAsReference":true,
"thresholds": [
{
// for all subreddits, if the number of activities (sub/comment) is equal to or greater than 1 then the rule is triggered
"threshold": ">= 1",
"subreddits": [
"DeFreeKarma",
"FreeKarma4U",
"FreeKarma4You",
"upvote"
]
}
],
// look at all of the Author's submissions in the last 7 days
"window": "7 days"
}
],
// look at all of the Author's submissions in the last 7 days
"window": "7 days"
}
],
"actions": [
{
"kind": "report",
"content": "Submission posted {{rules.freekarmasub.totalCount}} times in karma {{rules.freekarmasub.subCount}} subs over {{rules.freekarmasub.window}}: {{rules.freekarmasub.subSummary}}"
"actions": [
{
"kind": "report",
"content": "Submission posted {{rules.freekarmasub.totalCount}} times in karma {{rules.freekarmasub.subCount}} subs over {{rules.freekarmasub.window}}: {{rules.freekarmasub.subSummary}}"
}
]
}
]
}

View File

@@ -1,26 +1,27 @@
checks:
- name: Free Karma On Submission Alert
description: Check if author has posted this submission in 'freekarma' subreddits
kind: submission
rules:
- name: freekarmasub
kind: recentActivity
# rule will only look at Author's submissions in these subreddits
lookAt: submissions
# rule will only look at Author's submissions in these subreddits that have the same content (link) as the submission this event was made on
# In simpler terms -- rule will only check to see if the same link the author just posted is also posted in these subreddits
useSubmissionAsReference: true
thresholds:
- threshold: '>= 1'
subreddits:
- DeFreeKarma
- FreeKarma4U
- FreeKarma4You
- upvote
window: 7 days
actions:
- kind: report
content: >-
Submission posted {{rules.freekarmasub.totalCount}} times in karma
{{rules.freekarmasub.subCount}} subs over
{{rules.freekarmasub.window}}: {{rules.freekarmasub.subSummary}}
runs:
- checks:
- name: Free Karma On Submission Alert
description: Check if author has posted this submission in 'freekarma' subreddits
kind: submission
rules:
- name: freekarmasub
kind: recentActivity
# rule will only look at Author's submissions in these subreddits
lookAt: submissions
# rule will only look at Author's submissions in these subreddits that have the same content (link) as the submission this event was made on
# In simpler terms -- rule will only check to see if the same link the author just posted is also posted in these subreddits
useSubmissionAsReference: true
thresholds:
- threshold: '>= 1'
subreddits:
- DeFreeKarma
- FreeKarma4U
- FreeKarma4You
- upvote
window: 7 days
actions:
- kind: report
content: >-
Submission posted {{rules.freekarmasub.totalCount}} times in karma
{{rules.freekarmasub.subCount}} subs over
{{rules.freekarmasub.window}}: {{rules.freekarmasub.subSummary}}

View File

@@ -1,73 +1,77 @@
{
"checks": [
"runs": [
{
"name": "remove discord spam",
"notifyOnTrigger": true,
"description": "remove comments from users who are spamming discord links",
"kind": "comment",
"authorIs": {
"exclude": [
{
"isMod": true
}
]
},
"itemIs": [
"checks": [
{
"removed": false,
"approved": false,
}
],
"condition": "OR",
"rules": [
{
// set to false if you want to allow comments with a discord link ONLY IF
// the author doesn't have a history of spamming discord links
// -- basically allows one-off/organic discord links
"enable": true,
"name": "linkOnlySpam",
"kind": "regex",
"criteria": [
"name": "remove discord spam",
"notifyOnTrigger": true,
"description": "remove comments from users who are spamming discord links",
"kind": "comment",
"authorIs": {
"exclude": [
{
"isMod": true
}
]
},
"itemIs": [
{
"name": "only link",
"regex": "/^.*(discord\\.gg\\/[\\w\\d]+)$/i",
"removed": false,
"approved": false,
}
]
},
{
"condition": "AND",
],
"condition": "OR",
"rules": [
{
"name": "linkAnywhereSpam",
// set to false if you want to allow comments with a discord link ONLY IF
// the author doesn't have a history of spamming discord links
// -- basically allows one-off/organic discord links
"enable": true,
"name": "linkOnlySpam",
"kind": "regex",
"criteria": [
{
"name": "contains link anywhere",
"regex": "/^.*(discord\\.gg\\/[\\w\\d]+).*$/i",
"name": "only link",
"regex": "/^.*(discord\\.gg\\/[\\w\\d]+)$/i",
}
]
},
{
"name": "linkAnywhereHistoricalSpam",
"kind": "regex",
"criteria": [
"condition": "AND",
"rules": [
{
"name": "contains links anywhere historically",
"regex": "/^.*(discord\\.gg\\/[\\w\\d]+).*$/i",
"totalMatchThreshold": ">= 3",
"lookAt": "comments",
"window": 10
"name": "linkAnywhereSpam",
"kind": "regex",
"criteria": [
{
"name": "contains link anywhere",
"regex": "/^.*(discord\\.gg\\/[\\w\\d]+).*$/i",
}
]
},
{
"name": "linkAnywhereHistoricalSpam",
"kind": "regex",
"criteria": [
{
"name": "contains links anywhere historically",
"regex": "/^.*(discord\\.gg\\/[\\w\\d]+).*$/i",
"totalMatchThreshold": ">= 3",
"lookAt": "comments",
"window": 10
}
]
}
]
}
],
"actions": [
{
"kind": "remove"
}
]
}
],
"actions": [
{
"kind": "remove"
}
]
}
]
],
}

View File

@@ -1,36 +1,37 @@
checks:
- name: remove discord spam
notifyOnTrigger: true
description: remove comments from users who are spamming discord links
kind: comment
authorIs:
exclude:
- isMod: true
itemIs:
- removed: false
approved: false
condition: OR
rules:
- enable: true
name: linkOnlySpam
kind: regex
criteria:
- name: only link
regex: '/^.*(discord\.gg\/[\w\d]+)$/i'
- condition: AND
runs:
- checks:
- name: remove discord spam
notifyOnTrigger: true
description: remove comments from users who are spamming discord links
kind: comment
authorIs:
exclude:
- isMod: true
itemIs:
- removed: false
approved: false
condition: OR
rules:
- name: linkAnywhereSpam
- enable: true
name: linkOnlySpam
kind: regex
criteria:
- name: contains link anywhere
regex: '/^.*(discord\.gg\/[\w\d]+).*$/i'
- name: linkAnywhereHistoricalSpam
kind: regex
criteria:
- name: contains links anywhere historically
regex: '/^.*(discord\.gg\/[\w\d]+).*$/i'
totalMatchThreshold: '>= 3'
lookAt: comments
window: 10
actions:
- kind: remove
- name: only link
regex: '/^.*(discord\.gg\/[\w\d]+)$/i'
- condition: AND
rules:
- name: linkAnywhereSpam
kind: regex
criteria:
- name: contains link anywhere
regex: '/^.*(discord\.gg\/[\w\d]+).*$/i'
- name: linkAnywhereHistoricalSpam
kind: regex
criteria:
- name: contains links anywhere historically
regex: '/^.*(discord\.gg\/[\w\d]+).*$/i'
totalMatchThreshold: '>= 3'
lookAt: comments
window: 10
actions:
- kind: remove

View File

@@ -1,30 +1,34 @@
{
"checks": [
"runs": [
{
"name": "Burstpost Spam",
"description": "Check if Author is crossposting in short bursts",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
"checks": [
{
"name": "burstpost",
"kind": "repeatActivity",
// will only look at Submissions in Author's history that contain the same content (link) as the Submission this check was initiated by
"useSubmissionAsReference": true,
// the number of non-repeat activities (submissions or comments) to ignore between repeat submissions
"gapAllowance": 3,
// if the Author has posted this Submission 6 times, ignoring 3 non-repeat activities between each repeat, then this rule will trigger
"threshold": ">= 6",
// look at all of the Author's submissions in the last 7 days
"window": "7 days"
}
],
"actions": [
{
"kind": "report",
"content": "Author has burst-posted this link {{rules.burstpost.largestRepeat}} times over {{rules.burstpost.window}}"
"name": "Burstpost Spam",
"description": "Check if Author is crossposting in short bursts",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
{
"name": "burstpost",
"kind": "repeatActivity",
// will only look at Submissions in Author's history that contain the same content (link) as the Submission this check was initiated by
"useSubmissionAsReference": true,
// the number of non-repeat activities (submissions or comments) to ignore between repeat submissions
"gapAllowance": 3,
// if the Author has posted this Submission 6 times, ignoring 3 non-repeat activities between each repeat, then this rule will trigger
"threshold": ">= 6",
// look at all of the Author's submissions in the last 7 days
"window": "7 days"
}
],
"actions": [
{
"kind": "report",
"content": "Author has burst-posted this link {{rules.burstpost.largestRepeat}} times over {{rules.burstpost.window}}"
}
]
}
]
}
]
],
}

View File

@@ -1,23 +1,24 @@
checks:
- name: Burstpost Spam
description: Check if Author is crossposting in short bursts
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: burstpost
kind: repeatActivity
# will only look at Submissions in Author's history that contain the same content (link) as the Submission this check was initiated by
useSubmissionAsReference: true
# the number of non-repeat activities (submissions or comments) to ignore between repeat submissions
gapAllowance: 3
# if the Author has posted this Submission 6 times, ignoring 3 non-repeat activities between each repeat, then this rule will trigger
threshold: '>= 6'
# look at all of the Author's submissions in the last 7 days or 100 submissions
window:
duration: 7 days
count: 100
actions:
- kind: report
content: >-
Author has burst-posted this link {{rules.burstpost.largestRepeat}}
times over {{rules.burstpost.window}}
runs:
- checks:
- name: Burstpost Spam
description: Check if Author is crossposting in short bursts
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: burstpost
kind: repeatActivity
# will only look at Submissions in Author's history that contain the same content (link) as the Submission this check was initiated by
useSubmissionAsReference: true
# the number of non-repeat activities (submissions or comments) to ignore between repeat submissions
gapAllowance: 3
# if the Author has posted this Submission 6 times, ignoring 3 non-repeat activities between each repeat, then this rule will trigger
threshold: '>= 6'
# look at all of the Author's submissions in the last 7 days or 100 submissions
window:
duration: 7 days
count: 100
actions:
- kind: report
content: >-
Author has burst-posted this link {{rules.burstpost.largestRepeat}}
times over {{rules.burstpost.window}}

View File

@@ -1,26 +1,30 @@
{
"checks": [
"runs": [
{
"name": "Crosspost Spam",
"description": "Check if Author is spamming Submissions across subreddits",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
"checks": [
{
"name": "xpostspam",
"kind": "repeatActivity",
// will only look at Submissions in Author's history that contain the same content (link) as the Submission this check was initiated by
"useSubmissionAsReference": true,
// if the Author has posted this Submission 5 times consecutively then this rule will trigger
"threshold": ">= 5",
// look at all of the Author's submissions in the last 7 days
"window": "7 days"
}
],
"actions": [
{
"kind": "report",
"content": "Author has posted this link {{rules.xpostspam.largestRepeat}} times over {{rules.xpostspam.window}}"
"name": "Crosspost Spam",
"description": "Check if Author is spamming Submissions across subreddits",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
{
"name": "xpostspam",
"kind": "repeatActivity",
// will only look at Submissions in Author's history that contain the same content (link) as the Submission this check was initiated by
"useSubmissionAsReference": true,
// if the Author has posted this Submission 5 times consecutively then this rule will trigger
"threshold": ">= 5",
// look at all of the Author's submissions in the last 7 days
"window": "7 days"
}
],
"actions": [
{
"kind": "report",
"content": "Author has posted this link {{rules.xpostspam.largestRepeat}} times over {{rules.xpostspam.window}}"
}
]
}
]
}

View File

@@ -1,19 +1,20 @@
checks:
- name: Crosspost Spam
description: Check if Author is spamming Submissions across subreddits
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: xpostspam
kind: repeatActivity
# will only look at Submissions in Author's history that contain the same content (link) as the Submission this check was initiated by
useSubmissionAsReference: true
# if the Author has posted this Submission 5 times consecutively then this rule will trigger
threshold: '>= 5'
# look at all of the Author's submissions in the last 7 days
window: 7 days
actions:
- kind: report
content: >-
Author has posted this link {{rules.xpostspam.largestRepeat}} times
over {{rules.xpostspam.window}}
runs:
- checks:
- name: Crosspost Spam
description: Check if Author is spamming Submissions across subreddits
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: xpostspam
kind: repeatActivity
# will only look at Submissions in Author's history that contain the same content (link) as the Submission this check was initiated by
useSubmissionAsReference: true
# if the Author has posted this Submission 5 times consecutively then this rule will trigger
threshold: '>= 5'
# look at all of the Author's submissions in the last 7 days
window: 7 days
actions:
- kind: report
content: >-
Author has posted this link {{rules.xpostspam.largestRepeat}} times
over {{rules.xpostspam.window}}

View File

@@ -1,42 +1,46 @@
{
"polling": ["newComm"],
"checks": [
"runs": [
{
//
// Stop users who spam the same comment many times
//
// Remove a COMMENT if the user has crossposted it at least 4 times in recent history
//
"name": "low xp comment spam",
"description": "X-posted comment >=4x",
"kind": "comment",
"condition": "AND",
"rules": [
"checks": [
{
"name": "xPostLow",
"kind": "repeatActivity",
"gapAllowance": 2,
"threshold": ">= 4",
"window": {
"count": 50,
"duration": "6 months"
}
},
],
"actions": [
// remove this after confirming behavior is acceptable
{
"kind": "report",
"content": "Remove=> Posted same comment {{rules.xpostlow.largestRepeat}}x times"
},
//
//
{
"kind": "remove",
// remove the line below after confirming behavior is acceptable
"dryRun": true
//
// Stop users who spam the same comment many times
//
// Remove a COMMENT if the user has crossposted it at least 4 times in recent history
//
"name": "low xp comment spam",
"description": "X-posted comment >=4x",
"kind": "comment",
"condition": "AND",
"rules": [
{
"name": "xPostLow",
"kind": "repeatActivity",
"gapAllowance": 2,
"threshold": ">= 4",
"window": {
"count": 50,
"duration": "6 months"
}
},
],
"actions": [
// remove this after confirming behavior is acceptable
{
"kind": "report",
"content": "Remove=> Posted same comment {{rules.xpostlow.largestRepeat}}x times"
},
//
//
{
"kind": "remove",
// remove the line below after confirming behavior is acceptable
"dryRun": true
}
]
}
]
}
]
],
}

View File

@@ -1,25 +1,26 @@
polling:
- newComm
checks:
# Stop users who spam the same comment many times
- name: low xp comment spam
description: X-posted comment >=4x
kind: comment
condition: AND
rules:
- name: xPostLow
kind: repeatActivity
# number of "non-repeat" comments allowed between "repeat comments"
gapAllowance: 2
# greater or more than 4 repeat comments triggers this rule
threshold: '>= 4'
# retrieve either last 50 comments or 6 months' of history, whichever is less
window:
count: 50
duration: 6 months
actions:
- kind: report
enable: true
content: 'Remove => Posted same comment {{rules.xpostlow.largestRepeat}}x times'
- kind: remove
enable: true
runs:
- checks:
# Stop users who spam the same comment many times
- name: low xp comment spam
description: X-posted comment >=4x
kind: comment
condition: AND
rules:
- name: xPostLow
kind: repeatActivity
# number of "non-repeat" comments allowed between "repeat comments"
gapAllowance: 2
# greater or more than 4 repeat comments triggers this rule
threshold: '>= 4'
# retrieve either last 50 comments or 6 months' of history, whichever is less
window:
count: 50
duration: 6 months
actions:
- kind: report
enable: true
content: 'Remove => Posted same comment {{rules.xpostlow.largestRepeat}}x times'
- kind: remove
enable: true

View File

@@ -1,77 +1,81 @@
{
"polling": ["unmoderated"],
"checks": [
"runs": [
{
//
// Stop users who post low-effort, crossposted spam
//
// Remove a SUBMISSION if the user has crossposted it at least 4 times in recent history AND
// less than 50% of their activity is comments OR more than 40% of those comments are as OP (in the own submissions)
//
"name": "low xp spam and engagement",
"description": "X-posted 4x and low comment engagement",
"kind": "submission",
"itemIs": [
"checks": [
{
"removed": false
}
],
"condition": "AND",
"rules": [
{
"name": "xPostLow",
"kind": "repeatActivity",
"gapAllowance": 2,
"threshold": ">= 4",
"window": {
"count": 50,
"duration": "6 months"
}
},
{
"name": "lowOrOpComm",
"kind": "history",
"criteriaJoin": "OR",
"criteria": [
//
// Stop users who post low-effort, crossposted spam
//
// Remove a SUBMISSION if the user has crossposted it at least 4 times in recent history AND
// less than 50% of their activity is comments OR more than 40% of those comments are as OP (in the own submissions)
//
"name": "low xp spam and engagement",
"description": "X-posted 4x and low comment engagement",
"kind": "submission",
"itemIs": [
{
"removed": false
}
],
"condition": "AND",
"rules": [
{
"name": "xPostLow",
"kind": "repeatActivity",
"gapAllowance": 2,
"threshold": ">= 4",
"window": {
"count": 100,
"count": 50,
"duration": "6 months"
},
"comment": "< 50%"
}
},
{
"window": {
"count": 100,
"duration": "6 months"
},
"comment": "> 40% OP"
"name": "lowOrOpComm",
"kind": "history",
"criteriaJoin": "OR",
"criteria": [
{
"window": {
"count": 100,
"duration": "6 months"
},
"comment": "< 50%"
},
{
"window": {
"count": 100,
"duration": "6 months"
},
"comment": "> 40% OP"
}
]
}
],
"actions": [
// remove this after confirming behavior is acceptable
{
"kind": "report",
"content": "Remove=>{{rules.xpostlow.largestRepeat}} X-P => {{rules.loworopcomm.thresholdSummary}}"
},
//
//
{
"kind": "remove",
// remove the line below after confirming behavior is acceptable
"dryRun": true
},
// optionally remove "dryRun" from below if you want to leave a comment on removal
// PROTIP: the comment is bland, you should make it better
{
"kind": "comment",
"content": "Your submission has been removed because you cross-posted it {{rules.xpostlow.largestRepeat}} times and you have very low engagement outside of making submissions",
"distinguish": true,
"dryRun": true
}
]
}
],
"actions": [
// remove this after confirming behavior is acceptable
{
"kind": "report",
"content": "Remove=>{{rules.xpostlow.largestRepeat}} X-P => {{rules.loworopcomm.thresholdSummary}}"
},
//
//
{
"kind": "remove",
// remove the line below after confirming behavior is acceptable
"dryRun": true
},
// optionally remove "dryRun" from below if you want to leave a comment on removal
// PROTIP: the comment is bland, you should make it better
{
"kind": "comment",
"content": "Your submission has been removed because you cross-posted it {{rules.xpostlow.largestRepeat}} times and you have very low engagement outside of making submissions",
"distinguish": true,
"dryRun": true
}
]
}
]
],
}

View File

@@ -1,48 +1,49 @@
polling:
- unmoderated
checks:
# stop users who post low-effort, crossposted spam submissions
#
# Remove a SUBMISSION if the user has crossposted it at least 4 times in recent history AND
# less than 50% of their activity is comments OR more than 40% of those comments are as OP (in the own submissions)
- name: low xp spam and engagement
description: X-posted 4x and low comment engagement
kind: submission
itemIs:
- removed: false
condition: AND
rules:
- name: xPostLow
kind: repeatActivity
gapAllowance: 2
threshold: '>= 4'
window:
count: 50
duration: 6 months
- name: lowOrOpComm
kind: history
criteriaJoin: OR
criteria:
- window:
count: 100
runs:
- checks:
# stop users who post low-effort, crossposted spam submissions
#
# Remove a SUBMISSION if the user has crossposted it at least 4 times in recent history AND
# less than 50% of their activity is comments OR more than 40% of those comments are as OP (in the own submissions)
- name: low xp spam and engagement
description: X-posted 4x and low comment engagement
kind: submission
itemIs:
- removed: false
condition: AND
rules:
- name: xPostLow
kind: repeatActivity
gapAllowance: 2
threshold: '>= 4'
window:
count: 50
duration: 6 months
comment: < 50%
- window:
count: 100
duration: 6 months
comment: '> 40% OP'
actions:
- kind: report
enable: true
content: >-
Remove=>{{rules.xpostlow.largestRepeat}} X-P =>
{{rules.loworopcomm.thresholdSummary}}
- kind: remove
enable: true
- kind: comment
enable: true
content: >-
Your submission has been removed because you cross-posted it
{{rules.xpostlow.largestRepeat}} times and you have very low
engagement outside of making submissions
distinguish: true
- name: lowOrOpComm
kind: history
criteriaJoin: OR
criteria:
- window:
count: 100
duration: 6 months
comment: < 50%
- window:
count: 100
duration: 6 months
comment: '> 40% OP'
actions:
- kind: report
enable: true
content: >-
Remove=>{{rules.xpostlow.largestRepeat}} X-P =>
{{rules.loworopcomm.thresholdSummary}}
- kind: remove
enable: true
- kind: comment
enable: true
content: >-
Your submission has been removed because you cross-posted it
{{rules.xpostlow.largestRepeat}} times and you have very low
engagement outside of making submissions
distinguish: true

View File

@@ -1,75 +1,79 @@
{
"polling": ["newComm"],
"checks": [
"runs": [
{
"name": "ban discord only spammer",
"description": "ban a user who spams only a discord link many times historically",
"kind": "comment",
"condition": "AND",
"rules": [
"linkOnlySpam",
"linkAnywhereHistoricalSpam",
],
"actions": [
"checks": [
{
"kind": "remove"
},
{
"kind": "ban",
"content": "spamming discord links"
}
]
},
{
"name": "remove discord spam",
"description": "remove comments from users who only link to discord or mention discord link many times historically",
"kind": "comment",
"condition": "OR",
"rules": [
{
"name": "linkOnlySpam",
"kind": "regex",
"criteria": [
"name": "ban discord only spammer",
"description": "ban a user who spams only a discord link many times historically",
"kind": "comment",
"condition": "AND",
"rules": [
"linkOnlySpam",
"linkAnywhereHistoricalSpam",
],
"actions": [
{
"name": "only link",
"regex": "/^.*(discord\\.gg\\/[\\w\\d]+)$/i",
"kind": "remove"
},
{
"kind": "ban",
"content": "spamming discord links"
}
]
},
{
"condition": "AND",
"name": "remove discord spam",
"description": "remove comments from users who only link to discord or mention discord link many times historically",
"kind": "comment",
"condition": "OR",
"rules": [
{
"name": "linkAnywhereSpam",
"name": "linkOnlySpam",
"kind": "regex",
"criteria": [
{
"name": "contains link anywhere",
"regex": "/^.*(discord\\.gg\\/[\\w\\d]+).*$/i",
"name": "only link",
"regex": "/^.*(discord\\.gg\\/[\\w\\d]+)$/i",
}
]
},
{
"name": "linkAnywhereHistoricalSpam",
"kind": "regex",
"criteria": [
"condition": "AND",
"rules": [
{
"name": "contains links anywhere historically",
"regex": "/^.*(discord\\.gg\\/[\\w\\d]+).*$/i",
"totalMatchThreshold": ">= 3",
"lookAt": "comments",
"window": 10
"name": "linkAnywhereSpam",
"kind": "regex",
"criteria": [
{
"name": "contains link anywhere",
"regex": "/^.*(discord\\.gg\\/[\\w\\d]+).*$/i",
}
]
},
{
"name": "linkAnywhereHistoricalSpam",
"kind": "regex",
"criteria": [
{
"name": "contains links anywhere historically",
"regex": "/^.*(discord\\.gg\\/[\\w\\d]+).*$/i",
"totalMatchThreshold": ">= 3",
"lookAt": "comments",
"window": 10
}
]
}
]
}
],
"actions": [
{
"kind": "remove"
}
]
}
],
"actions": [
{
"kind": "remove"
}
]
}
]
],
}

View File

@@ -1,46 +1,47 @@
polling:
- newComm
checks:
- name: ban discord only spammer
description: ban a user who spams only a discord link many times historically
kind: comment
condition: AND
rules:
runs:
- checks:
- name: ban discord only spammer
description: ban a user who spams only a discord link many times historically
kind: comment
condition: AND
rules:
- linkOnlySpam
- linkAnywhereHistoricalSpam
actions:
actions:
- kind: remove
- kind: ban
content: spamming discord links
- name: remove discord spam
description: >-
- name: remove discord spam
description: >-
remove comments from users who only link to discord or mention discord
link many times historically
kind: comment
condition: OR
rules:
kind: comment
condition: OR
rules:
- name: linkOnlySpam
kind: regex
criteria:
- name: only link
# single quotes are required to escape special characters
regex: '/^.*(discord\.gg\/[\w\d]+)$/i'
- name: only link
# single quotes are required to escape special characters
regex: '/^.*(discord\.gg\/[\w\d]+)$/i'
- condition: AND
rules:
- name: linkAnywhereSpam
kind: regex
criteria:
- name: contains link anywhere
# single quotes are required to escape special characters
regex: '/^.*(discord\.gg\/[\w\d]+).*$/i'
- name: linkAnywhereHistoricalSpam
kind: regex
criteria:
- name: contains links anywhere historically
# single quotes are required to escape special characters
regex: '/^.*(discord\.gg\/[\w\d]+).*$/i'
totalMatchThreshold: '>= 3'
lookAt: comments
window: 10
actions:
- name: linkAnywhereSpam
kind: regex
criteria:
- name: contains link anywhere
# single quotes are required to escape special characters
regex: '/^.*(discord\.gg\/[\w\d]+).*$/i'
- name: linkAnywhereHistoricalSpam
kind: regex
criteria:
- name: contains links anywhere historically
# single quotes are required to escape special characters
regex: '/^.*(discord\.gg\/[\w\d]+).*$/i'
totalMatchThreshold: '>= 3'
lookAt: comments
window: 10
actions:
- kind: remove

View File

@@ -2,135 +2,139 @@
"polling": [
"unmoderated"
],
"checks": [
"runs": [
{
//
// Stop users who post low-effort, crossposted spam
//
// Remove a SUBMISSION if the user has crossposted it at least 4 times in recent history AND
// less than 50% of their activity is comments OR more than 40% of those comments are as OP (in the own submissions)
//
"name": "remove on low xp spam and engagement",
"description": "X-posted 4x and low comment engagement",
"kind": "submission",
"itemIs": [
"checks": [
{
"removed": false
}
],
"condition": "AND",
"rules": [
{
"name": "xPostLow",
"kind": "repeatActivity",
"gapAllowance": 2,
"threshold": ">= 4",
"window": {
"count": 50,
"duration": "6 months"
}
},
{
"name": "lowOrOpComm",
"kind": "history",
"criteriaJoin": "OR",
"criteria": [
//
// Stop users who post low-effort, crossposted spam
//
// Remove a SUBMISSION if the user has crossposted it at least 4 times in recent history AND
// less than 50% of their activity is comments OR more than 40% of those comments are as OP (in the own submissions)
//
"name": "remove on low xp spam and engagement",
"description": "X-posted 4x and low comment engagement",
"kind": "submission",
"itemIs": [
{
"removed": false
}
],
"condition": "AND",
"rules": [
{
"name": "xPostLow",
"kind": "repeatActivity",
"gapAllowance": 2,
"threshold": ">= 4",
"window": {
"count": 100,
"count": 50,
"duration": "6 months"
},
"comment": "< 50%"
}
},
{
"window": {
"count": 100,
"duration": "6 months"
},
"comment": "> 40% OP"
}
]
}
],
"actions": [
// remove this after confirming behavior is acceptable
{
"kind": "report",
"content": "Remove=>{{rules.xpostlow.largestRepeat}} X-P => {{rules.loworopcomm.thresholdSummary}}"
},
//
//
{
"kind": "remove",
// remove the line below after confirming behavior is acceptable
"dryRun": true
},
// optionally remove "dryRun" from below if you want to leave a comment on removal
// PROTIP: the comment is bland, you should make it better
{
"kind": "comment",
"content": "Your submission has been removed because you cross-posted it {{rules.xpostlow.largestRepeat}} times and you have very low engagement outside of making submissions",
"distinguish": true,
"dryRun": true
}
]
},
{
//
// Remove submissions from users who have recent activity in freekarma subs within the last 50 activities or 6 months (whichever is less)
//
"name": "freekarma removal",
"description": "Remove submission if user has used freekarma sub recently",
"kind": "submission",
"itemIs": [
{
"removed": false
}
],
"condition": "AND",
"rules": [
{
"name": "freekarma",
"kind": "recentActivity",
"window": {
"count": 50,
"duration": "6 months"
},
"useSubmissionAsReference": false,
"thresholds": [
{
"subreddits": [
"FreeKarma4U",
"FreeKarma4You",
"KarmaStore",
"promote",
"shamelessplug",
"upvote"
"name": "lowOrOpComm",
"kind": "history",
"criteriaJoin": "OR",
"criteria": [
{
"window": {
"count": 100,
"duration": "6 months"
},
"comment": "< 50%"
},
{
"window": {
"count": 100,
"duration": "6 months"
},
"comment": "> 40% OP"
}
]
}
],
"actions": [
// remove this after confirming behavior is acceptable
{
"kind": "report",
"content": "Remove=>{{rules.xpostlow.largestRepeat}} X-P => {{rules.loworopcomm.thresholdSummary}}"
},
//
//
{
"kind": "remove",
// remove the line below after confirming behavior is acceptable
"dryRun": true
},
// optionally remove "dryRun" from below if you want to leave a comment on removal
// PROTIP: the comment is bland, you should make it better
{
"kind": "comment",
"content": "Your submission has been removed because you cross-posted it {{rules.xpostlow.largestRepeat}} times and you have very low engagement outside of making submissions",
"distinguish": true,
"dryRun": true
}
]
}
],
"actions": [
// remove this after confirming behavior is acceptable
{
"kind": "report",
"content": "Remove=> {{rules.newtube.totalCount}} activities in freekarma subs"
},
//
//
{
"kind": "remove",
// remove the line below after confirming behavior is acceptable
"dryRun": true
},
// optionally remove "dryRun" from below if you want to leave a comment on removal
// PROTIP: the comment is bland, you should make it better
{
"kind": "comment",
"content": "Your submission has been removed because you have recent activity in 'freekarma' subs",
"distinguish": true,
"dryRun": true
//
// Remove submissions from users who have recent activity in freekarma subs within the last 50 activities or 6 months (whichever is less)
//
"name": "freekarma removal",
"description": "Remove submission if user has used freekarma sub recently",
"kind": "submission",
"itemIs": [
{
"removed": false
}
],
"condition": "AND",
"rules": [
{
"name": "freekarma",
"kind": "recentActivity",
"window": {
"count": 50,
"duration": "6 months"
},
"useSubmissionAsReference": false,
"thresholds": [
{
"subreddits": [
"FreeKarma4U",
"FreeKarma4You",
"KarmaStore",
"promote",
"shamelessplug",
"upvote"
]
}
]
}
],
"actions": [
// remove this after confirming behavior is acceptable
{
"kind": "report",
"content": "Remove=> {{rules.newtube.totalCount}} activities in freekarma subs"
},
//
//
{
"kind": "remove",
// remove the line below after confirming behavior is acceptable
"dryRun": true
},
// optionally remove "dryRun" from below if you want to leave a comment on removal
// PROTIP: the comment is bland, you should make it better
{
"kind": "comment",
"content": "Your submission has been removed because you have recent activity in 'freekarma' subs",
"distinguish": true,
"dryRun": true
}
]
}
]
}

View File

@@ -1,84 +1,85 @@
polling:
- unmoderated
checks:
# stop users who post low-effort, crossposted spam submissions
#
# Remove a SUBMISSION if the user has crossposted it at least 4 times in recent history AND
# less than 50% of their activity is comments OR more than 40% of those comments are as OP (in the own submissions)
- name: remove on low xp spam and engagement
description: X-posted 4x and low comment engagement
kind: submission
itemIs:
- removed: false
condition: AND
rules:
- name: xPostLow
kind: repeatActivity
gapAllowance: 2
threshold: '>= 4'
window:
count: 50
duration: 6 months
- name: lowOrOpComm
kind: history
criteriaJoin: OR
criteria:
- window:
count: 100
runs:
- checks:
# stop users who post low-effort, crossposted spam submissions
#
# Remove a SUBMISSION if the user has crossposted it at least 4 times in recent history AND
# less than 50% of their activity is comments OR more than 40% of those comments are as OP (in the own submissions)
- name: remove on low xp spam and engagement
description: X-posted 4x and low comment engagement
kind: submission
itemIs:
- removed: false
condition: AND
rules:
- name: xPostLow
kind: repeatActivity
gapAllowance: 2
threshold: '>= 4'
window:
count: 50
duration: 6 months
comment: < 50%
- window:
count: 100
- name: lowOrOpComm
kind: history
criteriaJoin: OR
criteria:
- window:
count: 100
duration: 6 months
comment: < 50%
- window:
count: 100
duration: 6 months
comment: '> 40% OP'
actions:
- kind: report
enable: true
content: >-
Remove=>{{rules.xpostlow.largestRepeat}} X-P =>
{{rules.loworopcomm.thresholdSummary}}
- kind: remove
enable: false
- kind: comment
enable: true
content: >-
Your submission has been removed because you cross-posted it
{{rules.xpostlow.largestRepeat}} times and you have very low
engagement outside of making submissions
distinguish: true
dryRun: true
# Remove submissions from users who have recent activity in freekarma subs within the last 50 activities or 6 months (whichever is less)
- name: freekarma removal
description: Remove submission if user has used freekarma sub recently
kind: submission
itemIs:
- removed: false
condition: AND
rules:
- name: freekarma
kind: recentActivity
window:
count: 50
duration: 6 months
comment: '> 40% OP'
actions:
- kind: report
enable: true
content: >-
Remove=>{{rules.xpostlow.largestRepeat}} X-P =>
{{rules.loworopcomm.thresholdSummary}}
- kind: remove
enable: false
- kind: comment
enable: true
content: >-
Your submission has been removed because you cross-posted it
{{rules.xpostlow.largestRepeat}} times and you have very low
engagement outside of making submissions
distinguish: true
dryRun: true
# Remove submissions from users who have recent activity in freekarma subs within the last 50 activities or 6 months (whichever is less)
- name: freekarma removal
description: Remove submission if user has used freekarma sub recently
kind: submission
itemIs:
- removed: false
condition: AND
rules:
- name: freekarma
kind: recentActivity
window:
count: 50
duration: 6 months
useSubmissionAsReference: false
thresholds:
- subreddits:
- FreeKarma4U
- FreeKarma4You
- KarmaStore
- promote
- shamelessplug
- upvote
actions:
- kind: report
enable: true
content: 'Remove=> {{rules.newtube.totalCount}} activities in freekarma subs'
- kind: remove
enable: false
- kind: comment
enable: true
content: >-
Your submission has been removed because you have recent activity in
'freekarma' subs
distinguish: true
dryRun: true
useSubmissionAsReference: false
thresholds:
- subreddits:
- FreeKarma4U
- FreeKarma4You
- KarmaStore
- promote
- shamelessplug
- upvote
actions:
- kind: report
enable: true
content: 'Remove=> {{rules.newtube.totalCount}} activities in freekarma subs'
- kind: remove
enable: false
- kind: comment
enable: true
content: >-
Your submission has been removed because you have recent activity in
'freekarma' subs
distinguish: true
dryRun: true

View File

@@ -2,63 +2,67 @@
"polling": [
"unmoderated"
],
"checks": [
"runs": [
{
//
// Remove submissions from users who have recent activity in freekarma subs within the last 50 activities or 6 months (whichever is less)
//
"name": "freekarma removal",
"description": "Remove submission if user has used freekarma sub recently",
"kind": "submission",
"itemIs": [
"checks": [
{
"removed": false
}
],
"condition": "AND",
"rules": [
{
"name": "freekarma",
"kind": "recentActivity",
"window": {
"count": 50,
"duration": "6 months"
},
"useSubmissionAsReference": false,
"thresholds": [
//
// Remove submissions from users who have recent activity in freekarma subs within the last 50 activities or 6 months (whichever is less)
//
"name": "freekarma removal",
"description": "Remove submission if user has used freekarma sub recently",
"kind": "submission",
"itemIs": [
{
"subreddits": [
"FreeKarma4U",
"FreeKarma4You",
"KarmaStore",
"upvote"
"removed": false
}
],
"condition": "AND",
"rules": [
{
"name": "freekarma",
"kind": "recentActivity",
"window": {
"count": 50,
"duration": "6 months"
},
"useSubmissionAsReference": false,
"thresholds": [
{
"subreddits": [
"FreeKarma4U",
"FreeKarma4You",
"KarmaStore",
"upvote"
]
}
]
}
],
"actions": [
// remove this after confirming behavior is acceptable
{
"kind": "report",
"content": "Remove=> {{rules.newtube.totalCount}} activities in freekarma subs"
},
//
//
{
"kind": "remove",
// remove the line below after confirming behavior is acceptable
"dryRun": true,
},
// optionally remove "dryRun" from below if you want to leave a comment on removal
// PROTIP: the comment is bland, you should make it better
{
"kind": "comment",
"content": "Your submission has been removed because you have recent activity in 'freekarma' subs",
"distinguish": true,
"dryRun": true,
}
]
}
],
"actions": [
// remove this after confirming behavior is acceptable
{
"kind": "report",
"content": "Remove=> {{rules.newtube.totalCount}} activities in freekarma subs"
},
//
//
{
"kind": "remove",
// remove the line below after confirming behavior is acceptable
"dryRun": true,
},
// optionally remove "dryRun" from below if you want to leave a comment on removal
// PROTIP: the comment is bland, you should make it better
{
"kind": "comment",
"content": "Your submission has been removed because you have recent activity in 'freekarma' subs",
"distinguish": true,
"dryRun": true,
}
]
}
]
],
}

View File

@@ -1,35 +1,36 @@
polling:
- unmoderated
checks:
# Remove submissions from users who have recent activity in freekarma subs within the last 50 activities or 6 months (whichever is less)
- name: freekarma removal
description: Remove submission if user has used freekarma sub recently
kind: submission
itemIs:
- removed: false
condition: AND
rules:
- name: freekarma
kind: recentActivity
window:
count: 50
duration: 6 months
useSubmissionAsReference: false
thresholds:
- subreddits:
- FreeKarma4U
- FreeKarma4You
- KarmaStore
- upvote
actions:
- kind: report
enable: true
content: 'Remove=> {{rules.newtube.totalCount}} activities in freekarma subs'
- kind: remove
enable: true
- kind: comment
enable: false
content: >-
Your submission has been removed because you have recent activity in
'freekarma' subs
distinguish: true
runs:
- checks:
# Remove submissions from users who have recent activity in freekarma subs within the last 50 activities or 6 months (whichever is less)
- name: freekarma removal
description: Remove submission if user has used freekarma sub recently
kind: submission
itemIs:
- removed: false
condition: AND
rules:
- name: freekarma
kind: recentActivity
window:
count: 50
duration: 6 months
useSubmissionAsReference: false
thresholds:
- subreddits:
- FreeKarma4U
- FreeKarma4You
- KarmaStore
- upvote
actions:
- kind: report
enable: true
content: 'Remove=> {{rules.newtube.totalCount}} activities in freekarma subs'
- kind: remove
enable: true
- kind: comment
enable: false
content: >-
Your submission has been removed because you have recent activity in
'freekarma' subs
distinguish: true

View File

@@ -2,48 +2,30 @@
"polling": [
"unmoderated"
],
"checks": [
"runs": [
{
//
// Stop users who make link submissions with a self-promotional agenda (with reddit's suggested 10% rule)
// https://www.reddit.com/wiki/selfpromotion#wiki_guidelines_for_self-promotion_on_reddit
//
// Remove a SUBMISSION if the link comprises more than or equal to 10% of users history (100 activities or 6 months) OR
//
// if link comprises 10% of submission history (100 activities or 6 months)
// AND less than 50% of their activity is comments OR more than 40% of those comments are as OP (in the own submissions)
//
"name": "Self-promo all AND low engagement",
"description": "Self-promo is >10% for all or just sub and low comment engagement",
"kind": "submission",
"condition": "OR",
"rules": [
"checks": [
{
"name": "attr",
"kind": "attribution",
"criteria": [
{
"threshold": ">= 10%",
"window": {
"count": 100,
"duration": "6 months"
},
"domains": [
"AGG:SELF"
]
}
],
},
{
"condition": "AND",
//
// Stop users who make link submissions with a self-promotional agenda (with reddit's suggested 10% rule)
// https://www.reddit.com/wiki/selfpromotion#wiki_guidelines_for_self-promotion_on_reddit
//
// Remove a SUBMISSION if the link comprises more than or equal to 10% of users history (100 activities or 6 months) OR
//
// if link comprises 10% of submission history (100 activities or 6 months)
// AND less than 50% of their activity is comments OR more than 40% of those comments are as OP (in the own submissions)
//
"name": "Self-promo all AND low engagement",
"description": "Self-promo is >10% for all or just sub and low comment engagement",
"kind": "submission",
"condition": "OR",
"rules": [
{
"name": "attrsub",
"name": "attr",
"kind": "attribution",
"criteria": [
{
"threshold": ">= 10%",
"thresholdOn": "submissions",
"window": {
"count": 100,
"duration": "6 months"
@@ -52,52 +34,74 @@
"AGG:SELF"
]
}
]
],
},
{
"name": "lowOrOpComm",
"kind": "history",
"criteriaJoin": "OR",
"criteria": [
"condition": "AND",
"rules": [
{
"window": {
"count": 100,
"duration": "6 months"
},
"comment": "< 50%"
"name": "attrsub",
"kind": "attribution",
"criteria": [
{
"threshold": ">= 10%",
"thresholdOn": "submissions",
"window": {
"count": 100,
"duration": "6 months"
},
"domains": [
"AGG:SELF"
]
}
]
},
{
"window": {
"count": 100,
"duration": "6 months"
},
"comment": "> 40% OP"
"name": "lowOrOpComm",
"kind": "history",
"criteriaJoin": "OR",
"criteria": [
{
"window": {
"count": 100,
"duration": "6 months"
},
"comment": "< 50%"
},
{
"window": {
"count": 100,
"duration": "6 months"
},
"comment": "> 40% OP"
}
]
}
]
}
],
"actions": [
{
"kind": "report",
"content": "{{rules.attr.largestPercent}}{{rules.attrsub.largestPercent}} of {{rules.attr.activityTotal}}{{rules.attrsub.activityTotal}} items ({{rules.attr.window}}{{rules.attrsub.window}}){{#rules.loworopcomm.thresholdSummary}} => {{rules.loworopcomm.thresholdSummary}}{{/rules.loworopcomm.thresholdSummary}}"
},
//
//
{
"kind": "remove",
// remove the line below after confirming behavior is acceptable
"dryRun": true
},
// optionally remove "dryRun" from below if you want to leave a comment on removal
// PROTIP: the comment is bland, you should make it better
{
"kind": "comment",
"content": "Your submission has been removed it comprises 10% or more of your recent history ({{rules.attr.largestPercent}}{{rules.attrsub.largestPercent}}). This is against [reddit's self promotional guidelines.](https://www.reddit.com/wiki/selfpromotion#wiki_guidelines_for_self-promotion_on_reddit)",
"distinguish": true,
"dryRun": true
}
]
}
],
"actions": [
{
"kind": "report",
"content": "{{rules.attr.largestPercent}}{{rules.attrsub.largestPercent}} of {{rules.attr.activityTotal}}{{rules.attrsub.activityTotal}} items ({{rules.attr.window}}{{rules.attrsub.window}}){{#rules.loworopcomm.thresholdSummary}} => {{rules.loworopcomm.thresholdSummary}}{{/rules.loworopcomm.thresholdSummary}}"
},
//
//
{
"kind": "remove",
// remove the line below after confirming behavior is acceptable
"dryRun": true
},
// optionally remove "dryRun" from below if you want to leave a comment on removal
// PROTIP: the comment is bland, you should make it better
{
"kind": "comment",
"content": "Your submission has been removed it comprises 10% or more of your recent history ({{rules.attr.largestPercent}}{{rules.attrsub.largestPercent}}). This is against [reddit's self promotional guidelines.](https://www.reddit.com/wiki/selfpromotion#wiki_guidelines_for_self-promotion_on_reddit)",
"distinguish": true,
"dryRun": true
}
]
}
]

View File

@@ -1,71 +1,72 @@
polling:
- unmoderated
checks:
#
# Stop users who make link submissions with a self-promotional agenda (with reddit's suggested 10% rule)
# https://www.reddit.com/wiki/selfpromotion#wiki_guidelines_for_self-promotion_on_reddit
#
# Remove a SUBMISSION if the link comprises more than or equal to 10% of users history (100 activities or 6 months) OR
#
# if link comprises 10% of submission history (100 activities or 6 months)
# AND less than 50% of their activity is comments OR more than 40% of those comments are as OP (in the own submissions)
#
- name: Self-promo all AND low engagement
description: Self-promo is >10% for all or just sub and low comment engagement
kind: submission
condition: OR
rules:
- name: attr
kind: attribution
criteria:
- threshold: '>= 10%'
window:
count: 100
duration: 6 months
domains:
- 'AGG:SELF'
- condition: AND
runs:
- checks:
#
# Stop users who make link submissions with a self-promotional agenda (with reddit's suggested 10% rule)
# https://www.reddit.com/wiki/selfpromotion#wiki_guidelines_for_self-promotion_on_reddit
#
# Remove a SUBMISSION if the link comprises more than or equal to 10% of users history (100 activities or 6 months) OR
#
# if link comprises 10% of submission history (100 activities or 6 months)
# AND less than 50% of their activity is comments OR more than 40% of those comments are as OP (in the own submissions)
#
- name: Self-promo all AND low engagement
description: Self-promo is >10% for all or just sub and low comment engagement
kind: submission
condition: OR
rules:
- name: attrsub
- name: attr
kind: attribution
criteria:
- threshold: '>= 10%'
thresholdOn: submissions
window:
count: 100
duration: 6 months
domains:
- 'AGG:SELF'
- name: lowOrOpComm
kind: history
criteriaJoin: OR
criteria:
- window:
count: 100
duration: 6 months
comment: < 50%
- window:
count: 100
duration: 6 months
comment: '> 40% OP'
actions:
- kind: report
enable: true
content: >-
{{rules.attr.largestPercent}}{{rules.attrsub.largestPercent}} of
{{rules.attr.activityTotal}}{{rules.attrsub.activityTotal}} items
({{rules.attr.window}}{{rules.attrsub.window}}){{#rules.loworopcomm.thresholdSummary}}
=>
{{rules.loworopcomm.thresholdSummary}}{{/rules.loworopcomm.thresholdSummary}}
- kind: remove
enable: false
- kind: comment
enable: true
content: >-
Your submission has been removed it comprises 10% or more of your
recent history
({{rules.attr.largestPercent}}{{rules.attrsub.largestPercent}}). This
is against [reddit's self promotional
guidelines.](https://www.reddit.com/wiki/selfpromotion#wiki_guidelines_for_self-promotion_on_reddit)
distinguish: true
dryRun: true
- condition: AND
rules:
- name: attrsub
kind: attribution
criteria:
- threshold: '>= 10%'
thresholdOn: submissions
window:
count: 100
duration: 6 months
domains:
- 'AGG:SELF'
- name: lowOrOpComm
kind: history
criteriaJoin: OR
criteria:
- window:
count: 100
duration: 6 months
comment: < 50%
- window:
count: 100
duration: 6 months
comment: '> 40% OP'
actions:
- kind: report
enable: true
content: >-
{{rules.attr.largestPercent}}{{rules.attrsub.largestPercent}} of
{{rules.attr.activityTotal}}{{rules.attrsub.activityTotal}} items
({{rules.attr.window}}{{rules.attrsub.window}}){{#rules.loworopcomm.thresholdSummary}}
=>
{{rules.loworopcomm.thresholdSummary}}{{/rules.loworopcomm.thresholdSummary}}
- kind: remove
enable: false
- kind: comment
enable: true
content: >-
Your submission has been removed it comprises 10% or more of your
recent history
({{rules.attr.largestPercent}}{{rules.attrsub.largestPercent}}). This
is against [reddit's self promotional
guidelines.](https://www.reddit.com/wiki/selfpromotion#wiki_guidelines_for_self-promotion_on_reddit)
distinguish: true
dryRun: true

View File

@@ -1,43 +1,47 @@
{
"checks": [
"runs": [
{
"name": "Self Promo Activities",
"description": "Tag SP only if user does not have good contributor user note",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
"checks": [
{
"name": "attr10all",
"kind": "attribution",
"author": {
"exclude": [
{
// the key of the usernote type to look for https://github.com/toolbox-team/reddit-moderator-toolbox/wiki/Subreddit-Wikis%3A-usernotes#working-with-note-types
// rule will not run if current usernote on Author is of type 'gooduser'
"type": "gooduser"
}
]
},
"criteria": [
"name": "Self Promo Activities",
"description": "Tag SP only if user does not have good contributor user note",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
{
"threshold": "> 10%",
"window": "90 days"
},
{
"threshold": "> 10%",
"window": 100
"name": "attr10all",
"kind": "attribution",
"author": {
"exclude": [
{
// the key of the usernote type to look for https://github.com/toolbox-team/reddit-moderator-toolbox/wiki/Subreddit-Wikis%3A-usernotes#working-with-note-types
// rule will not run if current usernote on Author is of type 'gooduser'
"type": "gooduser"
}
]
},
"criteria": [
{
"threshold": "> 10%",
"window": "90 days"
},
{
"threshold": "> 10%",
"window": 100
}
],
}
],
}
],
"actions": [
{
"kind": "usernote",
// the key of usernote type
// https://github.com/toolbox-team/reddit-moderator-toolbox/wiki/Subreddit-Wikis%3A-usernotes#working-with-note-types
"type": "spamwarn",
// content is mustache templated as usual
"content": "Self Promotion: {{rules.attr10all.titlesDelim}} {{rules.attr10sub.largestPercent}}%"
"actions": [
{
"kind": "usernote",
// the key of usernote type
// https://github.com/toolbox-team/reddit-moderator-toolbox/wiki/Subreddit-Wikis%3A-usernotes#working-with-note-types
"type": "spamwarn",
// content is mustache templated as usual
"content": "Self Promotion: {{rules.attr10all.titlesDelim}} {{rules.attr10sub.largestPercent}}%"
}
]
}
]
}

View File

@@ -1,27 +1,28 @@
checks:
- name: Self Promo Activities
description: Tag SP only if user does not have good contributor user note
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: attr10all
kind: attribution
author:
exclude:
# the key of the usernote type to look for https://github.com/toolbox-team/reddit-moderator-toolbox/wiki/Subreddit-Wikis%3A-usernotes#working-with-note-types
# rule will not run if current usernote on Author is of type 'gooduser'
- type: gooduser
criteria:
- threshold: '> 10%'
window: 90 days
- threshold: '> 10%'
window: 100
actions:
- kind: usernote
# the key of usernote type
# https://github.com/toolbox-team/reddit-moderator-toolbox/wiki/Subreddit-Wikis%3A-usernotes#working-with-note-types
type: spamwarn
# content is mustache templated
content: >-
Self Promotion: {{rules.attr10all.titlesDelim}}
{{rules.attr10sub.largestPercent}}%
runs:
- checks:
- name: Self Promo Activities
description: Tag SP only if user does not have good contributor user note
# check will run on a new submission in your subreddit and look at the Author of that submission
kind: submission
rules:
- name: attr10all
kind: attribution
author:
exclude:
# the key of the usernote type to look for https://github.com/toolbox-team/reddit-moderator-toolbox/wiki/Subreddit-Wikis%3A-usernotes#working-with-note-types
# rule will not run if current usernote on Author is of type 'gooduser'
- type: gooduser
criteria:
- threshold: '> 10%'
window: 90 days
- threshold: '> 10%'
window: 100
actions:
- kind: usernote
# the key of usernote type
# https://github.com/toolbox-team/reddit-moderator-toolbox/wiki/Subreddit-Wikis%3A-usernotes#working-with-note-types
type: spamwarn
# content is mustache templated
content: >-
Self Promotion: {{rules.attr10all.titlesDelim}}
{{rules.attr10sub.largestPercent}}%

View File

@@ -1,34 +1,38 @@
{
"checks": [
"runs": [
{
"name": "Self Promo Activities",
"description": "Check if any of Author's aggregated submission origins are >10% of entire history",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
"checks": [
{
"name": "attr10all",
"kind": "attribution",
"criteria": [
"name": "Self Promo Activities",
"description": "Check if any of Author's aggregated submission origins are >10% of entire history",
// check will run on a new submission in your subreddit and look at the Author of that submission
"kind": "submission",
"rules": [
{
"threshold": "> 10%",
"window": "90 days"
},
{
"threshold": "> 10%",
"window": 100
"name": "attr10all",
"kind": "attribution",
"criteria": [
{
"threshold": "> 10%",
"window": "90 days"
},
{
"threshold": "> 10%",
"window": 100
}
],
}
],
}
],
"actions": [
{
"kind": "usernote",
// the key of usernote type
// https://github.com/toolbox-team/reddit-moderator-toolbox/wiki/Subreddit-Wikis%3A-usernotes#working-with-note-types
"type": "spamwarn",
// content is mustache templated as usual
"content": "Self Promotion: {{rules.attr10all.titlesDelim}} {{rules.attr10sub.largestPercent}}%"
"actions": [
{
"kind": "usernote",
// the key of usernote type
// https://github.com/toolbox-team/reddit-moderator-toolbox/wiki/Subreddit-Wikis%3A-usernotes#working-with-note-types
"type": "spamwarn",
// content is mustache templated as usual
"content": "Self Promotion: {{rules.attr10all.titlesDelim}} {{rules.attr10sub.largestPercent}}%"
}
]
}
]
}

View File

@@ -1,23 +1,24 @@
checks:
- name: Self Promo Activities
# check will run on a new submission in your subreddit and look at the Author of that submission
description: >-
Check if any of Author's aggregated submission origins are >10% of entire
history
kind: submission
rules:
- name: attr10all
kind: attribution
criteria:
- threshold: '> 10%'
window: 90 days
- threshold: '> 10%'
window: 100
actions:
- kind: usernote
# the key of usernote type
# https://github.com/toolbox-team/reddit-moderator-toolbox/wiki/Subreddit-Wikis%3A-usernotes#working-with-note-types
type: spamwarn
content: >-
Self Promotion: {{rules.attr10all.titlesDelim}}
{{rules.attr10sub.largestPercent}}%
runs:
- checks:
- name: Self Promo Activities
# check will run on a new submission in your subreddit and look at the Author of that submission
description: >-
Check if any of Author's aggregated submission origins are >10% of entire
history
kind: submission
rules:
- name: attr10all
kind: attribution
criteria:
- threshold: '> 10%'
window: 90 days
- threshold: '> 10%'
window: 100
actions:
- kind: usernote
# the key of usernote type
# https://github.com/toolbox-team/reddit-moderator-toolbox/wiki/Subreddit-Wikis%3A-usernotes#working-with-note-types
type: spamwarn
content: >-
Self Promotion: {{rules.attr10all.titlesDelim}}
{{rules.attr10sub.largestPercent}}%

View File

@@ -81,7 +81,7 @@ The default location for this page is at `https://old.reddit.com/r/YOURSUBERDDIT
The bot automatically tries to create its configuration wiki page. You can find the result of this in the log for your subreddit in the web interface.
If this fails for some reason you can create the wiki page through the web interface by navigating to your subreddit's tab, opening the [built-in editor (click **View**)](/docs/screenshots/configBox.png), and following the directions in **Create configuration for...** link found there.
If this fails for some reason you can create the wiki page through the web interface by navigating to your subreddit's tab, opening the [built-in editor (click **View**)](/docs/images/configBox.png), and following the directions in **Create configuration for...** link found there.
If neither of the above approaches work, or you do not wish to use the web interface, expand the section below for directions on how to manually setup the wiki page:
@@ -134,7 +134,7 @@ PROTIP: Find an [example config](#using-an-example-config) to use as a starting
In the web interface each subreddit's tab has access to the built-in editor. Use this built-in editor to automatically create, load, or save the configuration for that subreddit's wiki.
* Visit the tab for the subreddit you want to edit the configuration of
* Open the [built-in editor by click **View**](/docs/screenshots/configBox.png)
* Open the [built-in editor by click **View**](/docs/images/configBox.png)
* Edit your configuration
* Follow the directions on the **Save to r/..** link found at the top of the editor to automatically save your configuration

View File

@@ -22,13 +22,14 @@ PROTIP: Using a container management tool like [Portainer.io CE](https://www.por
### [Dockerhub](https://hub.docker.com/r/foxxmd/context-mod)
```
foxxmd/context-mod:latest
```
An example of starting the container using the [minimum configuration](/docs/operatorConfiguration.md#minimum-config) with a [configuration file](/docs/operatorConfiguration.md#defining-configuration-via-file):
* Bind the folder where the config is located on your host machine into the container `-v /host/path/folder:/config`
* Tell CM where to find the config using an env `-e "OPERATOR_CONFIG=/config/myConfig.yaml"`
* Expose the web interface using the container port `8085`
Adding **environmental variables** to your `docker run` command will pass them through to the app EX:
```
docker run -d -e "CLIENT_ID=myId" ... foxxmd/context-mod
docker run -d -e "OPERATOR_CONFIG=/config/myConfig.yaml" -v /host/path/folder:/config -p 8085:8085 foxxmd/context-mod
```
### Locally
@@ -47,6 +48,12 @@ npm install
tsc -p .
```
An example of running CM using the [minimum configuration](/docs/operatorConfiguration.md#minimum-config) with a [configuration file](/docs/operatorConfiguration.md#defining-configuration-via-file):
```bash
node src/index.js run
```
### [Heroku Quick Deploy](https://heroku.com/about)
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://dashboard.heroku.com/new?template=https://github.com/FoxxMD/context-mod)

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
docs/images/config/save.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

View File

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 125 KiB

BIN
docs/images/logs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

View File

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 148 KiB

View File

Before

Width:  |  Height:  |  Size: 226 KiB

After

Width:  |  Height:  |  Size: 226 KiB

BIN
docs/images/runInput.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 479 KiB

After

Width:  |  Height:  |  Size: 479 KiB

BIN
docs/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -41,8 +41,10 @@ configuration.
**Note:** When reading the **schema** if the variable is available at a level of configuration other than **FILE** it will be
noted with the same symbol as above. The value shown is the default.
* To load a JSON configuration (for **FILE**) **from the command line** use the `-c` cli argument EX: `node src/index.js -c /path/to/JSON/config.json`
* To load a JSON configuration (for **FILE**) **using an environmental variable** use `OPERATOR_CONFIG` EX: `OPERATOR_CONFIG=/path/to/JSON/config.json`
## Defining Configuration Via File
* **from the command line** use the `-c` cli argument EX: `node src/index.js -c /path/to/JSON/config.json`
* **using an environmental variable** use `OPERATOR_CONFIG` EX: `OPERATOR_CONFIG=/path/to/JSON/config.json`
[**See the Operator Config Schema here**](https://json-schema.app/view/%23?url=https%3A%2F%2Fraw.githubusercontent.com%2FFoxxMD%2Fcontext-mod%2Fmaster%2Fsrc%2FSchema%2FOperatorConfig.json)
@@ -121,28 +123,41 @@ Below are examples of the minimum required config to run the application using a
Using **FILE**
<details>
CM will look for a file configuration at `PROJECT_DIR/config.yaml` by default [or you can specify your own location.](#defining-configuration-via-file)
YAML
```yaml
operator:
name: YourRedditUsername
bots:
- credentials:
clientId: f4b4df1c7b2
clientSecret: 34v5q1c56ub
refreshToken: 34_f1w1v4
accessToken: p75_1c467b2
web:
credentials:
clientId: f4b4df1c7b2
clientSecret: 34v5q1c56ub
```
JSON
```json5
{
"operator": {
"name": "YourRedditUsername"
},
"bots": [
{
"credentials": {
"clientId": "f4b4df1c7b2",
"clientSecret": "34v5q1c56ub",
"refreshToken": "34_f1w1v4",
"accessToken": "p75_1c467b2"
"clientSecret": "34v5q1c56ub"
}
}
]
],
"web": {
"credentials": {
"clientId": "f4b4df1c7b2",
"clientSecret": "34v5q1c56ub"
}
}
}
```
@@ -153,10 +168,9 @@ Using **ENV** (`.env`)
<details>
```
OPERATOR=YourRedditUsername
CLIENT_ID=f4b4df1c7b2
CLIENT_SECRET=34v5q1c56ub
REFRESH_TOKEN=34_f1w1v4
ACCESS_TOKEN=p75_1c467b2
```
</details>

30
docs/webInterface.md Normal file
View File

@@ -0,0 +1,30 @@
## Editing/Updating Your Config
* Open the editor for your subreddit
* In the web dashboard \-> r/YourSubreddit \-> Config -> **View** [(here)](/docs/images/config/config.jpg)
* Follow the directions on the [link at the top of the window](/docs/images/config/save.png) to enable config editing using your moderator account
* After enabling editing just click "save" at any time to save your config
* After you have added/edited your config the bot will detect changes within 5 minutes or you can manually trigger it by clicking **Update**
## General Config (Editor) Tips
* The editor will automatically validate your [syntax (formatting)](/docs/images/config/syntax.png) and [config correctness](/docs/images/config/correctness.png) (property names, required properties, etc.)
* These show up as squiggly lines like in Microsoft Word and as a [list at the bottom of the editor](/docs/images/config/errors.png)
* In your config all **Checks** and **Actions** have two properties that control how they behave:
* [**Enable**](/docs/images/config/enable.png) (defaults to `enable: true`) -- Determines if the check or action is run, at all
* **Dryrun** (defaults to `dryRun: false`) -- When `true` the check or action will run but any **Actions** that may be triggered will "pretend" to execute but not actually talk to the Reddit API.
* Use `dryRun` to test your config without the bot making any changes on reddit
* When starting out with a new config it is recommended running the bot with remove/ban actions **disabled**
* Use `report` actions to get reports in your modqueue from the bot that describe what it detected and what it would do about it
* Once the bot is behaving as desired (no false positives or weird behavior) destructive actions can be enabled or turned off of dryrun
## Web Dashboard Tips
* Use the [**Overview** section](/docs/images/botOperations.png) to control the bot at a high-level
* You can **manually run** the bot on any activity (comment/submission) by pasting its permalink into the [input field below the Overview section](/docs/images/runInput.png) and hitting one of the **run buttons**
* **Dry run** will make the bot run on the activity but it will only **pretend** to run actions, if triggered. This is super useful for testing your config without consequences
* **Run** will do everything
* All of the bot's activity is shown in real-time in the [log section](/docs/images/logs.png)
* This will output the results of all run checks/rules and any actions that run
* You can view summaries of all activities that triggered a check (had actions run) by clicking on [Actioned Events](/docs/images/actionsEvents.png)
* This includes activities run with dry run

5112
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no tests installed\" && exit 1",
"test": "nyc ./node_modules/.bin/_mocha 'tests/**/*.test.ts'",
"build": "tsc",
"start": "node src/index.js run",
"schema": "npm run -s schema-app & npm run -s schema-ruleset & npm run -s schema-rule & npm run -s schema-action & npm run -s schema-config",
@@ -35,6 +35,7 @@
"cache-manager": "^3.4.4",
"cache-manager-redis-store": "^2.0.0",
"commander": "^8.0.0",
"comment-json": "^4.1.1",
"cookie-parser": "^1.3.5",
"dayjs": "^1.10.5",
"deepmerge": "^4.2.2",
@@ -48,16 +49,17 @@
"express-socket.io-session": "^1.3.5",
"fast-deep-equal": "^3.1.3",
"fuse.js": "^6.4.6",
"globrex": "^0.1.2",
"got": "^11.8.2",
"he": "^1.2.0",
"http-proxy": "^1.18.1",
"image-size": "^1.0.0",
"js-yaml": "^4.1.0",
"json5": "^2.2.0",
"jsonwebtoken": "^8.5.1",
"leven": "^3.1.0",
"lodash": "^4.17.21",
"lru-cache": "^6.0.0",
"migrate": "github:johsunds/node-migrate#49b0054de0a9295857aa8b8eea9a3cdeb2643913",
"mustache": "^4.2.0",
"node-fetch": "^2.6.1",
"normalize-url": "^6.1.0",
@@ -68,6 +70,7 @@
"passport-custom": "^1.1.1",
"passport-jwt": "^4.0.0",
"pixelmatch": "^5.2.1",
"pony-cause": "^1.1.1",
"pretty-print-json": "^1.0.3",
"safe-stable-stringify": "^1.1.1",
"snoostorm": "^1.5.2",
@@ -82,17 +85,21 @@
"winston-daily-rotate-file": "^4.5.5",
"winston-duplex": "^0.1.1",
"winston-transport": "^4.4.0",
"yaml": "2.0.0-10",
"zlib": "^1.0.5"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@tsconfig/node14": "^1.0.0",
"@types/async": "^3.2.7",
"@types/cache-manager": "^3.4.2",
"@types/cache-manager-redis-store": "^2.0.0",
"@types/chai": "^4.3.0",
"@types/cookie-parser": "^1.4.2",
"@types/express": "^4.17.13",
"@types/express-session": "^1.17.4",
"@types/express-socket.io-session": "^1.3.6",
"@types/globrex": "^0.1.1",
"@types/he": "^1.1.1",
"@types/http-proxy": "^1.17.7",
"@types/js-yaml": "^4.0.1",
@@ -100,6 +107,7 @@
"@types/lodash": "^4.14.171",
"@types/lru-cache": "^5.1.1",
"@types/memory-cache": "^0.2.1",
"@types/mocha": "^9.1.0",
"@types/mustache": "^4.1.1",
"@types/node": "^15.6.1",
"@types/node-fetch": "^2.5.10",
@@ -111,8 +119,16 @@
"@types/string-similarity": "^4.0.0",
"@types/tcp-port-used": "^1.0.0",
"@types/triple-beam": "^1.3.2",
"chai": "^4.3.6",
"mocha": "^9.2.1",
"nyc": "^15.1.0",
"source-map-support": "^0.5.21",
"ts-essentials": "^9.1.2",
"ts-json-schema-generator": "^0.93.0",
"typescript-json-schema": "^0.50.1"
"ts-mockito": "^2.6.1",
"ts-node": "^10.7.0",
"tsconfig-paths": "^3.13.0",
"typescript-json-schema": "~0.53"
},
"optionalDependencies": {
"sharp": "^0.29.1"

21
register.js Normal file
View File

@@ -0,0 +1,21 @@
/**
* Overrides the tsconfig used for the app.
* In the test environment we need some tweaks.
*/
const tsNode = require('ts-node');
const tsConfigPaths = require('tsconfig-paths');
const mainTSConfig = require('./tsconfig.json');
tsConfigPaths.register({
baseUrl: './tests',
paths: {
...mainTSConfig.compilerOptions.paths,
}
});
tsNode.register({
files: true,
transpileOnly: true,
project: './tsconfig.json'
});

View File

@@ -12,30 +12,37 @@ import {MessageAction, MessageActionJson} from "./MessageAction";
import {SubredditResources} from "../Subreddit/SubredditResources";
import {UserFlairAction, UserFlairActionJson} from './UserFlairAction';
import {ExtendedSnoowrap} from '../Utils/SnoowrapClients';
import EventEmitter from "events";
import {DispatchAction, DispatchActionJson} from "./DispatchAction";
import {CancelDispatchAction, CancelDispatchActionJson} from "./CancelDispatchAction";
export function actionFactory
(config: ActionJson, logger: Logger, subredditName: string, resources: SubredditResources, client: ExtendedSnoowrap): Action {
(config: ActionJson, logger: Logger, subredditName: string, resources: SubredditResources, client: ExtendedSnoowrap, emitter: EventEmitter): Action {
switch (config.kind) {
case 'comment':
return new CommentAction({...config as CommentActionJson, logger, subredditName, resources, client});
return new CommentAction({...config as CommentActionJson, logger, subredditName, resources, client, emitter});
case 'lock':
return new LockAction({...config, logger, subredditName, resources, client});
return new LockAction({...config, logger, subredditName, resources, client, emitter});
case 'remove':
return new RemoveAction({...config, logger, subredditName, resources, client});
return new RemoveAction({...config, logger, subredditName, resources, client, emitter});
case 'report':
return new ReportAction({...config as ReportActionJson, logger, subredditName, resources, client});
return new ReportAction({...config as ReportActionJson, logger, subredditName, resources, client, emitter});
case 'flair':
return new FlairAction({...config as FlairActionJson, logger, subredditName, resources, client});
return new FlairAction({...config as FlairActionJson, logger, subredditName, resources, client, emitter});
case 'userflair':
return new UserFlairAction({...config as UserFlairActionJson, logger, subredditName, resources, client});
return new UserFlairAction({...config as UserFlairActionJson, logger, subredditName, resources, client, emitter});
case 'approve':
return new ApproveAction({...config as ApproveActionConfig, logger, subredditName, resources, client});
return new ApproveAction({...config as ApproveActionConfig, logger, subredditName, resources, client, emitter});
case 'usernote':
return new UserNoteAction({...config as UserNoteActionJson, logger, subredditName, resources, client});
return new UserNoteAction({...config as UserNoteActionJson, logger, subredditName, resources, client, emitter});
case 'ban':
return new BanAction({...config as BanActionJson, logger, subredditName, resources, client});
return new BanAction({...config as BanActionJson, logger, subredditName, resources, client, emitter});
case 'message':
return new MessageAction({...config as MessageActionJson, logger, subredditName, resources, client});
return new MessageAction({...config as MessageActionJson, logger, subredditName, resources, client, emitter});
case 'dispatch':
return new DispatchAction({...config as DispatchActionJson, logger, subredditName, resources, client, emitter});
case 'cancelDispatch':
return new CancelDispatchAction({...config as CancelDispatchActionJson, logger, subredditName, resources, client, emitter})
default:
throw new Error('rule "kind" was not recognized.');
}

View File

@@ -1,31 +1,72 @@
import {ActionJson, ActionConfig} from "./index";
import {ActionJson, ActionConfig, ActionOptions} from "./index";
import Action from "./index";
import Snoowrap, {Comment, Submission} from "snoowrap";
import Snoowrap from "snoowrap";
import {RuleResult} from "../Rule";
import {ActionProcessResult} from "../Common/interfaces";
import {ActionProcessResult, ActionTarget} from "../Common/interfaces";
import Submission from "snoowrap/dist/objects/Submission";
import Comment from "snoowrap/dist/objects/Comment";
export class ApproveAction extends Action {
targets: ActionTarget[]
getKind() {
return 'Approve';
}
constructor(options: ApproveOptions) {
super(options);
const {
targets = ['self']
} = options;
this.targets = targets;
}
async process(item: Comment | Submission, ruleResults: RuleResult[], runtimeDryrun?: boolean): Promise<ActionProcessResult> {
const dryRun = runtimeDryrun || this.dryRun;
const touchedEntities = [];
//snoowrap typing issue, thinks comments can't be locked
// @ts-ignore
if (item.approved) {
this.logger.warn('Item is already approved');
return {
dryRun,
success: false,
result: 'Item is already approved'
const realTargets = item instanceof Submission ? ['self'] : this.targets;
for(const target of realTargets) {
let targetItem = item;
if(target !== 'self' && item instanceof Comment) {
targetItem = await this.resources.getActivity(this.client.getSubmission(item.link_id));
}
// @ts-ignore
if (targetItem.approved) {
const msg = `${target === 'self' ? 'Item' : 'Comment\'s parent Submission'} is already approved`;
this.logger.warn(msg);
return {
dryRun,
success: false,
result: msg
}
}
if (!dryRun) {
// make sure we have an actual item and not just a plain object from cache
if(target !== 'self' && !(targetItem instanceof Submission)) {
// @ts-ignore
targetItem = await this.client.getSubmission((item as Comment).link_id).fetch();
}
// @ts-ignore
touchedEntities.push(await targetItem.approve());
if(target === 'self') {
// @ts-ignore
item.approved = true;
await this.resources.resetCacheForItem(item);
} else if(await this.resources.hasActivity(targetItem)) {
// @ts-ignore
targetItem.approved = true;
await this.resources.resetCacheForItem(targetItem);
}
}
}
if (!dryRun) {
// @ts-ignore
touchedEntities.push(await item.approve());
}
return {
dryRun,
success: true,
@@ -34,8 +75,18 @@ export class ApproveAction extends Action {
}
}
export interface ApproveActionConfig extends ActionConfig {
export interface ApproveOptions extends ApproveActionConfig, ActionOptions {}
export interface ApproveActionConfig extends ActionConfig {
/**
* Specify which Activities to approve
*
* This setting is only applicable if the Activity being acted on is a **comment**. On a **submission** the setting does nothing
*
* * self => approve activity being checked (comment)
* * parent => approve parent (submission) of activity being checked (comment)
* */
targets?: ActionTarget[]
}
/**

View File

@@ -0,0 +1,135 @@
import {ActionJson, ActionConfig, ActionOptions} from "./index";
import Action from "./index";
import Snoowrap, {Comment, Submission} from "snoowrap";
import {RuleResult} from "../Rule";
import {activityIsRemoved} from "../Utils/SnoowrapUtils";
import {ActionProcessResult, ActionTarget, ActivityDispatchConfig, InclusiveActionTarget} from "../Common/interfaces";
import dayjs from "dayjs";
import {isSubmission, parseDurationValToDuration} from "../util";
export class CancelDispatchAction extends Action {
identifiers?: (string | null)[];
targets: InclusiveActionTarget[];
getKind() {
return 'Cancel Dispatch';
}
constructor(options: CancelDispatchOptions) {
super(options);
const {
identifier,
target
} = options;
if (identifier === undefined) {
this.identifiers = identifier;
} else {
this.identifiers = !Array.isArray(identifier) ? [identifier] : identifier;
}
this.targets = !Array.isArray(target) ? [target] : target;
}
async process(item: Comment | Submission, ruleResults: RuleResult[], runtimeDryrun?: boolean): Promise<ActionProcessResult> {
const dryRun = runtimeDryrun || this.dryRun;
const realTargets = isSubmission(item) ? this.targets.filter(x => x !== 'parent') : this.targets;
if (this.targets.includes('parent') && isSubmission(item)) {
if (realTargets.length > 0) {
this.logger.warning(`Cannot use 'parent' as target because Activity is a Submission. Using other targets instead (${realTargets.join(',')})`);
} else {
return {
dryRun,
success: false,
result: `Cannot use 'parent' as target because Activity is a Submission and no other targets specified.`,
}
}
}
let cancelledActivities: string[] = [];
for (const target of realTargets) {
let matchId: string | undefined = item.name;
if (target === 'parent') {
matchId = (item as Comment).link_id;
} else if (target === 'any') {
matchId = undefined;
}
const delayedItemsToRemove = this.resources.delayedItems.filter(x => {
const matchedId = matchId === undefined || x.activity.name === matchId;
let matchedDispatchIdentifier;
if (this.identifiers === undefined) {
matchedDispatchIdentifier = true;
} else if (x.identifier === undefined) {
matchedDispatchIdentifier = this.identifiers.includes(null);
} else {
matchedDispatchIdentifier = this.identifiers.filter(x => x !== null).includes(x.identifier);
}
const matched = matchedId && matchedDispatchIdentifier;
if(matched && x.processing) {
this.logger.debug(`Cannot remove ${isSubmission(x.activity) ? 'Submission' : 'Comment'} ${x.activity.name} because it is currently processing`);
return false;
}
return matched;
});
let cancelCrit;
if (this.identifiers === undefined) {
cancelCrit = 'Any';
} else {
const idenfitierHints = [];
if (this.identifiers.includes(null)) {
idenfitierHints.push('No Identifier');
}
const concreteIdentifiers = this.identifiers.filter(x => x !== null);
if (concreteIdentifiers.length > 0) {
idenfitierHints.push(concreteIdentifiers.join(', '));
}
cancelCrit = idenfitierHints.join(' OR ');
}
let activityHint;
if (target === 'self') {
activityHint = 'This Activity';
} else if (target === 'parent') {
activityHint = `This Comment's parent Submission`;
} else {
activityHint = 'Any';
}
let cancelActivitiesHint;
if (delayedItemsToRemove.length === 0) {
cancelActivitiesHint = 'None Found';
} else {
const cancelActivitiesHintArr = delayedItemsToRemove.map(x => `${isSubmission(x.activity) ? 'Submission' : 'Comment'} ${x.activity.name}`);
cancelledActivities = cancelledActivities.concat(cancelActivitiesHintArr);
cancelActivitiesHint = cancelActivitiesHintArr.join(', ');
}
const cancelResult = `Identifiers: ${cancelCrit} | Target: ${activityHint} | Results: ${cancelActivitiesHint}`;
this.logger.verbose(cancelResult);
if (!dryRun) {
const activityIds = delayedItemsToRemove.map(x => x.id);
this.resources.delayedItems = this.resources.delayedItems.filter(x => !activityIds.includes(x.id));
}
}
return {
dryRun,
success: true,
result: cancelledActivities.length === 0 ? 'No Dispatch Actions cancelled' : `Cancelled Dispatch Actions: ${cancelledActivities.join(', ')}`,
}
}
}
export interface CancelDispatchOptions extends CancelDispatchActionConfig, ActionOptions {
}
export interface CancelDispatchActionConfig extends ActionConfig {
target: InclusiveActionTarget | InclusiveActionTarget[]
identifier?: string | string[] | null
}
/**
* Remove the Activity
* */
export interface CancelDispatchActionJson extends CancelDispatchActionConfig, ActionJson {
kind: 'cancelDispatch'
}

View File

@@ -52,6 +52,7 @@ export class CommentAction extends Action {
};
}
const touchedEntities = [];
let modifiers = [];
let reply: Comment;
if(!dryRun) {
// @ts-ignore
@@ -59,29 +60,29 @@ export class CommentAction extends Action {
touchedEntities.push(reply);
}
if (this.lock) {
modifiers.push('Locked');
if (!dryRun) {
// snoopwrap typing issue, thinks comments can't be locked
// @ts-ignore
await item.lock();
touchedEntities.push(item);
await reply.lock();
}
}
if (this.distinguish && !dryRun) {
// @ts-ignore
await reply.distinguish({sticky: this.sticky});
}
let modifiers = [];
if(this.distinguish) {
modifiers.push('Distinguished');
if(this.sticky) {
modifiers.push('Stickied');
}
if(!dryRun) {
// @ts-ignore
await reply.distinguish({sticky: this.sticky});
}
}
if(this.sticky) {
modifiers.push('Stickied');
}
const modifierStr = modifiers.length === 0 ? '' : `[${modifiers.join(' | ')}]`;
return {
dryRun,
success: true,
result: `${modifierStr}${this.lock ? ' - Locked Author\'s Activity - ' : ''}${truncateStringToLength(100)(body)}`,
result: `${modifierStr}${truncateStringToLength(100)(body)}`,
touchedEntities,
};
}

View File

@@ -0,0 +1,140 @@
import {ActionJson, ActionConfig, ActionOptions} from "./index";
import Action from "./index";
import Snoowrap, {Comment, Submission} from "snoowrap";
import {RuleResult} from "../Rule";
import {activityIsRemoved} from "../Utils/SnoowrapUtils";
import {ActionProcessResult, ActionTarget, ActivityDispatchConfig} from "../Common/interfaces";
import dayjs from "dayjs";
import {isSubmission, parseDurationValToDuration, randomId} from "../util";
export class DispatchAction extends Action {
dispatchData: ActivityDispatchConfig;
targets: ActionTarget[];
getKind() {
return 'Dispatch';
}
constructor(options: DispatchOptions) {
super(options);
const {
identifier,
cancelIfQueued = false,
goto,
delay,
target = ['self']
} = options;
this.dispatchData = {
identifier: identifier,
cancelIfQueued,
goto,
delay,
}
this.targets = !Array.isArray(target) ? [target] : target;
}
async process(item: Comment | Submission, ruleResults: RuleResult[], runtimeDryrun?: boolean): Promise<ActionProcessResult> {
const dryRun = runtimeDryrun || this.dryRun;
const realTargets = isSubmission(item) ? ['self'] : this.targets;
if (this.targets.includes('parent') && isSubmission(item)) {
if (this.targets.includes('self')) {
this.logger.warning(`Cannot use 'parent' as target because Activity is a Submission. Reverted to 'self'`);
} else {
return {
dryRun,
success: false,
result: `Cannot use 'parent' as target because Activity is a Submission.`,
}
}
}
const {delay, ...restDispatchData} = this.dispatchData;
const dispatchPayload = {
...restDispatchData,
delay,
queuedAt: dayjs().unix(),
duration: parseDurationValToDuration(delay),
processing: false,
};
const dispatchActivitiesHints = [];
for (const target of realTargets) {
let act = item;
let actHint = `Comment's parent Submission (${(item as Comment).link_id})`;
if (target !== 'self') {
if (!dryRun) {
act = await this.resources.getActivity(this.client.getSubmission((item as Comment).link_id));
} else {
// don't need to spend api call to get submission if we won't actually do anything with it
// @ts-ignore
act = await this.resources.client.getSubmission((item as Comment).link_id);
}
} else {
actHint = `This Activity (${item.name})`;
}
const existing = this.resources.delayedItems.filter(x => {
const matchedActivityId = x.activity.name === act.name;
const matchDispatchIdentifier = dispatchPayload.identifier === undefined ? true : dispatchPayload.identifier === x.identifier;
return matchedActivityId && matchDispatchIdentifier;
});
if (existing.length > 0) {
let existingRes = `Dispatch activities (${existing.map((x, index) => `[${index + 1}] Queued At ${dayjs.unix(x.queuedAt).format('YYYY-MM-DD HH:mm:ssZ')} for ${x.duration.humanize()}`).join(' ')}}) already exist for ${actHint}`;
if (this.dispatchData.onExistingFound === 'skip') {
existingRes += ` and existing behavior is SKIP so nothing queued`;
continue;
} else if (this.dispatchData.onExistingFound === 'replace') {
existingRes += ` and existing behavior is REPLACE so replaced existing`;
const existingIds = existing.map(x => x.id);
this.resources.delayedItems = this.resources.delayedItems.filter(x => !existingIds.includes(x.id));
} else {
existingRes += ` but existing behavior is IGNORE so adding new dispatch activity anyway`;
}
dispatchActivitiesHints.push(existingRes);
} else {
dispatchActivitiesHints.push(actHint);
}
if (!dryRun) {
this.resources.delayedItems.push({
...dispatchPayload,
activity: act,
id: randomId(),
action: this.getActionUniqueName()
});
}
}
let dispatchBehaviors = [];
if (dispatchPayload.identifier !== undefined) {
dispatchBehaviors.push(`Identifier: ${dispatchPayload.identifier}`);
}
if (dispatchPayload.goto !== undefined) {
dispatchBehaviors.push(`Goto: ${dispatchPayload.goto}`);
}
let result = `Delay: ${dispatchPayload.duration.humanize()}${dispatchBehaviors.length > 0 ? ` | ${dispatchBehaviors.join(' | ')}` : ''} | Dispatch Results: ${dispatchActivitiesHints.join(' <<>> ')}`;
this.logger.verbose(result);
return {
dryRun,
success: true,
result,
}
}
}
export interface DispatchOptions extends DispatchActionConfig, ActionOptions {
}
export interface DispatchActionConfig extends ActionConfig, ActivityDispatchConfig {
target: ActionTarget | ActionTarget[]
}
/**
* Remove the Activity
* */
export interface DispatchActionJson extends DispatchActionConfig, ActionJson {
kind: 'dispatch'
}

View File

@@ -26,6 +26,9 @@ export class LockAction extends Action {
//snoowrap typing issue, thinks comments can't be locked
// @ts-ignore
await item.lock();
// @ts-ignore
item.locked = true;
await this.resources.resetCacheForItem(item);
touchedEntities.push(item);
}
return {

View File

@@ -12,7 +12,8 @@ import {
REDDIT_ENTITY_REGEX_URL,
truncateStringToLength
} from "../util";
import SimpleError from "../Utils/SimpleError";
import {SimpleError} from "../Utils/Errors";
import {ErrorWithCause} from "pony-cause";
export class MessageAction extends Action {
content: string;
@@ -65,10 +66,7 @@ export class MessageAction extends Action {
recipient = `/r/${entityData.name}`;
}
} catch (err: any) {
this.logger.error(`'to' field for message was not in a valid format. See ${REDDIT_ENTITY_REGEX_URL} for valid examples`);
this.logger.error(err);
err.logged = true;
throw err;
throw new ErrorWithCause(`'to' field for message was not in a valid format. See ${REDDIT_ENTITY_REGEX_URL} for valid examples`, {cause: err});
}
if(recipient.includes('/r/') && this.asSubreddit) {
throw new SimpleError(`Cannot send a message as a subreddit to another subreddit. Requested recipient: ${recipient}`);

View File

@@ -1,30 +1,48 @@
import {ActionJson, ActionConfig} from "./index";
import {ActionJson, ActionConfig, ActionOptions} from "./index";
import Action from "./index";
import Snoowrap, {Comment, Submission} from "snoowrap";
import {RuleResult} from "../Rule";
import {activityIsRemoved} from "../Utils/SnoowrapUtils";
import {ActionProcessResult} from "../Common/interfaces";
import dayjs from "dayjs";
import {isSubmission} from "../util";
export class RemoveAction extends Action {
spam: boolean;
getKind() {
return 'Remove';
}
constructor(options: RemoveOptions) {
super(options);
const {
spam = false,
} = options;
this.spam = spam;
}
async process(item: Comment | Submission, ruleResults: RuleResult[], runtimeDryrun?: boolean): Promise<ActionProcessResult> {
const dryRun = runtimeDryrun || this.dryRun;
const touchedEntities = [];
// issue with snoowrap typings, doesn't think prop exists on Submission
// @ts-ignore
if (activityIsRemoved(item)) {
return {
dryRun,
success: false,
result: 'Item is already removed',
}
this.logger.warn('It looks like this Item is already removed!');
}
if (this.spam) {
this.logger.verbose('Marking as spam on removal');
}
if (!dryRun) {
// @ts-ignore
await item.remove();
await item.remove({spam: this.spam});
item.banned_at_utc = dayjs().unix();
item.spam = this.spam;
if(!isSubmission(item)) {
// @ts-ignore
item.removed = true;
}
await this.resources.resetCacheForItem(item);
touchedEntities.push(item);
}
@@ -36,13 +54,16 @@ export class RemoveAction extends Action {
}
}
export interface RemoveActionConfig extends ActionConfig {
export interface RemoveOptions extends RemoveActionConfig, ActionOptions {
}
export interface RemoveActionConfig extends ActionConfig {
spam?: boolean
}
/**
* Remove the Activity
* */
export interface RemoveActionJson extends RemoveActionConfig, ActionJson {
kind: 'remove'
kind: 'remove'
}

View File

@@ -35,6 +35,7 @@ export class ReportAction extends Action {
await item.report({reason: truncatedContent});
// due to reddit not updating this in response (maybe)?? just increment stale activity
item.num_reports++;
await this.resources.resetCacheForItem(item);
touchedEntities.push(item);
}

View File

@@ -33,16 +33,26 @@ export class FlairAction extends Action {
if(this.css !== '') {
flairParts.push(`CSS: ${this.css}`);
}
if(this.flair_template_id !== '') {
flairParts.push(`Template: ${this.flair_template_id}`);
}
const flairSummary = flairParts.length === 0 ? 'No flair (unflaired)' : flairParts.join(' | ');
this.logger.verbose(flairSummary);
if (item instanceof Submission) {
if(!this.dryRun) {
if (this.flair_template_id) {
await item.selectFlair({flair_template_id: this.flair_template_id}).then(() => {});
// typings are wrong for this function, flair_template_id should be accepted
// assignFlair uses /api/flair (mod endpoint)
// selectFlair uses /api/selectflair (self endpoint for user to choose their own flair for submission)
// @ts-ignore
await item.assignFlair({flair_template_id: this.flair_template_id}).then(() => {});
item.link_flair_template_id = this.flair_template_id;
} else {
await item.assignFlair({text: this.text, cssClass: this.css}).then(() => {});
item.link_flair_css_class = this.css;
item.link_flair_text = this.text;
}
await this.resources.resetCacheForItem(item);
}
} else {
this.logger.warn('Cannot flair Comment');

View File

@@ -12,7 +12,7 @@ export class UserFlairAction extends Action {
super(options);
this.text = options.text === null || options.text === '' ? undefined : options.text;
this.css = options.css === null || options.text === '' ? undefined : options.text;
this.css = options.css === null || options.css === '' ? undefined : options.css;
this.flair_template_id = options.flair_template_id === null || options.flair_template_id === '' ? undefined : options.flair_template_id;
}
@@ -41,7 +41,7 @@ export class UserFlairAction extends Action {
const flairSummary = flairParts.length === 0 ? 'Unflair user' : flairParts.join(' | ');
this.logger.verbose(flairSummary);
if (!this.dryRun) {
if (!dryRun) {
if (this.flair_template_id !== undefined) {
try {
// @ts-ignore
@@ -50,6 +50,7 @@ export class UserFlairAction extends Action {
flairTemplateId: this.flair_template_id,
username: item.author.name,
});
item.author_flair_template_id = this.flair_template_id
} catch (err: any) {
this.logger.error('Either the flair template ID is incorrect or you do not have permission to access it.');
throw err;
@@ -57,6 +58,9 @@ export class UserFlairAction extends Action {
} else if (this.text === undefined && this.css === undefined) {
// @ts-ignore
await item.subreddit.deleteUserFlair(item.author.name);
item.author_flair_css_class = null;
item.author_flair_text = null;
item.author_flair_template_id = null;
} else {
// @ts-ignore
await item.author.assignFlair({
@@ -64,6 +68,12 @@ export class UserFlairAction extends Action {
cssClass: this.css,
text: this.text,
});
item.author_flair_text = this.text ?? null;
item.author_flair_css_class = this.css ?? null;
}
await this.resources.resetCacheForItem(item);
if(typeof item.author !== 'string') {
await this.resources.resetCacheForItem(item.author);
}
}

View File

@@ -33,8 +33,15 @@ export class UserNoteAction extends Action {
if (!this.allowDuplicate) {
const notes = await this.resources.userNotes.getUserNotes(item.author);
const existingNote = notes.find((x) => x.link.includes(item.id));
if (existingNote) {
let existingNote = notes.find((x) => x.link !== null && x.link.includes(item.id));
if(existingNote === undefined && notes.length > 0) {
const lastNote = notes[notes.length - 1];
// possibly notes don't have a reference link so check if last one has same text
if(lastNote.link === null && lastNote.text === renderedContent) {
existingNote = lastNote;
}
}
if (existingNote !== undefined && existingNote.noteType === this.type) {
this.logger.info(`Will not add note because one already exists for this Activity (${existingNote.time.local().format()}) and allowDuplicate=false`);
return {
dryRun,

View File

@@ -1,12 +1,15 @@
import {Comment, Submission} from "snoowrap";
import {Logger} from "winston";
import {RuleResult} from "../Rule";
import {checkAuthorFilter, SubredditResources} from "../Subreddit/SubredditResources";
import {checkAuthorFilter, checkItemFilter, SubredditResources} from "../Subreddit/SubredditResources";
import {ActionProcessResult, ActionResult, ChecksActivityState, TypedActivityStates} from "../Common/interfaces";
import Author, {AuthorOptions} from "../Author/Author";
import {mergeArr} from "../util";
import LoggedError from "../Utils/LoggedError";
import {ExtendedSnoowrap} from '../Utils/SnoowrapClients';
import {ErrorWithCause} from "pony-cause";
import EventEmitter from "events";
import {runCheckOptions} from "../Subreddit/Manager";
export abstract class Action {
name?: string;
@@ -17,6 +20,7 @@ export abstract class Action {
itemIs: TypedActivityStates;
dryRun: boolean;
enabled: boolean;
managerEmitter: EventEmitter;
constructor(options: ActionOptions) {
const {
@@ -33,6 +37,7 @@ export abstract class Action {
exclude = [],
} = {},
itemIs = [],
emitter,
} = options;
this.name = name;
@@ -41,6 +46,7 @@ export abstract class Action {
this.resources = resources;
this.client = client;
this.logger = logger.child({labels: [`Action ${this.getActionUniqueName()}`]}, mergeArr);
this.managerEmitter = emitter;
this.authorIs = {
excludeCondition,
@@ -57,7 +63,8 @@ export abstract class Action {
return this.name === this.getKind() ? this.getKind() : `${this.getKind()} - ${this.name}`;
}
async handle(item: Comment | Submission, ruleResults: RuleResult[], runtimeDryrun?: boolean): Promise<ActionResult> {
async handle(item: Comment | Submission, ruleResults: RuleResult[], options: runCheckOptions): Promise<ActionResult> {
const {dryRun: runtimeDryrun} = options;
const dryRun = runtimeDryrun || this.dryRun;
let actRes: ActionResult = {
@@ -68,17 +75,24 @@ export abstract class Action {
success: false,
};
try {
const itemPass = await this.resources.testItemCriteria(item, this.itemIs);
const [itemPass, itemFilterType, itemFilterResults] = await checkItemFilter(item, this.itemIs, this.resources, this.logger, options.source);
if (!itemPass) {
this.logger.verbose(`Activity did not pass 'itemIs' test, Action not run`);
actRes.runReason = `Activity did not pass 'itemIs' test, Action not run`;
actRes.itemIs = itemFilterResults;
return actRes;
} else if(this.itemIs.length > 0) {
actRes.itemIs = itemFilterResults;
}
const [authFilterResult, authFilterType] = await checkAuthorFilter(item, this.authorIs, this.resources, this.logger);
if(!authFilterResult) {
const [authPass, authFilterType, authorFilterResult] = await checkAuthorFilter(item, this.authorIs, this.resources, this.logger);
if(!authPass) {
this.logger.verbose(`${authFilterType} author criteria not matched, Action not run`);
actRes.runReason = `${authFilterType} author criteria not matched`;
actRes.authorIs = authorFilterResult;
return actRes;
} else if(authFilterType !== undefined) {
actRes.authorIs = authorFilterResult;
}
actRes.run = true;
@@ -86,7 +100,8 @@ export abstract class Action {
return {...actRes, ...results};
} catch (err: any) {
if(!(err instanceof LoggedError)) {
this.logger.error(`Encountered error while running`, err);
const actionError = new ErrorWithCause('Action did not run successfully due to unexpected error', {cause: err});
this.logger.error(actionError);
}
actRes.success = false;
actRes.result = err.message;
@@ -102,6 +117,7 @@ export interface ActionOptions extends ActionConfig {
subredditName: string;
resources: SubredditResources;
client: ExtendedSnoowrap;
emitter: EventEmitter
}
export interface ActionConfig extends ChecksActivityState {
@@ -148,7 +164,7 @@ export interface ActionJson extends ActionConfig {
/**
* The type of action that will be performed
*/
kind: 'comment' | 'lock' | 'remove' | 'report' | 'approve' | 'ban' | 'flair' | 'usernote' | 'message' | 'userflair'
kind: 'comment' | 'lock' | 'remove' | 'report' | 'approve' | 'ban' | 'flair' | 'usernote' | 'message' | 'userflair' | 'dispatch' | 'cancelDispatch'
}
export const isActionJson = (obj: object): obj is ActionJson => {

View File

@@ -1,7 +1,7 @@
import winston, {Logger} from "winston";
import dayjs, {Dayjs} from "dayjs";
import {getLogger} from "./Utils/loggerFactory";
import {Invokee, OperatorConfig} from "./Common/interfaces";
import {Invokee, OperatorConfig, OperatorConfigWithFileContext, OperatorFileConfig} from "./Common/interfaces";
import Bot from "./Bot";
import LoggedError from "./Utils/LoggedError";
import {sleep} from "./util";
@@ -14,7 +14,10 @@ export class App {
error: any;
constructor(config: OperatorConfig) {
config: OperatorConfig;
fileConfig: OperatorFileConfig;
constructor(config: OperatorConfigWithFileContext) {
const {
operator: {
name,
@@ -23,6 +26,11 @@ export class App {
bots = [],
} = config;
const {fileConfig, ...rest} = config;
this.config = rest;
this.fileConfig = fileConfig;
this.logger = getLogger(config.logging);
this.logger.info(`Operators: ${name.length === 0 ? 'None Specified' : name.join(', ')}`)

View File

@@ -46,15 +46,31 @@ export interface AuthorCriteria {
* */
name?: string[],
/**
* A list of (user) flair css class values from the subreddit to match against
* A (user) flair css class (or list of) from the subreddit to match against
*
* * If `true` then passes if ANY css is assigned
* * If `false` then passes if NO css is assigned
* @examples ["red"]
* */
flairCssClass?: string[],
flairCssClass?: boolean | string | string[],
/**
* A list of (user) flair text values from the subreddit to match against
* A (user) flair text value (or list of) from the subreddit to match against
*
* * If `true` then passes if ANY text is assigned
* * If `false` then passes if NO text is assigned
*
* @examples ["Approved"]
* */
flairText?: string[],
flairText?: boolean | string | string[],
/**
* A (user) flair template id (or list of) from the subreddit to match against
*
* * If `true` then passes if ANY template is assigned
* * If `false` then passed if NO template is assigned
*
* */
flairTemplate?: boolean | string | string[]
/**
* Is the author a moderator?
* */
@@ -132,8 +148,8 @@ export interface AuthorCriteria {
export class Author implements AuthorCriteria {
name?: string[];
flairCssClass?: string[];
flairText?: string[];
flairCssClass?: boolean | string[];
flairText?: boolean | string[];
isMod?: boolean;
userNotes?: UserNoteCriteria[];
age?: string;
@@ -146,8 +162,12 @@ export class Author implements AuthorCriteria {
constructor(options: AuthorCriteria) {
this.name = options.name;
this.flairCssClass = options.flairCssClass;
this.flairText = options.flairText;
if(options.flairCssClass !== undefined) {
this.flairCssClass = typeof options.flairCssClass === 'string' ? [options.flairCssClass] : options.flairCssClass;
}
if(options.flairText !== undefined) {
this.flairText = typeof options.flairText === 'string' ? [options.flairText] : options.flairText;
}
this.isMod = options.isMod;
this.userNotes = options.userNotes;
this.age = options.age;

Some files were not shown because too many files have changed in this diff Show More