mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-03-17 21:31:52 +01:00
Olas DVM: also look for kind 1111 replies (NIP22)
This commit is contained in:
parent
07529d1622
commit
cc13401e14
@ -5,7 +5,7 @@ from datetime import timedelta
|
||||
|
||||
from nostr_sdk import Timestamp, Tag, Keys, Options, SecretKey, NostrSigner, NostrDatabase, \
|
||||
ClientBuilder, Filter, SyncOptions, SyncDirection, init_logger, LogLevel, EventId, Kind, \
|
||||
RelayLimits
|
||||
RelayLimits, SingleLetterTag, Alphabet
|
||||
|
||||
from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface, process_venv
|
||||
from nostr_dvm.utils import definitions
|
||||
@ -150,8 +150,16 @@ class DicoverContentCurrentlyPopularGallery(DVMTaskInterface):
|
||||
definitions.EventDefinitions.KIND_DELETION,
|
||||
definitions.EventDefinitions.KIND_NOTE]).events(ids).since(since)
|
||||
|
||||
ids_str = []
|
||||
for id in ids:
|
||||
ids_str.append(id.to_hex())
|
||||
|
||||
filter_nip22 = Filter().kinds([definitions.EventDefinitions.KIND_NIP22_COMMENT]).custom_tag(SingleLetterTag.uppercase(Alphabet.E),
|
||||
ids_str).since(since)
|
||||
|
||||
dbopts = SyncOptions().direction(SyncDirection.DOWN)
|
||||
await cli.sync(filtreactions, dbopts)
|
||||
await cli.sync(filter_nip22, dbopts)
|
||||
|
||||
filter2 = Filter().ids(ids)
|
||||
events = await cli.fetch_events([filter2], relay_timeout)
|
||||
@ -169,7 +177,12 @@ class DicoverContentCurrentlyPopularGallery(DVMTaskInterface):
|
||||
filt = Filter().kinds([definitions.EventDefinitions.KIND_ZAP, definitions.EventDefinitions.KIND_REPOST,
|
||||
definitions.EventDefinitions.KIND_REACTION,
|
||||
definitions.EventDefinitions.KIND_NOTE]).event(event.id()).since(since)
|
||||
reactions = await databasegallery.query([filt])
|
||||
|
||||
filter_nip22 = Filter().kinds([definitions.EventDefinitions.KIND_NIP22_COMMENT]).custom_tag(
|
||||
SingleLetterTag.uppercase(Alphabet.E),
|
||||
[event.id().to_hex()])
|
||||
|
||||
reactions = await databasegallery.query([filt, filter_nip22])
|
||||
|
||||
#print("Reactions:" + str(len(reactions.to_vec())))
|
||||
if len(reactions.to_vec()) >= self.min_reactions:
|
||||
|
@ -14,6 +14,7 @@ class EventDefinitions:
|
||||
KIND_REACTION = Kind(7)
|
||||
KIND_NIP68_IMAGEEVENT = Kind(20)
|
||||
KIND_NIP94_METADATA = Kind(1063)
|
||||
KIND_NIP22_COMMENT = Kind(1111)
|
||||
KIND_NIP93_GALLERYENTRY = Kind(1163)
|
||||
KIND_NIP90_EXTRACT_TEXT = Kind(5000)
|
||||
KIND_NIP90_RESULT_EXTRACT_TEXT = Kind(6000)
|
||||
|
@ -9,9 +9,9 @@ from nostr_dvm.utils.admin_utils import AdminConfig
|
||||
from nostr_dvm.utils.dvmconfig import build_default_config
|
||||
from nostr_dvm.utils.nip89_utils import create_amount_tag, NIP89Config, check_and_set_d_tag
|
||||
|
||||
rebroadcast_NIP89 = True # Announce NIP89 on startup
|
||||
rebroadcast_NIP89 = False # Announce NIP89 on startup
|
||||
rebroadcast_NIP65_Relay_List = False
|
||||
update_profile = True
|
||||
update_profile = False
|
||||
|
||||
global_update_rate = 500 # set this high on first sync so db can fully sync before another process trys to.
|
||||
use_logger = True
|
||||
@ -69,8 +69,8 @@ def playground():
|
||||
update_db = True
|
||||
|
||||
options_gallery = {
|
||||
"db_name": "db/nostr_gallery.db",
|
||||
"db_since": 60 * 60 * 24 * 2, # 2d since gmt,
|
||||
"db_name": "db/nostr_olas.db",
|
||||
"db_since": 60 * 60 * 24 * 4, # 2d since gmt,
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user