File tree 4 files changed +10
-33
lines changed
4 files changed +10
-33
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ concatenated-output.ts
9
9
embedding-cache.json
10
10
packages /plugin-buttplug /intiface-engine
11
11
12
+ .idea
12
13
.DS_Store
13
14
14
15
dist /
Original file line number Diff line number Diff line change @@ -387,12 +387,8 @@ export async function initializeClients(
387
387
388
388
if ( clientTypes . includes ( Clients . TWITTER ) ) {
389
389
const twitterClient = await TwitterClientInterface . start ( runtime ) ;
390
-
391
390
if ( twitterClient ) {
392
391
clients . twitter = twitterClient ;
393
- ( twitterClient as any ) . enableSearch = ! isFalsish (
394
- getSecret ( character , "TWITTER_SEARCH_ENABLE" )
395
- ) ;
396
392
}
397
393
}
398
394
@@ -434,31 +430,6 @@ export async function initializeClients(
434
430
return clients ;
435
431
}
436
432
437
- function isFalsish ( input : any ) : boolean {
438
- // If the input is exactly NaN, return true
439
- if ( Number . isNaN ( input ) ) {
440
- return true ;
441
- }
442
-
443
- // Convert input to a string if it's not null or undefined
444
- const value = input == null ? "" : String ( input ) ;
445
-
446
- // List of common falsish string representations
447
- const falsishValues = [
448
- "false" ,
449
- "0" ,
450
- "no" ,
451
- "n" ,
452
- "off" ,
453
- "null" ,
454
- "undefined" ,
455
- "" ,
456
- ] ;
457
-
458
- // Check if the value (trimmed and lowercased) is in the falsish list
459
- return falsishValues . includes ( value . trim ( ) . toLowerCase ( ) ) ;
460
- }
461
-
462
433
function getSecret ( character : Character , secret : string ) {
463
434
return character . settings ?. secrets ?. [ secret ] || process . env [ secret ] ;
464
435
}
Original file line number Diff line number Diff line change @@ -34,12 +34,15 @@ export const TwitterClientInterface: Client = {
34
34
35
35
elizaLogger . log ( "Twitter client started" ) ;
36
36
37
- const manager = new TwitterManager ( runtime , this . enableSearch ) ;
37
+ const manager = new TwitterManager ( runtime , runtime . getSetting ( "TWITTER_SEARCH_ENABLE" ) . toLowerCase ( ) === "true" ) ;
38
38
39
39
await manager . client . init ( ) ;
40
40
41
41
await manager . post . start ( ) ;
42
42
43
+ if ( manager . search )
44
+ await manager . search . start ( ) ;
45
+
43
46
await manager . interaction . start ( ) ;
44
47
45
48
await manager . search ?. start ( ) ;
Original file line number Diff line number Diff line change 1
1
import { SearchMode } from "agent-twitter-client" ;
2
- import { composeContext } from "@elizaos/core" ;
2
+ import { composeContext , elizaLogger } from "@elizaos/core" ;
3
3
import { generateMessageResponse , generateText } from "@elizaos/core" ;
4
4
import { messageCompletionFooter } from "@elizaos/core" ;
5
5
import {
@@ -59,10 +59,12 @@ export class TwitterSearchClient {
59
59
}
60
60
61
61
private engageWithSearchTermsLoop ( ) {
62
- this . engageWithSearchTerms ( ) ;
62
+ this . engageWithSearchTerms ( ) . then ( ) ;
63
+ const randomMinutes = ( Math . floor ( Math . random ( ) * ( 120 - 60 + 1 ) ) + 60 ) ;
64
+ elizaLogger . log ( `Next twitter search scheduled in ${ randomMinutes } minutes` ) ;
63
65
setTimeout (
64
66
( ) => this . engageWithSearchTermsLoop ( ) ,
65
- ( Math . floor ( Math . random ( ) * ( 120 - 60 + 1 ) ) + 60 ) * 60 * 1000
67
+ randomMinutes * 60 * 1000
66
68
) ;
67
69
}
68
70
You can’t perform that action at this time.
0 commit comments