Closed CryptoMaximalist closed 1 year ago
Maybe this affects modNotes too. They were working before but now getting a similar error. The post above was on the 'latest' docker, but I'm currently on the 'edge'
actions:
- kind: modnote # Leave a Mod Note to prevent repeat alerts for this user
type: SPAM_WATCH
content: >-
User has {{rules.freekarmarule.totalCount}} activities in {{rules.freekarmarule.subCount}} freekarma sub(s)
referenceActivity: true
20:14:36 CDT verbose: [COM itstfbf] Reddit API Stats: Initial 554 | Current 550 | Used ~4 | Events ~0.17/s
20:14:36 CDT verbose: [COM itstfbf] Run Stats: Checks 0 | Rules => Total: 0 Unique: 2 Cached: -2 Rolling Avg: ~0.16/s | Actions 0
20:14:35 CDT debug : [COM itstfbf] [RUN BurstpostRun] Skipping b/c Run did not contain any comment Checks
20:14:35 CDT debug : [COM itstfbf] [RUN OtherSubsRun] [CHK FreekarmaComments] [Post Check Trigger] Behavior => NEXT RUN => Skip remaining checks and go to next Run
20:14:35 CDT info : [COM itstfbf] [RUN OtherSubsRun] [CHK FreekarmaComments] Ran Actions: Report - report | Remove - remove | Modnote - modnote
20:14:35 CDT error : [COM itstfbf] [RUN OtherSubsRun] [CHK FreekarmaComments] [Action Modnote] Action did not run successfully due to unexpected error
ErrorWithCause:
at ModNoteAction.handle (/app/src/Action/index.js:123:37)
at async CommentCheck.runActions (/app/src/Check/index.js:496:29)
at async CommentCheck.handle (/app/src/Check/index.js:330:49)
at async Run.handle (/app/src/Run/index.js:156:38)
at async Manager.handleActivity (/app/src/Subreddit/Manager.js:852:51)
at async /app/src/Subreddit/Manager.js:364:17
caused by: TypeError: Cannot read properties of undefined (reading 'trim')
at parseRedditFullname (/app/src/util.js:2494:26)
at new ModNote (/app/src/Subreddit/ModNotes/ModNote.js:30:56)
at /app/src/Subreddit/SubredditResources.js:660:34
at [Array.map](http://array.map/) (<anonymous>)
at SubredditResources.getAuthorModNotes (/app/src/Subreddit/SubredditResources.js:659:42)
20:14:35 CDT debug : [COM itstfbf] [Resources] Cache Hit: Author ModNotes throwawayyyyyy78901 in CryptoCurrency
20:14:35 CDT verbose: [COM itstfbf] [RUN OtherSubsRun] [CHK FreekarmaComments] [Action Modnote] Note:
(SPAM_WATCH) User has 12 activities in 1 freekarma sub(s)
20:14:35 CDT info : [COM itstfbf] [RUN OtherSubsRun] [CHK FreekarmaComments] [Action Remove] Not run because it is not enabled.
20:14:34 CDT verbose: [COM itstfbf] [RUN OtherSubsRun] [CHK FreekarmaComments] [Action Report] Contents:
User has 12 activities in 1 freekarma sub(s)
20:14:34 CDT debug : [COM itstfbf] [RUN OtherSubsRun] [CHK FreekarmaComments] Running Actions
20:14:34 CDT info : [COM itstfbf] [RUN OtherSubsRun] [CHK FreekarmaComments] ✓ => Rules: ✓ Recent - FreeKarmaRule AND ✓ Author - hasNoFreeKarmaNotes
20:14:34 CDT debug : [COM itstfbf] [RUN OtherSubsRun] [CHK FreekarmaComments] [Rule Author - hasNoFreeKarmaNotes] [Author Filter] Criteria Details:
im looking into this...i merged some code earlier last week that seems to have "erased" some earlier(er) changes silently. It was causing problems in the same area (authorIs). Checking to see if that is the issue.
This should be fixed now in edge
@CryptoMaximalist
Thanks! I don't see that error anymore, but I see another one at the debug level and on the verbose level it seems to be deciding not to complete the ModNote action (which is weird because there's no conditions on the Action). This happens even on users with no modnotes at all. The report Action does go through though
- name: FreeKarmaRule
kind: recentActivity
window:
count: 100
duration: 1 year
useSubmissionAsReference: false
thresholds:
- subreddits:
- FreeKarma4U
- FreeKarma4You
- KarmaStore
- upvote
- name: hasNoFreeKarmaNotes
kind: author
include:
- isContributor: false
modActions:
- note: '/freekarma/i'
noteType: SPAM_WATCH
search: total
count: "< 1 in 1 year"
actions:
- kind: modnote # Leave a Mod Note to prevent repeat alerts for this user
type: SPAM_WATCH
content: >-
User has {{rules.freekarmarule.totalCount}} activities in {{rules.freekarmarule.subCount}} freekarma sub(s)
referenceActivity: true
Verbose weblog:
12:03:12 CDT verbose: {r/CryptoMarkets} [COM itvl4lx] Reddit API Stats: Initial 539 | Current 536 | Used ~3 | Events ~0.01/s
12:03:12 CDT verbose: {r/CryptoMarkets} [COM itvl4lx] Run Stats: Checks 0 | Rules => Total: 0 Unique: 2 Cached: -2 Rolling Avg: ~0.01/s | Actions 0
12:03:12 CDT info : {r/CryptoMarkets} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] Ran Actions: Report - report | Remove - remove | Modnote - modnote
12:03:12 CDT info : {r/CryptoMarkets} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] [Action Modnote] Will not add note because existing note check condition failed -- modActions => ✘ => Expected: < 1 of current notes is noteType: SPAM_WATCH || note: User has {{rules.freekarmarule.totalCount}} activities in {{rules.freekarmarule.subCount}} freekarma sub(s) || referencesCurrentActivity: true => Found: No Mod Actions present
12:03:12 CDT verbose: {r/CryptoMarkets} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] [Action Modnote] Note:
(SPAM_WATCH) User has 9 activities in 1 freekarma sub(s)
12:03:12 CDT info : {r/CryptoMarkets} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] [Action Remove] Not run because it is not enabled.
12:03:11 CDT verbose: {r/CryptoMarkets} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] [Action Report] Contents:
User has 9 activities in 1 freekarma sub(s)
12:03:11 CDT info : {r/CryptoMarkets} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] ✓ => Rules: ✓ Recent - FreeKarmaRule AND ✓ Author - hasNoFreeKarmaNotes
12:03:11 CDT verbose: {r/CryptoMarkets} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] [Rule Author - hasNoFreeKarmaNotes] [Author Filter] ✓ => Inclusive Author Criteria 1 => 2 Passed (isContributor,modActions) | 0 Failed
12:03:11 CDT verbose: {r/CryptoMarkets} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] [Rule Recent - FreeKarmaRule] ✓ 9 activities found in 1 of the specified subreddits (out of 22 total) MET threshold of >= 1 activities -- subreddits: FreeKarma4You
12:03:11 CDT verbose: {r/CryptoMarkets} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] [Author Filter] ✓ => Exclusive author criteria matched => 1 Passed (isMod) | 0 Failed
12:03:10 CDT verbose: {r/CryptoMarkets} [COM itvl4lx] [RUN OtherSubsRun] [Author Filter] ✓ => Exclusive author criteria matched => 1 Passed (isMod) | 0 Failed
12:03:10 CDT info : {r/CryptoMarkets} [COM itvl4lx] <EVENT> (Dispatched by undefined | newComm) i left that school where u learned money is time cus time equals money squared by cruxxxx in https://reddit.com/r/CryptoMarkets/comments/ydqza1/mainstream_adoption_is_happening_slowly_but_surely/itvl4lx/
12:03:07 CDT info : [App] CryptoContextModBot from localhost:8095 => CONNECTED
12:02:42 CDT verbose: {r/CryptoCurrency} [COM itvl2cm] Reddit API Stats: Initial 545 | Current 544 | Used ~1 | Events
Debug file log:
2022-10-26T17:19:54+00:00 info : ~u/CryptoContextModBot~ {r/CryptoCurrency} /u/CryptoContextModBot Queued DRY RUN check on FOREIGN ACTIVITY https://www.reddit.com/r/CryptoMarkets/comments/ydqza1/mainstream_adoption_is_happening_slowly_but_surely/itvl4lx/
2022-10-26T17:19:54+00:00 info : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] <EVENT> (Dispatched by undefined | CryptoContextModBot) i left that school where u learned money is time cus time equals money squared by cruxxxx in https://reddit.com/r/CryptoMarkets/comments/ydqza1/mainstream_adoption_is_happening_slowly_but_surely/itvl4lx/
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [RUN SpamRun] Skipping b/c Run did not contain any comment Checks
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [Resources] Cache Hit: Author Check on cruxxxx (Hash authorCrit-CryptoCurrency-cruxxxx-4d05f2d5b644fc00947bbeccc279c0d8994683d4)
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [RUN OtherSubsRun] [Author Filter] ✓ (AND) => Exclusive Author Criteria 1 => 1 Passed (isMod) | 0 Failed
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [RUN OtherSubsRun] [Author Filter] Criteria Details:
isMod => ✓ => Expected: true => Found: false (Exclude passes when Expected is not Found)
2022-10-26T17:19:54+00:00 verbose: ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [RUN OtherSubsRun] [Author Filter] ✓ => Exclusive author criteria matched => 1 Passed (isMod) | 0 Failed
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [Resources] Cache Hit: Author Check on cruxxxx (Hash authorCrit-CryptoCurrency-cruxxxx-4d05f2d5b644fc00947bbeccc279c0d8994683d4)
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] [Author Filter] ✓ (AND) => Exclusive Author Criteria 1 => 1 Passed (isMod) | 0 Failed
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] [Author Filter] Criteria Details:
isMod => ✓ => Expected: true => Found: false (Exclude passes when Expected is not Found)
2022-10-26T17:19:54+00:00 verbose: ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] [Author Filter] ✓ => Exclusive author criteria matched => 1 Passed (isMod) | 0 Failed
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [Resources] [Activities Fetch] 100 Activities From Cache (1 API Calls saved! ) | 100 Met Window Range After Pre Filter | Cache Fingerprint: cruxxxx-overview-75b9fda44af6ea8b0029c20dbc4d6ef4ae5cb3f4
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [Resources] [Subreddit Check] Passed: {"name":{}}
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [Resources] [Subreddit Check] Passed: {"name":{}}
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [Resources] [Subreddit Check] Passed: {"name":{}}
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [Resources] [Subreddit Check] Passed: {"name":{}}
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [Resources] [Subreddit Check] Passed: {"name":{}}
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [Resources] [Subreddit Check] Passed: {"name":{}}
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [Resources] [Subreddit Check] Passed: {"name":{}}
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [Resources] [Subreddit Check] Passed: {"name":{}}
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [Resources] [Subreddit Check] Passed: {"name":{}}
2022-10-26T17:19:54+00:00 verbose: ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] [Rule Recent - FreeKarmaRule] ✓ 9 activities found in 1 of the specified subreddits (out of 21 total) MET threshold of >= 1 activities -- subreddits: FreeKarma4You
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [Resources] Cache Hit: Subreddit Contributors CryptoCurrency
2022-10-26T17:19:54+00:00 error : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] [Rule Author - hasNoFreeKarmaNotes] Error occurred while processing rule
2022-10-26T17:19:54+00:00 warn : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] [CHK FreekarmaComments] Running rules failed due to uncaught exception
ErrorWithCause:
at CommentCheck.handle (/app/src/Check/index.js:312:45)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Run.handle (/app/src/Run/index.js:156:38)
at async Manager.handleActivity (/app/src/Subreddit/Manager.js:852:51)
at async /app/src/Subreddit/Manager.js:364:17
caused by: ErrorWithCause: Running rules failed due to error
at CommentCheck.runRules (/app/src/Check/index.js:486:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async CommentCheck.handle (/app/src/Check/index.js:300:44)
at async Run.handle (/app/src/Run/index.js:156:38)
at async Manager.handleActivity (/app/src/Subreddit/Manager.js:852:51)
at async /app/src/Subreddit/Manager.js:364:17
caused by: SimpleError: Can only get Modnotes for current moderator subreddit, Activity is from CryptoMarkets
at SubredditResources.getAuthorModNotesByActivityAuthor (/app/src/Subreddit/SubredditResources.js:647:19)
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [RUN OtherSubsRun] [CHK FreekarmaComments] [Post Check Fail] Behavior => NEXT => Run next check
2022-10-26T17:19:54+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] [RUN BurstpostRun] Skipping b/c Run did not contain any comment Checks
2022-10-26T17:19:54+00:00 verbose: ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] No checks triggered
2022-10-26T17:19:54+00:00 verbose: ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itvl4lx] Run Stats: Checks 0 | Rules => Total: 0 Unique: 0 Cached: 0 Rolling Avg: ~0.06/s | Actions 0
EDIT: Can confirm writing usernotes is working now though. However, reading notes doesn't seem to find any. A user with 36 of these notes reports as having 0
- name: hasNoFreeKarmaNotes
kind: author
exclude:
- userNotes:
- note: '/freekarma/i'
type: spamwatch
search: total
count: "> 0 in 1 year"
2022-10-26T19:11:34+00:00 debug : ~u/CryptoContextModBot~ [Snoowrap] Received a 200 status code from a `get` request sent to https://oauth.reddit.com/api/mod/notes?raw_json=1&subreddit=CryptoCurrency&user=HaroldFish&limit=100. ratelimitRemaining: 584
2022-10-26T19:11:34+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itw20cn] [RUN OtherSubsRun] [CHK FreekarmaComments] [Rule Author - hasNoFreeKarmaNotes] [Author Filter] ✓ (AND) => Exclusive Author Criteria 1 => 1 Passed (modActions) | 0 Failed
2022-10-26T19:11:34+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itw20cn] [RUN OtherSubsRun] [CHK FreekarmaComments] [Rule Author - hasNoFreeKarmaNotes] [Author Filter] Criteria Details:
modActions => ✓ => Expected: > 0 in 1 year of total notes is note: /freekarma/i || noteType: SPAM_WATCH => Found: 0 matched criteria (Exclude passes when Expected is not Found)
2022-10-26T19:11:34+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itw20cn] [Resources] Returned cached notes
2022-10-26T19:11:34+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itw20cn] [RUN OtherSubsRun] [CHK FreekarmaComments] [Rule Author - hasNoFreeKarmaNotes] [Author Filter] ✓ (AND) => Exclusive Author Criteria 2 => 1 Passed (userNotes) | 0 Failed
2022-10-26T19:11:34+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itw20cn] [RUN OtherSubsRun] [CHK FreekarmaComments] [Rule Author - hasNoFreeKarmaNotes] [Author Filter] Criteria Details:
userNotes => ✓ => Expected: > 0 in 1 year of total notes is spamwatch => Found: 0 are spamwatch (Exclude passes when Expected is not Found)
2022-10-26T19:11:34+00:00 verbose: ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itw20cn] [RUN OtherSubsRun] [CHK FreekarmaComments] [Rule Author - hasNoFreeKarmaNotes] [Author Filter] ✓ => Exclusive author criteria matched => (many, see debug)
2022-10-26T19:11:34+00:00 info : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itw20cn] [RUN OtherSubsRun] [CHK FreekarmaComments] ✓ => Rules: ✓ Recent - FreeKarmaRule AND ✓ Author - AuthorNotWhitelisted AND ✓ Author - hasNoFreeKarmaNotes
2022-10-26T19:11:34+00:00 debug : ~u/CryptoContextModBot~ {r/CryptoCurrency} [COM itw20cn] [RUN OtherSubsRun] [CHK FreekarmaComments] Running Actions
I need permalinks for these activities alongside the logs, i can't fetch the activity (for comments) just from ids in the log.
Sure, links added under each log snippet
@CryptoMaximalist I've deployed changes to edge
which should fix usernote filtering and hopefully also mod note action.
Just FYI for mod/user note action -- by default CM will not add a note if it the current note for the user matches the same criteria as in the action. So type
content
and referenceActivity
-- those all "match" the current note then another note is not added. If you want to add duplicates then add existingNoteCheck: false
to your note action.
Thanks! After about an hour of testing, I can say reading and writing both UserNotes and ModNotes is working again! And I don't have any other errors in my logs either
I'm trying out usernotes instead of modnotes to possibly reduce API hits, and running a very barebones config: https://pastebin.com/GbggRW4m
I'm using the sample code to add a usernote from here: https://github.com/FoxxMD/context-mod/blob/master/docs/subreddit/components/userNotes/usernoteSP.yaml
Below is the logs error: