2024-09-09 11:25:51 +02:00
import asyncio
2024-05-28 20:29:11 +02:00
import json
2024-03-05 16:04:02 +01:00
import os
2024-03-18 23:49:55 +01:00
import threading
2024-03-05 16:04:02 +01:00
from pathlib import Path
import dotenv
2024-11-28 08:39:48 +01:00
from nostr_sdk import init_logger , LogLevel , Keys
2024-03-05 16:04:02 +01:00
2024-11-14 12:51:38 +01:00
# os.environ["RUST_BACKTRACE"] = "full"
from nostr_dvm . subscription import Subscription
2024-06-09 17:10:44 +02:00
from nostr_dvm . tasks . content_discovery_currently_latest_longform import DicoverContentLatestLongForm
2024-07-19 12:07:18 +02:00
from nostr_dvm . tasks . content_discovery_currently_latest_wiki import DicoverContentLatestWiki
2024-11-14 12:51:38 +01:00
from nostr_dvm . tasks . content_discovery_currently_popular import DicoverContentCurrentlyPopular
from nostr_dvm . tasks . content_discovery_currently_popular_by_top_zaps import DicoverContentCurrentlyPopularZaps
from nostr_dvm . tasks . content_discovery_currently_popular_followers import DicoverContentCurrentlyPopularFollowers
2024-07-25 09:31:38 +02:00
from nostr_dvm . tasks . content_discovery_currently_popular_gallery import DicoverContentCurrentlyPopularGallery
2024-07-17 09:53:14 +02:00
from nostr_dvm . tasks . content_discovery_currently_popular_mostr import DicoverContentCurrentlyPopularMostr
2024-07-11 10:10:42 +02:00
from nostr_dvm . tasks . content_discovery_currently_popular_nonfollowers import DicoverContentCurrentlyPopularNonFollowers
2024-11-14 12:51:38 +01:00
from nostr_dvm . tasks . content_discovery_currently_popular_topic import DicoverContentCurrentlyPopularbyTopic
2024-08-20 18:33:12 +02:00
from nostr_dvm . tasks . content_discovery_latest_one_per_follower import Discoverlatestperfollower
2024-06-04 20:15:20 +02:00
from nostr_dvm . tasks . content_discovery_update_db_only import DicoverContentDBUpdateScheduler
2024-05-28 20:29:11 +02:00
from nostr_dvm . tasks . discovery_trending_notes_nostrband import TrendingNotesNostrBand
2024-03-05 16:04:02 +01:00
from nostr_dvm . utils . admin_utils import AdminConfig
2024-11-26 19:52:41 +01:00
from nostr_dvm . utils . database_utils import init_db
2024-05-28 20:29:11 +02:00
from nostr_dvm . utils . dvmconfig import build_default_config , DVMConfig
2024-07-11 10:10:42 +02:00
from nostr_dvm . utils . nip88_utils import NIP88Config , check_and_set_d_tag_nip88 , check_and_set_tiereventid_nip88
2024-05-28 20:29:11 +02:00
from nostr_dvm . utils . nip89_utils import create_amount_tag , NIP89Config , check_and_set_d_tag
2024-03-18 19:44:44 +01:00
from nostr_dvm . utils . nostr_utils import check_and_set_private_key
2024-06-16 08:34:58 +02:00
from nostr_dvm . utils . outbox_utils import AVOID_OUTBOX_RELAY_LIST
2024-03-18 19:44:44 +01:00
from nostr_dvm . utils . zap_utils import check_and_set_ln_bits_keys
2024-03-05 16:04:02 +01:00
2024-11-14 12:51:38 +01:00
rebroadcast_NIP89 = False # Announce NIP89 on startup Only do this if you know what you're doing.
2024-08-20 18:33:12 +02:00
rebroadcast_NIP65_Relay_List = True
2024-06-03 20:24:29 +02:00
update_profile = False
2024-11-14 12:51:38 +01:00
global_update_rate = 180 # set this high on first sync so db can fully sync before another process trys to.
2024-09-10 09:20:22 +02:00
use_logger = True
2024-10-04 17:17:26 +02:00
log_level = LogLevel . ERROR
2024-11-19 23:57:22 +01:00
max_sync_duration_in_h = 24
2024-05-30 21:06:25 +02:00
2024-11-14 12:51:38 +01:00
SYNC_DB_RELAY_LIST = [ " wss://relay.damus.io " ,
#"wss://relay.primal.net",
" wss://nostr.oxtr.dev " ]
2024-06-16 08:34:58 +02:00
2024-11-14 12:51:38 +01:00
RELAY_LIST = [ " wss://nostr.mom " ,
#"wss://relay.primal.net",
2024-11-13 16:06:53 +01:00
" wss://nostr.oxtr.dev " ,
2024-11-16 11:56:15 +01:00
#"wss://relay.nostr.net"
2024-08-12 15:55:12 +02:00
]
2024-06-06 13:55:47 +02:00
2024-05-31 16:25:56 +02:00
if use_logger :
2024-07-17 09:53:14 +02:00
init_logger ( log_level )
2024-06-04 20:15:20 +02:00
def build_db_scheduler ( name , identifier , admin_config , options , image , description , update_rate = 600 , cost = 0 ,
2024-11-14 12:51:38 +01:00
processing_msg = None , update_db = True , database = None ) :
2024-06-04 20:15:20 +02:00
dvm_config = build_default_config ( identifier )
dvm_config . USE_OWN_VENV = False
dvm_config . SHOWLOG = True
dvm_config . SCHEDULE_UPDATES_SECONDS = update_rate # Every 10 minutes
dvm_config . UPDATE_DATABASE = update_db
2024-06-13 10:49:09 +02:00
dvm_config . LOGLEVEL = LogLevel . INFO
2024-11-13 16:06:53 +01:00
dvm_config . SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST
2024-08-12 15:55:12 +02:00
dvm_config . RELAY_LIST = RELAY_LIST
2024-09-09 11:25:51 +02:00
dvm_config . DATABASE = database
2024-09-19 11:55:34 +02:00
dvm_config . WOT_FILTERING = True
2024-06-13 14:39:13 +02:00
2024-06-04 20:15:20 +02:00
# Activate these to use a subscription based model instead
# dvm_config.SUBSCRIPTION_REQUIRED = True
# dvm_config.SUBSCRIPTION_DAILY_COST = 1
dvm_config . FIX_COST = cost
dvm_config . CUSTOM_PROCESSING_MESSAGE = processing_msg
admin_config . LUD16 = dvm_config . LN_ADDRESS
# Add NIP89
nip89info = {
" name " : name ,
" picture " : image ,
" about " : description ,
" lud16 " : dvm_config . LN_ADDRESS ,
2024-11-22 19:18:44 +01:00
" supportsEncryption " : True ,
" acceptsNutZaps " : dvm_config . ENABLE_NUTZAP ,
2024-06-04 20:15:20 +02:00
" personalized " : False ,
" amount " : create_amount_tag ( cost ) ,
" nip90Params " : {
" max_results " : {
" required " : False ,
" values " : [ ] ,
" description " : " The number of maximum results to return (default currently 100) "
}
}
}
nip89config = NIP89Config ( )
2024-11-22 11:14:39 +01:00
nip89config . DTAG = check_and_set_d_tag ( identifier , name , dvm_config . PRIVATE_KEY , nip89info [ " picture " ] )
2024-06-04 20:15:20 +02:00
nip89config . CONTENT = json . dumps ( nip89info )
return DicoverContentDBUpdateScheduler ( name = name , dvm_config = dvm_config , nip89config = nip89config ,
admin_config = admin_config , options = options )
2024-07-25 09:31:38 +02:00
def build_example_gallery ( name , identifier , admin_config , options , image , cost = 0 , update_rate = 180 , processing_msg = None ,
2024-11-14 12:51:38 +01:00
update_db = True ) :
2024-07-25 09:31:38 +02:00
dvm_config = build_default_config ( identifier )
dvm_config . USE_OWN_VENV = False
dvm_config . LOGLEVEL = LogLevel . INFO
# dvm_config.SHOWLOG = True
dvm_config . SCHEDULE_UPDATES_SECONDS = update_rate # Every 10 minutes
dvm_config . UPDATE_DATABASE = update_db
2024-11-13 16:06:53 +01:00
dvm_config . SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST
2024-08-12 15:55:12 +02:00
dvm_config . RELAY_LIST = RELAY_LIST
2024-11-16 11:56:15 +01:00
dvm_config . SEND_FEEDBACK_EVENTS = False
2024-07-25 09:31:38 +02:00
dvm_config . FIX_COST = cost
dvm_config . CUSTOM_PROCESSING_MESSAGE = processing_msg
admin_config . LUD16 = dvm_config . LN_ADDRESS
# Add NIP89
nip89info = {
" name " : name ,
" picture " : image ,
" about " : " I show popular gallery entries " ,
" lud16 " : dvm_config . LN_ADDRESS ,
2024-11-22 19:18:44 +01:00
" supportsEncryption " : True ,
" acceptsNutZaps " : dvm_config . ENABLE_NUTZAP ,
2024-07-25 09:31:38 +02:00
" personalized " : True ,
" amount " : create_amount_tag ( cost ) ,
" nip90Params " : {
" max_results " : {
" required " : False ,
" values " : [ ] ,
" description " : " The number of maximum results to return (default currently 200) "
}
}
}
nip89config = NIP89Config ( )
2024-11-22 11:14:39 +01:00
nip89config . DTAG = check_and_set_d_tag ( identifier , name , dvm_config . PRIVATE_KEY , nip89info [ " picture " ] )
2024-07-25 09:31:38 +02:00
nip89config . CONTENT = json . dumps ( nip89info )
return DicoverContentCurrentlyPopularGallery ( name = name , dvm_config = dvm_config , nip89config = nip89config ,
admin_config = admin_config , options = options )
2024-05-28 20:29:11 +02:00
def build_example_nostrband ( name , identifier , admin_config , image , about , custom_processing_msg ) :
dvm_config : DVMConfig = build_default_config ( identifier )
dvm_config . USE_OWN_VENV = False
dvm_config . CUSTOM_PROCESSING_MESSAGE = custom_processing_msg
2024-11-13 16:06:53 +01:00
dvm_config . AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST
dvm_config . SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST
2024-08-12 15:55:12 +02:00
dvm_config . RELAY_LIST = RELAY_LIST
2024-06-13 10:49:09 +02:00
dvm_config . LOGLEVEL = LogLevel . INFO
2024-11-16 11:56:15 +01:00
dvm_config . SEND_FEEDBACK_EVENTS = False
2024-05-28 20:29:11 +02:00
admin_config . LUD16 = dvm_config . LN_ADDRESS
# Add NIP89
nip89info = {
" name " : name ,
" picture " : image ,
" about " : about ,
" amount " : " Free " ,
2024-11-22 19:18:44 +01:00
" supportsEncryption " : True ,
" acceptsNutZaps " : dvm_config . ENABLE_NUTZAP ,
2024-05-28 20:29:11 +02:00
" nip90Params " : { }
}
nip89config = NIP89Config ( )
2024-11-22 11:14:39 +01:00
nip89config . DTAG = check_and_set_d_tag ( identifier , name , dvm_config . PRIVATE_KEY , nip89info [ " picture " ] )
2024-05-28 20:29:11 +02:00
nip89config . CONTENT = json . dumps ( nip89info )
return TrendingNotesNostrBand ( name = name , dvm_config = dvm_config , nip89config = nip89config ,
admin_config = admin_config )
2024-06-09 17:10:44 +02:00
def build_longform ( name , identifier , admin_config , options , cost = 0 , update_rate = 180 , processing_msg = None ,
2024-11-14 12:51:38 +01:00
update_db = True ) :
2024-06-09 17:10:44 +02:00
dvm_config = build_default_config ( identifier )
dvm_config . USE_OWN_VENV = False
dvm_config . SHOWLOG = True
dvm_config . SCHEDULE_UPDATES_SECONDS = update_rate # Every 10 minutes
dvm_config . UPDATE_DATABASE = update_db
2024-11-13 16:06:53 +01:00
dvm_config . AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST
dvm_config . SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST
2024-08-12 15:55:12 +02:00
dvm_config . RELAY_LIST = RELAY_LIST
2024-11-16 11:56:15 +01:00
dvm_config . SEND_FEEDBACK_EVENTS = False
2024-06-13 10:49:09 +02:00
dvm_config . LOGLEVEL = LogLevel . INFO
2024-06-09 17:10:44 +02:00
# Activate these to use a subscription based model instead
# dvm_config.SUBSCRIPTION_REQUIRED = True
# dvm_config.SUBSCRIPTION_DAILY_COST = 1
dvm_config . FIX_COST = cost
dvm_config . CUSTOM_PROCESSING_MESSAGE = processing_msg
admin_config . LUD16 = dvm_config . LN_ADDRESS
image = " https://image.nostr.build/d30a75c438a8b0815b5c65b494988da26fce719f4138058929fa52d2a2dc3433.jpg "
# Add NIP89
nip89info = {
" name " : name ,
" picture " : image ,
" about " : " I show the latest longform notes. " ,
" lud16 " : dvm_config . LN_ADDRESS ,
2024-11-22 19:18:44 +01:00
" supportsEncryption " : True ,
" acceptsNutZaps " : dvm_config . ENABLE_NUTZAP ,
2024-06-09 17:10:44 +02:00
" personalized " : False ,
" amount " : create_amount_tag ( cost ) ,
" nip90Params " : {
" max_results " : {
" required " : False ,
" values " : [ ] ,
" description " : " The number of maximum results to return (default currently 100) "
}
}
}
nip89config = NIP89Config ( )
2024-11-22 11:14:39 +01:00
nip89config . DTAG = check_and_set_d_tag ( identifier , name , dvm_config . PRIVATE_KEY , nip89info [ " picture " ] )
2024-06-09 17:10:44 +02:00
nip89config . CONTENT = json . dumps ( nip89info )
# admin_config.UPDATE_PROFILE = False
# admin_config.REBROADCAST_NIP89 = False
return DicoverContentLatestLongForm ( name = name , dvm_config = dvm_config , nip89config = nip89config ,
admin_config = admin_config , options = options )
2024-07-19 12:07:18 +02:00
def build_wiki ( name , identifier , admin_config , options , cost = 0 , update_rate = 180 , processing_msg = None ,
2024-11-14 12:51:38 +01:00
update_db = True ) :
2024-07-19 12:07:18 +02:00
dvm_config = build_default_config ( identifier )
dvm_config . USE_OWN_VENV = False
dvm_config . SHOWLOG = True
dvm_config . SCHEDULE_UPDATES_SECONDS = update_rate # Every 10 minutes
dvm_config . UPDATE_DATABASE = update_db
2024-11-13 16:06:53 +01:00
dvm_config . AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST
dvm_config . SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST
2024-08-12 15:55:12 +02:00
dvm_config . RELAY_LIST = RELAY_LIST
2024-07-19 12:07:18 +02:00
dvm_config . LOGLEVEL = LogLevel . INFO
# Activate these to use a subscription based model instead
# dvm_config.SUBSCRIPTION_REQUIRED = True
# dvm_config.SUBSCRIPTION_DAILY_COST = 1
dvm_config . FIX_COST = cost
dvm_config . CUSTOM_PROCESSING_MESSAGE = processing_msg
2024-11-16 11:56:15 +01:00
dvm_config . SEND_FEEDBACK_EVENTS = False
2024-07-19 12:07:18 +02:00
admin_config . LUD16 = dvm_config . LN_ADDRESS
image = " https://i.nostr.build/ctfc5o47ICm56TOv.jpg "
# Add NIP89
nip89info = {
" name " : name ,
" picture " : image ,
" about " : " I show the latest wikifreedia entries. " ,
" lud16 " : dvm_config . LN_ADDRESS ,
2024-11-22 19:18:44 +01:00
" supportsEncryption " : True ,
" acceptsNutZaps " : dvm_config . ENABLE_NUTZAP ,
2024-07-19 12:07:18 +02:00
" personalized " : False ,
" amount " : create_amount_tag ( cost ) ,
" nip90Params " : {
" max_results " : {
" required " : False ,
" values " : [ ] ,
" description " : " The number of maximum results to return (default currently 100) "
}
}
}
nip89config = NIP89Config ( )
2024-11-22 11:14:39 +01:00
nip89config . DTAG = check_and_set_d_tag ( identifier , name , dvm_config . PRIVATE_KEY , nip89info [ " picture " ] )
2024-07-19 12:07:18 +02:00
nip89config . CONTENT = json . dumps ( nip89info )
# admin_config.UPDATE_PROFILE = False
# admin_config.REBROADCAST_NIP89 = False
return DicoverContentLatestWiki ( name = name , dvm_config = dvm_config , nip89config = nip89config ,
2024-11-14 12:51:38 +01:00
admin_config = admin_config , options = options )
2024-07-19 12:07:18 +02:00
2024-05-28 20:29:11 +02:00
def build_example_topic ( name , identifier , admin_config , options , image , description , update_rate = 600 , cost = 0 ,
2024-09-09 11:25:51 +02:00
processing_msg = None , update_db = True , database = None ) :
2024-05-28 20:29:11 +02:00
dvm_config = build_default_config ( identifier )
dvm_config . USE_OWN_VENV = False
dvm_config . SHOWLOG = True
dvm_config . SCHEDULE_UPDATES_SECONDS = update_rate # Every 10 minutes
dvm_config . UPDATE_DATABASE = update_db
dvm_config . FIX_COST = cost
2024-06-13 10:49:09 +02:00
dvm_config . LOGLEVEL = LogLevel . INFO
2024-05-28 20:29:11 +02:00
dvm_config . CUSTOM_PROCESSING_MESSAGE = processing_msg
2024-11-13 16:06:53 +01:00
dvm_config . AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST
dvm_config . SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST
2024-08-12 15:55:12 +02:00
dvm_config . RELAY_LIST = RELAY_LIST
2024-09-09 11:25:51 +02:00
dvm_config . DATABASE = database
2024-11-16 11:56:15 +01:00
dvm_config . SEND_FEEDBACK_EVENTS = False
2024-05-28 20:29:11 +02:00
admin_config . LUD16 = dvm_config . LN_ADDRESS
# Add NIP89
nip89info = {
" name " : name ,
" picture " : image ,
" about " : description ,
" lud16 " : dvm_config . LN_ADDRESS ,
2024-11-22 19:18:44 +01:00
" supportsEncryption " : True ,
" acceptsNutZaps " : dvm_config . ENABLE_NUTZAP ,
2024-05-28 20:29:11 +02:00
" personalized " : False ,
" amount " : create_amount_tag ( cost ) ,
" nip90Params " : {
" max_results " : {
" required " : False ,
" values " : [ ] ,
" description " : " The number of maximum results to return (default currently 100) "
}
}
}
nip89config = NIP89Config ( )
2024-11-22 11:14:39 +01:00
nip89config . DTAG = check_and_set_d_tag ( identifier , name , dvm_config . PRIVATE_KEY , nip89info [ " picture " ] )
2024-05-28 20:29:11 +02:00
nip89config . CONTENT = json . dumps ( nip89info )
return DicoverContentCurrentlyPopularbyTopic ( name = name , dvm_config = dvm_config , nip89config = nip89config ,
admin_config = admin_config , options = options )
def build_example_popular ( name , identifier , admin_config , options , image , cost = 0 , update_rate = 180 , processing_msg = None ,
2024-09-09 11:25:51 +02:00
update_db = True , database = None ) :
2024-05-28 20:29:11 +02:00
dvm_config = build_default_config ( identifier )
2024-06-13 10:49:09 +02:00
dvm_config . LOGLEVEL = LogLevel . INFO
2024-05-28 20:29:11 +02:00
dvm_config . SCHEDULE_UPDATES_SECONDS = update_rate # Every 10 minutes
dvm_config . UPDATE_DATABASE = update_db
dvm_config . FIX_COST = cost
dvm_config . CUSTOM_PROCESSING_MESSAGE = processing_msg
2024-11-13 16:06:53 +01:00
dvm_config . AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST
dvm_config . SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST
2024-08-12 15:55:12 +02:00
dvm_config . RELAY_LIST = RELAY_LIST
2024-09-09 11:25:51 +02:00
dvm_config . DATABASE = database
2024-11-16 11:56:15 +01:00
dvm_config . SEND_FEEDBACK_EVENTS = False
2024-05-28 20:29:11 +02:00
admin_config . LUD16 = dvm_config . LN_ADDRESS
# Add NIP89
nip89info = {
" name " : name ,
" picture " : image ,
" about " : " I show notes that are currently popular " ,
" lud16 " : dvm_config . LN_ADDRESS ,
2024-11-22 19:18:44 +01:00
" supportsEncryption " : True ,
" acceptsNutZaps " : dvm_config . ENABLE_NUTZAP ,
2024-05-28 20:29:11 +02:00
" personalized " : False ,
" amount " : create_amount_tag ( cost ) ,
" nip90Params " : {
" max_results " : {
" required " : False ,
" values " : [ ] ,
" description " : " The number of maximum results to return (default currently 200) "
}
}
}
nip89config = NIP89Config ( )
2024-11-22 11:14:39 +01:00
nip89config . DTAG = check_and_set_d_tag ( identifier , name , dvm_config . PRIVATE_KEY , nip89info [ " picture " ] )
2024-05-28 20:29:11 +02:00
nip89config . CONTENT = json . dumps ( nip89info )
return DicoverContentCurrentlyPopular ( name = name , dvm_config = dvm_config , nip89config = nip89config ,
admin_config = admin_config , options = options )
def build_example_popular_followers ( name , identifier , admin_config , options , image , cost = 0 , update_rate = 300 ,
processing_msg = None , update_db = True ) :
dvm_config = build_default_config ( identifier )
dvm_config . USE_OWN_VENV = False
dvm_config . SHOWLOG = True
2024-06-13 10:49:09 +02:00
dvm_config . LOGLEVEL = LogLevel . INFO
2024-05-28 20:29:11 +02:00
dvm_config . SCHEDULE_UPDATES_SECONDS = update_rate # Every x seconds
dvm_config . UPDATE_DATABASE = update_db
dvm_config . FIX_COST = cost
dvm_config . CUSTOM_PROCESSING_MESSAGE = processing_msg
2024-11-13 16:06:53 +01:00
dvm_config . AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST
dvm_config . SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST
2024-08-12 15:55:12 +02:00
dvm_config . RELAY_LIST = RELAY_LIST
2024-05-28 20:29:11 +02:00
admin_config . LUD16 = dvm_config . LN_ADDRESS
2024-11-16 11:56:15 +01:00
2024-05-28 20:29:11 +02:00
# Add NIP89
nip89info = {
" name " : name ,
" picture " : image ,
" about " : " I show notes that are currently popular from people you follow " ,
" lud16 " : dvm_config . LN_ADDRESS ,
2024-11-22 19:18:44 +01:00
" supportsEncryption " : True ,
" acceptsNutZaps " : dvm_config . ENABLE_NUTZAP ,
2024-05-28 20:29:11 +02:00
" personalized " : True ,
" amount " : create_amount_tag ( cost ) ,
" nip90Params " : {
" max_results " : {
" required " : False ,
" values " : [ ] ,
" description " : " The number of maximum results to return (default currently 100) "
}
}
}
nip89config = NIP89Config ( )
2024-11-22 11:14:39 +01:00
nip89config . DTAG = check_and_set_d_tag ( identifier , name , dvm_config . PRIVATE_KEY , nip89info [ " picture " ] )
2024-05-28 20:29:11 +02:00
nip89config . CONTENT = json . dumps ( nip89info )
return DicoverContentCurrentlyPopularFollowers ( name = name , dvm_config = dvm_config , nip89config = nip89config ,
options = options ,
admin_config = admin_config )
2024-07-11 10:10:42 +02:00
2024-11-14 12:51:38 +01:00
def build_example_popular_non_followers ( name , identifier , admin_config , options , image , cost = 0 , update_rate = 300 ,
processing_msg = None , update_db = True , database = None ) :
2024-07-11 10:10:42 +02:00
dvm_config = build_default_config ( identifier )
dvm_config . USE_OWN_VENV = False
dvm_config . SHOWLOG = True
2024-11-07 11:35:46 +01:00
dvm_config . LOGLEVEL = LogLevel . INFO
2024-07-11 10:10:42 +02:00
dvm_config . SCHEDULE_UPDATES_SECONDS = update_rate # Every 10 minutes
dvm_config . UPDATE_DATABASE = update_db
2024-09-09 11:25:51 +02:00
dvm_config . DATABASE = database
2024-07-11 10:10:42 +02:00
# Activate these to use a subscription based model instead
2024-11-21 23:44:40 +01:00
dvm_config . FIX_COST = cost
2024-07-11 10:10:42 +02:00
dvm_config . CUSTOM_PROCESSING_MESSAGE = processing_msg
2024-11-13 16:06:53 +01:00
dvm_config . AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST
dvm_config . SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST
2024-08-12 15:55:12 +02:00
dvm_config . RELAY_LIST = RELAY_LIST
2024-09-15 11:48:02 +02:00
dvm_config . SUBSCRIPTION_REQUIRED = False
2024-07-11 10:10:42 +02:00
admin_config . LUD16 = dvm_config . LN_ADDRESS
admin_config . REBROADCAST_NIP88 = False
2024-11-14 12:51:38 +01:00
# admin_config.REBROADCAST_NIP89 = True
2024-07-11 10:33:07 +02:00
admin_config . UPDATE_PROFILE = False
2024-07-11 10:10:42 +02:00
# Add NIP89
nip89info = {
" name " : name ,
" picture " : image ,
" about " : " I show notes that are currently popular from people you do not follow " ,
" lud16 " : dvm_config . LN_ADDRESS ,
2024-11-22 19:18:44 +01:00
" supportsEncryption " : True ,
" acceptsNutZaps " : dvm_config . ENABLE_NUTZAP ,
2024-09-15 11:48:02 +02:00
" subscription " : False ,
" personalized " : True ,
2024-11-21 23:44:40 +01:00
" amount " : create_amount_tag ( cost ) ,
2024-07-11 10:10:42 +02:00
" nip90Params " : {
" max_results " : {
" required " : False ,
" values " : [ ] ,
" description " : " The number of maximum results to return (default currently 100) "
}
}
}
nip89config = NIP89Config ( )
2024-11-22 11:14:39 +01:00
nip89config . DTAG = check_and_set_d_tag ( identifier , name , dvm_config . PRIVATE_KEY , nip89info [ " picture " ] )
2024-07-11 10:10:42 +02:00
nip89config . CONTENT = json . dumps ( nip89info )
nip88config = NIP88Config ( )
2024-11-22 11:14:39 +01:00
nip88config . DTAG = check_and_set_d_tag_nip88 ( identifier , name , dvm_config . PRIVATE_KEY , nip89info [ " picture " ] )
2024-07-11 10:10:42 +02:00
nip88config . TIER_EVENT = check_and_set_tiereventid_nip88 ( identifier , " 1 " )
nip89config . NAME = name
2024-11-22 11:14:39 +01:00
nip88config . IMAGE = nip89info [ " picture " ]
2024-07-11 10:10:42 +02:00
nip88config . TITLE = name
nip88config . AMOUNT_DAILY = 100
nip88config . AMOUNT_MONTHLY = 2000
nip88config . CONTENT = " Subscribe to the DVM for unlimited use during your subscription "
nip88config . PERK1DESC = " Unlimited requests "
nip88config . PERK2DESC = " Support NostrDVM & NostrSDK development "
nip88config . PAYMENT_VERIFIER_PUBKEY = " 5b5c045ecdf66fb540bdf2049fe0ef7f1a566fa427a4fe50d400a011b65a3a7e "
2024-11-14 12:51:38 +01:00
# admin_config.FETCH_NIP88 = True
# admin_config.EVENTID = "63a791cdc7bf78c14031616963105fce5793f532bb231687665b14fb6d805fdb"
2024-07-11 10:10:42 +02:00
admin_config . PRIVKEY = dvm_config . PRIVATE_KEY
return DicoverContentCurrentlyPopularNonFollowers ( name = name , dvm_config = dvm_config , nip89config = nip89config ,
2024-11-14 12:51:38 +01:00
# nip88config=nip88config,
2024-07-11 10:10:42 +02:00
admin_config = admin_config ,
options = options )
2024-05-30 21:06:25 +02:00
def build_example_top_zapped ( name , identifier , admin_config , options , image , cost = 0 , update_rate = 180 ,
processing_msg = None ,
2024-09-09 11:25:51 +02:00
update_db = True , database = None ) :
2024-05-30 10:12:56 +02:00
dvm_config = build_default_config ( identifier )
dvm_config . USE_OWN_VENV = False
dvm_config . SHOWLOG = True
2024-11-14 12:51:38 +01:00
# dvm_config.ENABLE_NUTZAP = True
2024-06-13 10:49:09 +02:00
dvm_config . LOGLEVEL = LogLevel . INFO
2024-05-30 10:12:56 +02:00
dvm_config . SCHEDULE_UPDATES_SECONDS = update_rate # Every 10 minutes
dvm_config . UPDATE_DATABASE = update_db
dvm_config . FIX_COST = cost
dvm_config . CUSTOM_PROCESSING_MESSAGE = processing_msg
2024-11-13 16:06:53 +01:00
dvm_config . AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST
dvm_config . SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST
2024-08-12 15:55:12 +02:00
dvm_config . RELAY_LIST = RELAY_LIST
2024-09-09 11:25:51 +02:00
dvm_config . DATABASE = database
2024-11-16 11:56:15 +01:00
dvm_config . SEND_FEEDBACK_EVENTS = False
2024-05-30 10:12:56 +02:00
admin_config . LUD16 = dvm_config . LN_ADDRESS
# Add NIP89
nip89info = {
" name " : name ,
" picture " : image ,
" about " : " I show notes that are currently zapped the most. " ,
" lud16 " : dvm_config . LN_ADDRESS ,
2024-11-22 19:18:44 +01:00
" supportsEncryption " : True ,
" acceptsNutZaps " : dvm_config . ENABLE_NUTZAP ,
2024-05-30 10:12:56 +02:00
" personalized " : False ,
" amount " : create_amount_tag ( cost ) ,
" nip90Params " : {
" max_results " : {
" required " : False ,
" values " : [ ] ,
" description " : " The number of maximum results to return (default currently 100) "
}
}
}
2024-05-28 20:29:11 +02:00
2024-05-30 10:12:56 +02:00
nip89config = NIP89Config ( )
2024-11-22 11:14:39 +01:00
nip89config . DTAG = check_and_set_d_tag ( identifier , name , dvm_config . PRIVATE_KEY , nip89info [ " picture " ] )
2024-05-30 10:12:56 +02:00
nip89config . CONTENT = json . dumps ( nip89info )
# admin_config.UPDATE_PROFILE = False
# admin_config.REBROADCAST_NIP89 = False
return DicoverContentCurrentlyPopularZaps ( name = name , dvm_config = dvm_config , nip89config = nip89config ,
admin_config = admin_config , options = options )
2024-05-30 21:06:25 +02:00
2024-07-17 09:53:14 +02:00
def build_example_mostr ( name , identifier , admin_config , options , image , cost = 0 , update_rate = 180 , processing_msg = None ,
2024-11-14 12:51:38 +01:00
update_db = True ) :
2024-07-17 09:53:14 +02:00
dvm_config = build_default_config ( identifier )
dvm_config . USE_OWN_VENV = False
dvm_config . LOGLEVEL = LogLevel . INFO
# dvm_config.SHOWLOG = True
dvm_config . SCHEDULE_UPDATES_SECONDS = update_rate # Every 10 minutes
dvm_config . UPDATE_DATABASE = update_db
2024-11-13 16:06:53 +01:00
dvm_config . AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST
2024-08-12 15:55:12 +02:00
dvm_config . RELAY_LIST = RELAY_LIST
2024-11-13 17:32:31 +01:00
dvm_config . SYNC_DB_RELAY_LIST = [ " wss://nfrelay.app/?user=activitypub " ]
2024-11-16 11:56:15 +01:00
dvm_config . SEND_FEEDBACK_EVENTS = False
2024-11-14 12:51:38 +01:00
# dvm_config.SYNC_DB_RELAY_LIST = ["wss://relay.mostr.pub/"]
2024-07-17 09:53:14 +02:00
dvm_config . FIX_COST = cost
dvm_config . CUSTOM_PROCESSING_MESSAGE = processing_msg
admin_config . LUD16 = dvm_config . LN_ADDRESS
# Add NIP89
nip89info = {
" name " : name ,
" picture " : image ,
" about " : " I show notes from Mostr.pub and Momostr.pink that are currently popular on Nostr " ,
" lud16 " : dvm_config . LN_ADDRESS ,
2024-11-22 19:18:44 +01:00
" supportsEncryption " : True ,
" acceptsNutZaps " : dvm_config . ENABLE_NUTZAP ,
2024-07-17 09:53:14 +02:00
" personalized " : False ,
" amount " : create_amount_tag ( cost ) ,
" nip90Params " : {
" max_results " : {
" required " : False ,
" values " : [ ] ,
" description " : " The number of maximum results to return (default currently 200) "
}
}
}
nip89config = NIP89Config ( )
2024-11-22 11:14:39 +01:00
nip89config . DTAG = check_and_set_d_tag ( identifier , name , dvm_config . PRIVATE_KEY , nip89info [ " picture " ] )
2024-07-17 09:53:14 +02:00
nip89config . CONTENT = json . dumps ( nip89info )
return DicoverContentCurrentlyPopularMostr ( name = name , dvm_config = dvm_config , nip89config = nip89config ,
2024-11-14 12:51:38 +01:00
admin_config = admin_config , options = options )
2024-07-17 09:53:14 +02:00
2024-11-14 12:51:38 +01:00
def build_example_oneperfollow ( name , identifier , admin_config , options , image , cost = 0 , update_rate = 180 ,
processing_msg = None ,
update_db = True ) :
2024-08-20 18:33:12 +02:00
dvm_config = build_default_config ( identifier )
dvm_config . USE_OWN_VENV = False
dvm_config . LOGLEVEL = LogLevel . INFO
# dvm_config.SHOWLOG = True
dvm_config . SCHEDULE_UPDATES_SECONDS = update_rate # Every 10 minutes
dvm_config . UPDATE_DATABASE = False
dvm_config . FIX_COST = cost
2024-11-13 16:06:53 +01:00
dvm_config . AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST
dvm_config . SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST
2024-09-14 12:13:06 +02:00
dvm_config . RELAY_LIST = RELAY_LIST
2024-08-20 18:33:12 +02:00
dvm_config . CUSTOM_PROCESSING_MESSAGE = processing_msg
admin_config . LUD16 = dvm_config . LN_ADDRESS
# Add NIP89
nip89info = {
" name " : name ,
" picture " : image ,
" about " : " I show the single latest note of people you follow " ,
" lud16 " : dvm_config . LN_ADDRESS ,
2024-11-22 19:18:44 +01:00
" supportsEncryption " : True ,
" acceptsNutZaps " : dvm_config . ENABLE_NUTZAP ,
2024-08-20 18:33:12 +02:00
" personalized " : False ,
" amount " : create_amount_tag ( cost ) ,
" nip90Params " : {
" max_results " : {
" required " : False ,
" values " : [ ] ,
" description " : " The number of maximum results to return (default currently 200) "
}
}
}
nip89config = NIP89Config ( )
2024-11-22 11:14:39 +01:00
nip89config . DTAG = check_and_set_d_tag ( identifier , name , dvm_config . PRIVATE_KEY , nip89info [ " picture " ] )
2024-08-20 18:33:12 +02:00
nip89config . CONTENT = json . dumps ( nip89info )
return Discoverlatestperfollower ( name = name , dvm_config = dvm_config , nip89config = nip89config ,
2024-11-14 12:51:38 +01:00
admin_config = admin_config , options = options )
2024-08-20 18:33:12 +02:00
2024-11-14 12:51:38 +01:00
def playground ( ) :
2024-09-09 11:25:51 +02:00
main_db = " db/nostr_recent_notes.db "
2024-11-26 19:52:41 +01:00
main_db_limit = 1024 # in mb
DATABASE = asyncio . run ( init_db ( main_db , wipe = True , limit = main_db_limit , print_filesize = True ) )
2024-11-14 12:51:38 +01:00
# DB Scheduler, do not announce, just use it to update the DB for the other DVMs.
admin_config_db_scheduler = AdminConfig ( )
2024-11-26 19:52:41 +01:00
options_db = {
2024-09-09 11:25:51 +02:00
" db_name " : main_db ,
2024-11-13 16:06:53 +01:00
" db_since " : max_sync_duration_in_h * 60 * 60 , # 48h since gmt,
2024-06-04 20:15:20 +02:00
" personalized " : False ,
2024-11-26 19:52:41 +01:00
" max_db_size " : main_db_limit ,
2024-06-04 20:15:20 +02:00
" logger " : False }
image = " "
about = " I just update the Database based on my schedule "
db_scheduler = build_db_scheduler ( " DB Scheduler " ,
2024-11-14 12:51:38 +01:00
" db_scheduler " ,
2024-11-26 19:52:41 +01:00
admin_config_db_scheduler , options_db ,
2024-11-14 12:51:38 +01:00
image = image ,
description = about ,
update_rate = global_update_rate ,
cost = 0 ,
update_db = True ,
database = DATABASE )
2024-06-04 20:15:20 +02:00
db_scheduler . run ( )
2024-07-25 09:31:38 +02:00
admin_config_gallery = AdminConfig ( )
admin_config_gallery . REBROADCAST_NIP89 = rebroadcast_NIP89
admin_config_gallery . REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
admin_config_gallery . UPDATE_PROFILE = update_profile
# admin_config_global_popular.DELETE_NIP89 = True
# admin_config_global_popular.PRIVKEY = ""
# admin_config_global_popular.EVENTID = "2fea4ee2ccf0fa11db171113ffd7a676f800f34121478b7c9a4e73c2f1990028"
# admin_config_global_popular.POW = True
custom_processing_msg = [ " Looking for popular Gallery entries " ]
update_db = True
options_gallery = {
" db_name " : " db/nostr_gallery.db " ,
" generic_db_name " : " db/nostr_recent_notes.db " ,
" db_since " : 60 * 60 * 24 * 30 , # 1h since gmt,
}
2024-09-09 11:25:51 +02:00
# cost = 0
# image = "https://i.nostr.build/4Rw6lrsH5O0P5zjT.jpg"
# discover_gallery = build_example_gallery("Gallery entries",
# "discovery_gallery_entries",
# admin_config=admin_config_gallery,
# options=options_gallery,
# image=image,
# cost=cost,
# update_rate=global_update_rate,
# processing_msg=custom_processing_msg,
# update_db=update_db)
# discover_gallery.run()
#
2024-07-25 09:31:38 +02:00
2024-06-09 17:10:44 +02:00
# Latest Longform
admin_config_longform = AdminConfig ( )
admin_config_longform . REBROADCAST_NIP89 = rebroadcast_NIP89
admin_config_longform . REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
admin_config_longform . UPDATE_PROFILE = update_profile
# admin_config_top_zaps.DELETE_NIP89 = True
# admin_config_top_zaps.PRIVKEY = ""
# admin_config_top_zaps.EVENTID = "05a6de88e15aa6c8b4c8ec54481f885f397a30761ff2799958e5c5ee9ad6917b"
# admin_config_top_zaps.POW = True
custom_processing_msg = [ " Looking for latest Longform Articles " , " Let ' s see what people recently wrote " ]
update_db = True
options_longform = {
" db_name " : " db/nostr_recent_notes_longform.db " ,
" db_since " : 60 * 60 * 24 * 21 , # 3 Weeks since gmt,
}
cost = 0
latest_longform = build_longform ( " Latest Longform Notes " ,
2024-11-14 12:51:38 +01:00
" discovery_content_longform " ,
admin_config = admin_config_longform ,
options = options_longform ,
cost = cost ,
update_rate = global_update_rate ,
processing_msg = custom_processing_msg ,
update_db = update_db )
2024-06-09 17:10:44 +02:00
latest_longform . run ( )
2024-07-19 12:07:18 +02:00
# Latest Wiki
admin_config_wiki = AdminConfig ( )
admin_config_wiki . REBROADCAST_NIP89 = rebroadcast_NIP89
admin_config_wiki . REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
admin_config_wiki . UPDATE_PROFILE = update_profile
# admin_config_top_zaps.DELETE_NIP89 = True
# admin_config_top_zaps.PRIVKEY = ""
# admin_config_top_zaps.EVENTID = "05a6de88e15aa6c8b4c8ec54481f885f397a30761ff2799958e5c5ee9ad6917b"
# admin_config_top_zaps.POW = True
custom_processing_msg = [ " Looking for latest Wiki entries " , " Let ' s check Wiki entries.. " ]
update_db = True
options_longform = {
" db_name " : " db/nostr_recent_notes_longform.db " ,
" db_since " : 60 * 60 * 24 * 21 , # 3 Weeks since gmt,
}
cost = 0
2024-11-14 12:51:38 +01:00
latest_wiki = build_wiki ( " Latest Wikifreedia Notes " ,
" discovery_content_wiki " ,
admin_config = admin_config_wiki ,
options = options_longform ,
cost = cost ,
update_rate = global_update_rate ,
processing_msg = custom_processing_msg ,
update_db = update_db )
2024-07-19 12:07:18 +02:00
latest_wiki . run ( )
2024-06-03 21:00:08 +02:00
# Popular top zapped
admin_config_top_zaps = AdminConfig ( )
admin_config_top_zaps . REBROADCAST_NIP89 = rebroadcast_NIP89
admin_config_top_zaps . REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
admin_config_top_zaps . UPDATE_PROFILE = update_profile
# admin_config_top_zaps.DELETE_NIP89 = True
# admin_config_top_zaps.PRIVKEY = ""
# admin_config_top_zaps.EVENTID = "05a6de88e15aa6c8b4c8ec54481f885f397a30761ff2799958e5c5ee9ad6917b"
# admin_config_top_zaps.POW = True
custom_processing_msg = [ " Looking for most zapped notes " , " Let ' s see which notes people currently zap.. " ,
" Let ' s find valuable notes. #value4value " ]
update_db = False
2024-05-26 00:33:56 +02:00
2024-06-03 21:00:08 +02:00
options_top_zapped = {
" db_name " : " db/nostr_recent_notes.db " ,
2024-09-09 11:25:51 +02:00
" db_since " : 60 * 60 * 2 , # 8h since gmt,
2024-06-03 21:00:08 +02:00
}
cost = 0
2024-11-14 12:51:38 +01:00
# image = "https://image.nostr.build/c6879f458252641d04d0aa65fd7f1e005a4f7362fd407467306edc2f4acdb113.jpg"
2024-08-31 10:29:47 +02:00
image = " https://i.nostr.build/U5AO3vUMy47NWSQG.png "
2024-06-03 21:00:08 +02:00
discovery_topzaps = build_example_top_zapped ( " Top Zapped notes " ,
" discovery_content_top_zaps " ,
admin_config = admin_config_top_zaps ,
options = options_top_zapped ,
image = image ,
cost = cost ,
update_rate = global_update_rate ,
processing_msg = custom_processing_msg ,
2024-09-09 11:25:51 +02:00
update_db = update_db ,
database = DATABASE )
2024-05-31 16:25:56 +02:00
2024-06-03 21:00:08 +02:00
discovery_topzaps . run ( )
2024-05-26 00:33:56 +02:00
2024-05-17 10:34:27 +02:00
# Popular NOSTR.band
admin_config_trending_nostr_band = AdminConfig ( )
2024-06-03 21:00:08 +02:00
admin_config_trending_nostr_band . REBROADCAST_NIP89 = rebroadcast_NIP89
admin_config_trending_nostr_band . REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
2024-06-03 20:24:29 +02:00
admin_config_trending_nostr_band . UPDATE_PROFILE = update_profile
2024-11-14 12:51:38 +01:00
# admin_config_trending_nostr_band.DELETE_NIP89 = True
# admin_config_trending_nostr_band.PRIVKEY = ""
# admin_config_trending_nostr_band.EVENTID = "e7a7aaa7113f17af94ccbfe86c06e04c27ffce3d2f654d613ce249b68414bdae"
# admin_config_trending_nostr_band.POW = True
2024-05-17 10:34:27 +02:00
custom_processing_msg = " Looking for trending notes on nostr.band.. "
2024-05-28 20:29:11 +02:00
image = " https://nostr.band/android-chrome-192x192.png "
about = " I show trending notes from nostr.band "
trending_nb = build_example_nostrband ( " Trending Notes on nostr.band " ,
" trending_notes_nostrband " ,
image = image ,
about = about ,
admin_config = admin_config_trending_nostr_band ,
custom_processing_msg = custom_processing_msg )
2024-05-17 10:34:27 +02:00
trending_nb . run ( )
2024-03-05 16:04:02 +01:00
2024-07-17 09:53:14 +02:00
admin_config_mostr = AdminConfig ( )
admin_config_mostr . REBROADCAST_NIP89 = rebroadcast_NIP89
admin_config_mostr . REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
admin_config_mostr . UPDATE_PROFILE = update_profile
2024-11-14 12:51:38 +01:00
# admin_config_mostr.DELETE_NIP89 = True
# admin_config_mostr.PRIVKEY = ""
# admin_config_mostr.EVENTID = "59d0ebe2966426ac359dcb8da214efe34fb735c69099361eae87a426bacf4de2"
# admin_config_mostr.POW = True
2024-07-17 09:53:14 +02:00
custom_processing_msg = [ " Looking for popular Content on Mostr " ]
options_mostr = {
" db_name " : " db/nostr_mostr.db " ,
" db_since " : 60 * 60 * 2 , # 1h since gmt,
}
cost = 0
image = " https://i.nostr.build/mtkNd3J8m0mqj9nq.jpg "
2024-11-14 12:51:38 +01:00
# discovery_mostr = build_example_mostr("Trending on Mostr",
2024-11-13 17:32:31 +01:00
# "discovery_mostr",
#
# admin_config=admin_config_mostr,
# options=options_mostr,
# image=image,
# cost=cost,
# update_rate=180,
# processing_msg=custom_processing_msg,
# update_db=True)
2024-11-14 12:51:38 +01:00
# discovery_mostr.run()
2024-07-17 09:53:14 +02:00
2024-09-15 11:48:02 +02:00
# Popular Garden&Plants
admin_config_asknostr = AdminConfig ( )
2024-11-14 12:51:38 +01:00
admin_config_asknostr . REBROADCAST_NIP89 = rebroadcast_NIP89
2024-09-15 11:48:02 +02:00
admin_config_asknostr . REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
admin_config_asknostr . UPDATE_PROFILE = update_profile
options_plants = {
" search_list " : [ " #asknostr " ] ,
" avoid_list " : [ ] ,
" db_name " : " db/nostr_recent_notes.db " ,
" db_since " : 24 * 60 * 60 , # 12h since gmt
" personalized " : False ,
" logger " : False }
image = " https://i.nostr.build/vIixmuRacIhULsrP.png "
description = " I show popular questions #asknostr "
custom_processing_msg = [ " Finding the best notes for you.. #asknostr " ]
update_db = False
cost = 0
discovery_asknostr = build_example_topic ( " Popular on #asknostr " , " discovery_content_asknostr " ,
2024-11-14 12:51:38 +01:00
admin_config_asknostr , options_plants ,
image = image ,
description = description ,
update_rate = global_update_rate ,
cost = cost ,
processing_msg = custom_processing_msg ,
update_db = update_db ,
database = DATABASE )
2024-09-15 11:48:02 +02:00
discovery_asknostr . run ( )
2024-03-18 19:44:44 +01:00
2024-10-04 17:17:26 +02:00
# Popular Garden&Plants
admin_config_mining = AdminConfig ( )
admin_config_mining . REBROADCAST_NIP89 = rebroadcast_NIP89
admin_config_mining . REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
admin_config_mining . UPDATE_PROFILE = update_profile
# admin_config_plants.DELETE_NIP89 = True
# admin_config_plants.PRIVKEY = ""
# admin_config_plants.EVENTID = "ff28be59708ee597c7010fd43a7e649e1ab51da491266ca82a84177e0007e4d6"
# admin_config_plants.POW = True
options_mining = {
2024-11-14 22:08:57 +01:00
" search_list " : [ " bitaxe " , " homeminer " , " S9 " , " homemining " ] ,
2024-10-04 17:17:26 +02:00
" avoid_list " : [ " nsfw " ] ,
" db_name " : " db/nostr_recent_notes.db " ,
" db_since " : 12 * 60 * 60 , # 12h since gmt
" personalized " : False ,
" logger " : False }
image = " https://i.nostr.build/M6w0qSpRTGHwjYwf.jpg "
description = " I show recent notes about Bitcoin home mining. "
custom_processing_msg = [ " Finding the best notes for you.. #homeminer " ]
update_db = False
cost = 0
discovery_mining = build_example_topic ( " Home mining " , " discovery_content_mining " ,
admin_config_mining , options_mining ,
image = image ,
description = description ,
update_rate = global_update_rate ,
cost = cost ,
processing_msg = custom_processing_msg ,
update_db = update_db ,
database = DATABASE )
discovery_mining . run ( )
2024-05-16 10:29:51 +02:00
# Popular Animals (Fluffy frens)
admin_config_animals = AdminConfig ( )
2024-06-03 21:00:08 +02:00
admin_config_animals . REBROADCAST_NIP89 = rebroadcast_NIP89
admin_config_animals . REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
2024-06-03 20:24:29 +02:00
admin_config_animals . UPDATE_PROFILE = update_profile
2024-11-14 12:51:38 +01:00
# admin_config_animals.DELETE_NIP89 = True
# admin_config_animals.PRIVKEY = ""
# admin_config_animals.EVENTID = "79c613b5f0e71718628bd0c782a5b6b495dac491f36c326ccf416ada80fd8fdc"
# admin_config_animals.POW = True
2024-10-04 17:17:26 +02:00
2024-05-09 08:18:21 +02:00
options_animal = {
2024-05-26 00:33:56 +02:00
" search_list " : [ " catstr " , " pawstr " , " dogstr " , " pugstr " , " cat " , " cats " , " doggo " , " deer " , " dog " , " dogs " ,
" fluffy " ,
2024-11-18 10:47:25 +01:00
" animal " ,
2024-05-17 10:34:27 +02:00
" duck " , " lion " , " lions " , " fox " , " foxes " , " koala " , " koalas " , " capybara " , " squirrel " ,
2024-11-18 10:47:25 +01:00
" monkey " , " panda " , " alpaca " , " otter " ] ,
" avoid_list " : [ " porn " , " broth " , " smoke " , " nsfw " , " bitcoin " , " bolt12 " , " bolt11 " , " github " , " currency " , " utxo " ,
2024-05-09 08:18:21 +02:00
" encryption " , " government " , " airpod " , " ipad " , " iphone " , " android " , " warren " ,
2024-05-23 10:29:44 +02:00
" moderna " , " pfizer " , " meat " , " pc mouse " , " shotgun " , " vagina " , " rune " , " testicle " , " victim " ,
" sexualize " , " murder " , " tax " , " engagement " , " hodlers " , " hodl " , " gdp " , " global markets " , " crypto " ,
2024-05-09 08:18:21 +02:00
" presidency " , " dollar " , " asset " , " microsoft " , " amazon " , " billionaire " , " ceo " , " industry " ,
2024-05-26 00:33:56 +02:00
" white house " , " hot dog " , " spirit animal " , " migrant " , " invasion " , " blocks " , " streaming " ,
2024-06-20 10:14:04 +02:00
" summary " , " duckfat " , " carnivore " , " protein " , " fats " , " ass " ,
2024-06-03 17:04:08 +02:00
" wealth " , " beef " , " cunt " , " nigger " , " business " , " tore off " , " chart " , " critical theory " ,
" law of nature " ,
2024-05-09 08:18:21 +02:00
" retail " , " bakery " , " synth " , " slaughterhouse " , " hamas " , " dog days " , " ww3 " , " socialmedia " ,
2024-05-26 00:33:56 +02:00
" nintendo " , " signature " , " deepfake " , " congressman " , " fried chicken " , " cypherpunk " ,
" social media " ,
2024-05-09 08:18:21 +02:00
" chef " , " cooked " , " foodstr " , " minister " , " dissentwatch " , " inkblot " , " covid " , " robot " , " pandemic " ,
2024-05-23 10:29:44 +02:00
" dies " , " bethesda " , " defi " , " minister " , " nostr-hotter-site " , " ai " , " palestine " ,
" animalistic " , " wherostr " ,
2024-05-17 10:34:27 +02:00
" hit by a " , " https://boards.4chan " , " https://techcrunch.com " , " https://screenrant.com " ] ,
2024-05-09 08:18:21 +02:00
2024-05-17 10:34:27 +02:00
" must_list " : [ " http " ] ,
" db_name " : " db/nostr_recent_notes.db " ,
2024-11-18 10:47:25 +01:00
" db_since " : 24 * 60 * 60 , # 48h since gmt,
2024-05-30 21:06:25 +02:00
" personalized " : False ,
" logger " : False }
2024-05-09 08:18:21 +02:00
image = " https://image.nostr.build/f609311532c470f663e129510a76c9a1912ae9bc4aaaf058e5ba21cfb512c88e.jpg "
description = " I show recent notes about animals "
2024-05-16 11:51:27 +02:00
2024-05-17 10:34:27 +02:00
custom_processing_msg = [ " Looking for fluffy frens... " , " Let ' s see if we find some animals for you.. " ,
" Looking for the goodest bois and girls.. " ]
2024-05-17 22:29:58 +02:00
cost = 0
2024-06-04 20:15:20 +02:00
update_db = False # As this is our largerst DB we update it here, and the other dvms use it. TODO make an own scheduler that only updates the db
2024-05-28 20:29:11 +02:00
discovery_animals = build_example_topic ( " Fluffy Frens " ,
" discovery_content_fluffy " ,
admin_config_animals , options_animal ,
image = image ,
description = description ,
2024-05-30 21:06:25 +02:00
update_rate = global_update_rate ,
2024-05-28 20:29:11 +02:00
cost = cost ,
processing_msg = custom_processing_msg ,
2024-09-09 11:25:51 +02:00
update_db = update_db ,
2024-11-14 12:51:38 +01:00
database = DATABASE )
2024-05-28 20:29:11 +02:00
2024-05-16 10:29:51 +02:00
discovery_animals . run ( )
2024-05-31 10:27:18 +02:00
# Popular Garden&Plants
admin_config_plants = AdminConfig ( )
2024-06-03 21:00:08 +02:00
admin_config_plants . REBROADCAST_NIP89 = rebroadcast_NIP89
admin_config_plants . REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
2024-06-03 20:24:29 +02:00
admin_config_plants . UPDATE_PROFILE = update_profile
2024-06-04 20:15:20 +02:00
# admin_config_plants.DELETE_NIP89 = True
# admin_config_plants.PRIVKEY = ""
# admin_config_plants.EVENTID = "ff28be59708ee597c7010fd43a7e649e1ab51da491266ca82a84177e0007e4d6"
# admin_config_plants.POW = True
2024-05-31 10:27:18 +02:00
options_plants = {
" search_list " : [ " garden " , " gardening " , " nature " , " plants " , " plant " , " herb " , " herbs " " pine " ,
" homesteading " , " rosemary " , " chicken " , " 🪻 " , " 🌿 " , " ☘️ " , " 🌲 " , " flower " , " forest " , " watering " ,
" permies " , " planting " , " farm " , " vegetable " , " fruit " , " grass " , " sunshine " ,
" #flowerstr " , " #bloomscrolling " , " #treestr " , " #plantstr " , " touchgrass " , ] ,
" avoid_list " : [ " porn " , " smoke " , " nsfw " , " bitcoin " , " bolt12 " , " bolt11 " , " github " , " currency " , " utxo " ,
" encryption " , " government " , " airpod " , " ipad " , " iphone " , " android " , " warren " ,
2024-06-03 17:04:08 +02:00
" moderna " , " pfizer " , " corona " , " socialism " , " critical theory " , " law of nature "
2024-06-04 20:15:20 +02:00
" murder " , " tax " , " engagement " ,
" hodlers " , " hodl " , " gdp " , " global markets " , " crypto " , " wherostr " ,
2024-05-31 10:27:18 +02:00
" presidency " , " dollar " , " asset " , " microsoft " , " amazon " , " billionaire " , " ceo " , " industry " ,
" white house " , " blocks " , " streaming " , " summary " , " wealth " , " beef " , " cunt " , " nigger " , " business " ,
" retail " , " bakery " , " synth " , " slaughterhouse " , " hamas " , " dog days " , " ww3 " , " socialmedia " ,
" nintendo " , " signature " , " deepfake " , " congressman " , " cypherpunk " , " minister " , " dissentwatch " ,
" inkblot " , " covid " , " robot " , " pandemic " , " bethesda " , " zap farming " , " defi " , " minister " ,
" nostr-hotter-site " , " ai " , " palestine " , " https://boards.4chan " , " https://techcrunch.com " ,
" https://screenrant.com " ] ,
" db_name " : " db/nostr_recent_notes.db " ,
" db_since " : 12 * 60 * 60 , # 12h since gmt
" personalized " : False ,
" logger " : False }
image = " https://image.nostr.build/a816f3f5e98e91e8a47d50f4cd7a2c17545f556d9bb0a6086a659b9abdf7ab68.jpg "
description = " I show recent notes about plants and gardening "
custom_processing_msg = [ " Finding the best notes for you.. #blooming " , " Looking for some positivity.. #touchgrass " ,
" Looking for #goodvibes.. " , " All I do is #blooming.. " ]
update_db = False
cost = 0
2024-06-04 20:15:20 +02:00
discovery_garden = build_example_topic ( " Garden & Growth " , " discovery_content_garden " ,
2024-11-14 12:51:38 +01:00
admin_config_plants , options_plants ,
image = image ,
description = description ,
update_rate = global_update_rate ,
cost = cost ,
processing_msg = custom_processing_msg ,
update_db = update_db ,
database = DATABASE )
2024-06-04 20:15:20 +02:00
discovery_garden . run ( )
2024-05-31 10:27:18 +02:00
2024-05-16 10:29:51 +02:00
# Popular Followers
admin_config_followers = AdminConfig ( )
2024-06-03 21:00:08 +02:00
admin_config_followers . REBROADCAST_NIP89 = rebroadcast_NIP89
admin_config_followers . REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
2024-06-03 20:24:29 +02:00
admin_config_followers . UPDATE_PROFILE = update_profile
2024-06-04 20:15:20 +02:00
# admin_config_followers.DELETE_NIP89 = True
# admin_config_followers.PRIVKEY = ""
# admin_config_followers.EVENTID = "590cd7b2902224f740acbd6845023a5ab4a959386184f3360c2859019cfd48fa"
# admin_config_followers.POW = True
2024-05-23 10:29:44 +02:00
custom_processing_msg = [ " Processing popular notes from npubs you follow.. " ,
2024-05-17 10:34:27 +02:00
" Let ' s see what npubs you follow have been up to.. " ,
" Processing a personalized feed, just for you.. " ]
update_db = False
options_followers_popular = {
" db_name " : " db/nostr_recent_notes.db " ,
" db_since " : 2 * 60 * 60 , # 2h since gmt,
}
2024-09-09 11:25:51 +02:00
2024-05-17 22:29:58 +02:00
cost = 0
2024-11-14 12:51:38 +01:00
# image = "https://image.nostr.build/d92652a6a07677e051d647dcf9f0f59e265299b3335a939d008183a911513f4a.jpg"
2024-08-31 10:29:47 +02:00
image = " https://i.nostr.build/ZJqko0W9ApEVZAPt.png "
2024-05-28 20:29:11 +02:00
discovery_followers = build_example_popular_followers (
2024-05-23 10:29:44 +02:00
" Popular from npubs you follow " ,
2024-05-26 00:33:56 +02:00
" discovery_content_followers " ,
2024-05-17 10:34:27 +02:00
admin_config = admin_config_followers ,
options = options_followers_popular ,
2024-05-17 22:29:58 +02:00
cost = cost ,
2024-05-28 20:29:11 +02:00
image = image ,
2024-05-30 21:06:25 +02:00
update_rate = global_update_rate ,
2024-05-17 10:34:27 +02:00
processing_msg = custom_processing_msg ,
update_db = update_db )
2024-05-16 10:29:51 +02:00
discovery_followers . run ( )
2024-07-11 10:10:42 +02:00
# Popular Followers
admin_config_nonfollowers = AdminConfig ( )
admin_config_nonfollowers . REBROADCAST_NIP89 = rebroadcast_NIP89
admin_config_nonfollowers . REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
admin_config_nonfollowers . UPDATE_PROFILE = update_profile
# admin_config_followers.DELETE_NIP89 = True
# admin_config_followers.PRIVKEY = ""
# admin_config_followers.EVENTID = "590cd7b2902224f740acbd6845023a5ab4a959386184f3360c2859019cfd48fa"
# admin_config_followers.POW = True
custom_processing_msg = [ " Processing popular notes from npubs you don ' t follow.. " ,
" Let ' s see what npubs outside of your circle have been up to.. " ,
" Processing a personalized feed, just for you.. " ]
update_db = False
options_nonfollowers_popular = {
" db_name " : " db/nostr_recent_notes.db " ,
2024-08-31 10:29:47 +02:00
" db_since " : 2 * 60 * 60 , # 2h since gmt,
2024-07-11 10:10:42 +02:00
}
2024-11-21 23:44:40 +01:00
cost = 10
2024-07-11 10:10:42 +02:00
image = " https://i.nostr.build/l11EczDmpZBaxlRm.jpg "
discovery_non_followers = build_example_popular_non_followers (
" Popular from npubs you don ' t follow " ,
" discovery_content_nonfollowers " ,
admin_config = admin_config_nonfollowers ,
options = options_nonfollowers_popular ,
cost = cost ,
image = image ,
update_rate = global_update_rate ,
processing_msg = custom_processing_msg ,
2024-09-09 11:25:51 +02:00
update_db = update_db ,
database = DATABASE )
2024-07-11 10:10:42 +02:00
discovery_non_followers . run ( )
2024-08-20 18:33:12 +02:00
admin_config_opf = AdminConfig ( )
admin_config_opf . REBROADCAST_NIP89 = rebroadcast_NIP89
admin_config_opf . REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
admin_config_opf . UPDATE_PROFILE = update_profile
# admin_config_opf.DELETE_NIP89 = True
# admin_config_opf.PRIVKEY = ""
# admin_config_opf.EVENTID = ""
# admin_config_opf.POW = True
custom_processing_msg = [ " Looking for latest content by people you follow.. " ]
update_db = True
options_opf = {
2024-11-13 17:32:31 +01:00
" db_name " : " db/nostr_recent_notes.db " ,
2024-08-20 18:33:12 +02:00
" db_since " : 60 * 60 * 2 , # 1h since gmt,
}
cost = 0
2024-11-14 12:51:38 +01:00
# image = "https://i.nostr.build/H6SMmCl7eRDvkbAn.jpg"
2024-08-31 10:29:47 +02:00
image = " https://i.nostr.build/fsGWicUhyRrfy85d.jpg "
2024-08-20 18:33:12 +02:00
discovery_one_per_follow = build_example_oneperfollow ( " One per follow " ,
" discovery_latest_per_follow " ,
admin_config = admin_config_opf ,
options = options_opf ,
image = image ,
cost = cost ,
update_rate = global_update_rate ,
processing_msg = custom_processing_msg ,
update_db = update_db )
discovery_one_per_follow . run ( )
2024-05-17 10:34:27 +02:00
# Popular Global
2024-05-16 10:29:51 +02:00
admin_config_global_popular = AdminConfig ( )
2024-06-03 21:00:08 +02:00
admin_config_global_popular . REBROADCAST_NIP89 = rebroadcast_NIP89
admin_config_global_popular . REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
2024-06-03 20:24:29 +02:00
admin_config_global_popular . UPDATE_PROFILE = update_profile
2024-06-04 20:15:20 +02:00
# admin_config_global_popular.DELETE_NIP89 = True
# admin_config_global_popular.PRIVKEY = ""
# admin_config_global_popular.EVENTID = "2fea4ee2ccf0fa11db171113ffd7a676f800f34121478b7c9a4e73c2f1990028"
# admin_config_global_popular.POW = True
2024-05-17 10:34:27 +02:00
custom_processing_msg = [ " Looking for popular notes on the Nostr.. " , " Let ' s see what ' s trending on Nostr.. " ,
2024-05-23 10:29:44 +02:00
" Finding the best notes on the Nostr.. " ]
2024-05-17 10:34:27 +02:00
update_db = False
options_global_popular = {
" db_name " : " db/nostr_recent_notes.db " ,
2024-09-15 11:48:02 +02:00
" db_since " : 60 * 60 * 1 , # 1h since gmt,
2024-05-17 10:34:27 +02:00
}
2024-05-17 22:29:58 +02:00
cost = 0
2024-11-14 12:51:38 +01:00
# image = "https://image.nostr.build/b29b6ec4bf9b6184f69d33cb44862db0d90a2dd9a506532e7ba5698af7d36210.jpg"
2024-08-31 10:29:47 +02:00
image = " https://i.nostr.build/AnBKrfAIRMhWm0h3.jpg "
2024-05-28 20:29:11 +02:00
discovery_global = build_example_popular ( " Currently Popular Notes DVM " ,
" discovery_content_test " ,
admin_config = admin_config_global_popular ,
options = options_global_popular ,
image = image ,
cost = cost ,
2024-05-30 21:06:25 +02:00
update_rate = global_update_rate ,
2024-05-28 20:29:11 +02:00
processing_msg = custom_processing_msg ,
2024-09-09 11:25:51 +02:00
update_db = update_db ,
database = DATABASE )
2024-05-16 10:29:51 +02:00
discovery_global . run ( )
2024-06-07 23:45:26 +02:00
# discovery_test_sub = content_discovery_currently_popular.build_example_subscription("Currently Popular Notes DVM (with Subscriptions)", "discovery_content_test", admin_config)
# discovery_test_sub.run()
2024-08-29 13:06:09 +02:00
admin_config_nostriga = AdminConfig ( )
2024-11-14 12:51:38 +01:00
admin_config_nostriga . REBROADCAST_NIP89 = False # rebroadcast_NIP89
admin_config_nostriga . REBROADCAST_NIP65_RELAY_LIST = False # rebroadcast_NIP65_Relay_List
2024-08-29 13:06:09 +02:00
admin_config_nostriga . UPDATE_PROFILE = update_profile
admin_config_nostriga . DELETE_NIP89 = True
2024-11-14 12:51:38 +01:00
# admin_config_nostriga.PRIVKEY = "6221e31813df07037dd90a608fc4cf29222c59da130f76c7f8d0d19c3a876d8e"
# admin_config_nostriga.EVENTID = "24ac21fb32993744232356bafcabd821e4afed4b18aac8d7e670d1071f6ad77a"
# admin_config_nostriga.POW = True
2024-08-29 13:06:09 +02:00
options_nostriga = {
2024-11-14 12:51:38 +01:00
" search_list " : [ " nostriga " , " #nostriga " , " #noobday " ] ,
2024-08-29 13:06:09 +02:00
" avoid_list " : [ " porn " , " smoke " , " nsfw " ,
" encryption " , " government " , " airpod " , " ipad " , " iphone " , " android " , " warren " ,
" moderna " , " pfizer " , " corona " , " socialism " , " critical theory " , " murder " , " tax " , " engagement " ,
" gdp " , " global markets " ,
" presidency " , " dollar " , " asset " , " microsoft " , " amazon " , " billionaire " , " ceo " , " industry " ,
2024-11-14 12:51:38 +01:00
" white house " , " summary " , " wealth " , " beef " , " cunt " , " nigger " , " business " ,
2024-08-29 13:06:09 +02:00
" retail " , " bakery " , " synth " , " slaughterhouse " , " hamas " , " dog days " , " ww3 " , " socialmedia " ,
2024-11-14 12:51:38 +01:00
" nintendo " , " deepfake " , " congressman " , " cypherpunk " , " minister " , " dissentwatch " ,
2024-08-29 13:06:09 +02:00
" inkblot " , " covid " , " robot " , " pandemic " , " bethesda " , " zap farming " , " defi " , " minister " ,
" nostr-hotter-site " , " palestine " , " https://boards.4chan " , " https://techcrunch.com " ,
" https://screenrant.com " ] ,
" db_name " : " db/nostr_recent_notes.db " ,
" db_since " : 12 * 60 * 60 , # 12h since gmt
" personalized " : False ,
" logger " : False }
image = " https://image.nostr.build/007c8b252f1ea60361082921e1c232260e823c903e7edab092de47ae63bdcf0b.png "
description = " I ' m a temporary DVM and I show notes about Nostriga ' "
custom_processing_msg = [ " Finding notes about Nostriga #nostriga " , ]
update_db = False
cost = 0
2024-11-14 12:51:38 +01:00
# discovery_nostriga = build_example_topic("Nostriga", "discovery_content_nostriga",
2024-08-29 13:06:09 +02:00
# admin_config_nostriga, options_nostriga,
# image=image,
# description=description,
# update_rate=global_update_rate,
# cost=cost,
# processing_msg=custom_processing_msg,
# update_db=update_db)
2024-11-14 12:51:38 +01:00
# discovery_nostriga.run()
2024-08-29 13:06:09 +02:00
2024-06-07 23:45:26 +02:00
# Subscription Manager DVM
2024-07-11 10:10:42 +02:00
subscription_config = DVMConfig ( )
subscription_config . PRIVATE_KEY = check_and_set_private_key ( " dvm_subscription " )
npub = Keys . parse ( subscription_config . PRIVATE_KEY ) . public_key ( ) . to_bech32 ( )
2024-09-19 11:55:34 +02:00
invoice_key , admin_key , wallet_id , lnaddress = check_and_set_ln_bits_keys ( " dvm_subscription " , npub )
2024-11-13 16:06:53 +01:00
subscription_config . SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST
2024-09-14 12:22:31 +02:00
subscription_config . RELAY_LIST = RELAY_LIST
2024-07-11 10:10:42 +02:00
subscription_config . LNBITS_INVOICE_KEY = invoice_key
subscription_config . LNBITS_ADMIN_KEY = admin_key # The dvm might pay failed jobs back
subscription_config . LNBITS_URL = os . getenv ( " LNBITS_HOST " )
sub_admin_config = AdminConfig ( )
2024-11-14 12:51:38 +01:00
# sub_admin_config.USERNPUBS = ["7782f93c5762538e1f7ccc5af83cd8018a528b9cd965048386ca1b75335f24c6"] #Add npubs of services that can contact the subscription handler
2024-07-11 10:10:42 +02:00
x = threading . Thread ( target = Subscription , args = ( Subscription ( subscription_config , sub_admin_config ) , ) )
x . start ( )
2024-11-14 12:51:38 +01:00
# make sure the last thing joins, either here by calling x.join() or in a call a dvm with .run(True)
2024-08-21 10:32:35 +02:00
x . join ( )
2024-07-11 10:10:42 +02:00
2024-11-14 12:51:38 +01:00
# keep_alive()
2024-03-05 16:04:02 +01:00
if __name__ == ' __main__ ' :
env_path = Path ( ' .env ' )
if not env_path . is_file ( ) :
with open ( ' .env ' , ' w ' ) as f :
print ( " Writing new .env file " )
f . write ( ' ' )
if env_path . is_file ( ) :
print ( f ' loading environment from { env_path . resolve ( ) } ' )
dotenv . load_dotenv ( env_path , verbose = True , override = True )
else :
raise FileNotFoundError ( f ' .env file not found at { env_path } ' )
playground ( )