mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-09-29 04:03:43 +02:00
minor fixes
This commit is contained in:
@@ -346,15 +346,15 @@ class DVM:
|
|||||||
elif not anon:
|
elif not anon:
|
||||||
print("[" + self.dvm_config.NIP89.NAME + "] Note Zap received for DVM balance: " +
|
print("[" + self.dvm_config.NIP89.NAME + "] Note Zap received for DVM balance: " +
|
||||||
str(invoice_amount) + " Sats from " + str(user.name))
|
str(invoice_amount) + " Sats from " + str(user.name))
|
||||||
update_user_balance(self.dvm_config.DB, sender, invoice_amount, client=self.client,
|
# update_user_balance(self.dvm_config.DB, sender, invoice_amount, client=self.client,
|
||||||
config=self.dvm_config)
|
# config=self.dvm_config)
|
||||||
|
|
||||||
# a regular note
|
# a regular note
|
||||||
elif not anon and dvm_config.NIP88 is None:
|
elif not anon and dvm_config.NIP88 is None:
|
||||||
print("[" + self.dvm_config.NIP89.NAME + "] Profile Zap received for DVM balance: " +
|
print("[" + self.dvm_config.NIP89.NAME + "] Profile Zap received for DVM balance: " +
|
||||||
str(invoice_amount) + " Sats from " + str(user.name))
|
str(invoice_amount) + " Sats from " + str(user.name))
|
||||||
update_user_balance(self.dvm_config.DB, sender, invoice_amount, client=self.client,
|
# update_user_balance(self.dvm_config.DB, sender, invoice_amount, client=self.client,
|
||||||
config=self.dvm_config)
|
# config=self.dvm_config)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("[" + self.dvm_config.NIP89.NAME + "] Error during content decryption: " + str(e))
|
print("[" + self.dvm_config.NIP89.NAME + "] Error during content decryption: " + str(e))
|
||||||
|
@@ -202,7 +202,7 @@ class DicoverContentCurrentlyPopular(DVMTaskInterface):
|
|||||||
# We build an example here that we can call by either calling this file directly from the main directory,
|
# We build an example here that we can call by either calling this file directly from the main directory,
|
||||||
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
||||||
# playground or elsewhere
|
# playground or elsewhere
|
||||||
def build_example(name, identifier, admin_config, options, processing_msg=None, update_db=True):
|
def build_example(name, identifier, admin_config, options, cost=0, processing_msg=None, update_db=True):
|
||||||
dvm_config = build_default_config(identifier)
|
dvm_config = build_default_config(identifier)
|
||||||
dvm_config.USE_OWN_VENV = False
|
dvm_config.USE_OWN_VENV = False
|
||||||
dvm_config.SHOWLOG = True
|
dvm_config.SHOWLOG = True
|
||||||
@@ -211,7 +211,7 @@ def build_example(name, identifier, admin_config, options, processing_msg=None,
|
|||||||
# Activate these to use a subscription based model instead
|
# Activate these to use a subscription based model instead
|
||||||
# dvm_config.SUBSCRIPTION_REQUIRED = True
|
# dvm_config.SUBSCRIPTION_REQUIRED = True
|
||||||
# dvm_config.SUBSCRIPTION_DAILY_COST = 1
|
# dvm_config.SUBSCRIPTION_DAILY_COST = 1
|
||||||
dvm_config.FIX_COST = 0
|
dvm_config.FIX_COST = cost
|
||||||
dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg
|
dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg
|
||||||
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
||||||
|
|
||||||
|
@@ -218,7 +218,7 @@ class DicoverContentCurrentlyPopularFollowers(DVMTaskInterface):
|
|||||||
# We build an example here that we can call by either calling this file directly from the main directory,
|
# We build an example here that we can call by either calling this file directly from the main directory,
|
||||||
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
||||||
# playground or elsewhere
|
# playground or elsewhere
|
||||||
def build_example(name, identifier, admin_config, options, processing_msg=None, update_db=True):
|
def build_example(name, identifier, admin_config, options, cost=0, processing_msg=None, update_db=True):
|
||||||
dvm_config = build_default_config(identifier)
|
dvm_config = build_default_config(identifier)
|
||||||
dvm_config.USE_OWN_VENV = False
|
dvm_config.USE_OWN_VENV = False
|
||||||
dvm_config.SHOWLOG = True
|
dvm_config.SHOWLOG = True
|
||||||
@@ -227,7 +227,7 @@ def build_example(name, identifier, admin_config, options, processing_msg=None,
|
|||||||
# Activate these to use a subscription based model instead
|
# Activate these to use a subscription based model instead
|
||||||
# dvm_config.SUBSCRIPTION_REQUIRED = True
|
# dvm_config.SUBSCRIPTION_REQUIRED = True
|
||||||
# dvm_config.SUBSCRIPTION_DAILY_COST = 1
|
# dvm_config.SUBSCRIPTION_DAILY_COST = 1
|
||||||
dvm_config.FIX_COST = 0
|
dvm_config.FIX_COST = cost
|
||||||
dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg
|
dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg
|
||||||
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
||||||
|
|
||||||
|
@@ -233,7 +233,7 @@ class DicoverContentCurrentlyPopularbyTopic(DVMTaskInterface):
|
|||||||
# We build an example here that we can call by either calling this file directly from the main directory,
|
# We build an example here that we can call by either calling this file directly from the main directory,
|
||||||
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
# or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the
|
||||||
# playground or elsewhere
|
# playground or elsewhere
|
||||||
def build_example(name, identifier, admin_config, options, image, description, processing_msg=None, update_db=True):
|
def build_example(name, identifier, admin_config, options, image, description, cost=0, processing_msg=None, update_db=True):
|
||||||
dvm_config = build_default_config(identifier)
|
dvm_config = build_default_config(identifier)
|
||||||
dvm_config.USE_OWN_VENV = False
|
dvm_config.USE_OWN_VENV = False
|
||||||
dvm_config.SHOWLOG = True
|
dvm_config.SHOWLOG = True
|
||||||
@@ -242,7 +242,7 @@ def build_example(name, identifier, admin_config, options, image, description, p
|
|||||||
# Activate these to use a subscription based model instead
|
# Activate these to use a subscription based model instead
|
||||||
# dvm_config.SUBSCRIPTION_REQUIRED = True
|
# dvm_config.SUBSCRIPTION_REQUIRED = True
|
||||||
# dvm_config.SUBSCRIPTION_DAILY_COST = 1
|
# dvm_config.SUBSCRIPTION_DAILY_COST = 1
|
||||||
dvm_config.FIX_COST = 0
|
dvm_config.FIX_COST = cost
|
||||||
dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg
|
dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg
|
||||||
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
||||||
|
|
||||||
|
@@ -195,8 +195,6 @@ def update_user_balance(db, npub, additional_sats, client, config, giftwrap=Fals
|
|||||||
if giftwrap:
|
if giftwrap:
|
||||||
client.send_sealed_msg(PublicKey.parse(npub), message, None)
|
client.send_sealed_msg(PublicKey.parse(npub), message, None)
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
|
||||||
evt = EventBuilder.encrypted_direct_msg(keys, PublicKey.parse(npub), message,
|
evt = EventBuilder.encrypted_direct_msg(keys, PublicKey.parse(npub), message,
|
||||||
None).to_event(keys)
|
None).to_event(keys)
|
||||||
send_event(evt, client=client, dvm_config=config)
|
send_event(evt, client=client, dvm_config=config)
|
||||||
|
2
setup.py
2
setup.py
@@ -1,6 +1,6 @@
|
|||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
VERSION = '0.4.3'
|
VERSION = '0.4.4'
|
||||||
DESCRIPTION = 'A framework to build and run Nostr NIP90 Data Vending Machines'
|
DESCRIPTION = 'A framework to build and run Nostr NIP90 Data Vending Machines'
|
||||||
LONG_DESCRIPTION = ('A framework to build and run Nostr NIP90 Data Vending Machines. See the github repository for more information')
|
LONG_DESCRIPTION = ('A framework to build and run Nostr NIP90 Data Vending Machines. See the github repository for more information')
|
||||||
|
|
||||||
|
@@ -58,11 +58,12 @@ def playground():
|
|||||||
custom_processing_msg = ["Finding the best notes for you.. #blooming", "Looking for some positivity.. #touchgrass",
|
custom_processing_msg = ["Finding the best notes for you.. #blooming", "Looking for some positivity.. #touchgrass",
|
||||||
"Looking for #goodvibes.."]
|
"Looking for #goodvibes.."]
|
||||||
update_db = False
|
update_db = False
|
||||||
|
cost = 0
|
||||||
discovery_test_sub = content_discovery_currently_popular_topic.build_example("Garden & Growth",
|
discovery_test_sub = content_discovery_currently_popular_topic.build_example("Garden & Growth",
|
||||||
"discovery_content_garden",
|
"discovery_content_garden",
|
||||||
admin_config_plants, options_plants,
|
admin_config_plants, options_plants,
|
||||||
image,
|
image,
|
||||||
description, custom_processing_msg,
|
description, cost, custom_processing_msg,
|
||||||
update_db)
|
update_db)
|
||||||
discovery_test_sub.run()
|
discovery_test_sub.run()
|
||||||
|
|
||||||
@@ -97,12 +98,13 @@ def playground():
|
|||||||
|
|
||||||
custom_processing_msg = ["Looking for fluffy frens...", "Let's see if we find some animals for you..",
|
custom_processing_msg = ["Looking for fluffy frens...", "Let's see if we find some animals for you..",
|
||||||
"Looking for the goodest bois and girls.."]
|
"Looking for the goodest bois and girls.."]
|
||||||
|
cost = 0
|
||||||
update_db = True #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
|
update_db = True #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
|
||||||
discovery_animals = content_discovery_currently_popular_topic.build_example("Fluffy Frens",
|
discovery_animals = content_discovery_currently_popular_topic.build_example("Fluffy Frens",
|
||||||
"discovery_content_fluffy",
|
"discovery_content_fluffy",
|
||||||
admin_config_animals, options_animal,
|
admin_config_animals, options_animal,
|
||||||
image,
|
image,
|
||||||
description, custom_processing_msg,
|
description, cost, custom_processing_msg,
|
||||||
update_db)
|
update_db)
|
||||||
discovery_animals.run()
|
discovery_animals.run()
|
||||||
|
|
||||||
@@ -118,12 +120,14 @@ def playground():
|
|||||||
"db_name": "db/nostr_recent_notes.db",
|
"db_name": "db/nostr_recent_notes.db",
|
||||||
"db_since": 2 * 60 * 60, # 2h since gmt,
|
"db_since": 2 * 60 * 60, # 2h since gmt,
|
||||||
}
|
}
|
||||||
|
cost = 0
|
||||||
|
|
||||||
discovery_followers = content_discovery_currently_popular_followers.build_example(
|
discovery_followers = content_discovery_currently_popular_followers.build_example(
|
||||||
"Currently Popular Notes from npubs you follow",
|
"Currently Popular Notes from npubs you follow",
|
||||||
"discovery_content_followers",
|
"discovery_content_followers",
|
||||||
admin_config=admin_config_followers,
|
admin_config=admin_config_followers,
|
||||||
options=options_followers_popular,
|
options=options_followers_popular,
|
||||||
|
cost=cost,
|
||||||
processing_msg=custom_processing_msg,
|
processing_msg=custom_processing_msg,
|
||||||
update_db=update_db)
|
update_db=update_db)
|
||||||
discovery_followers.run()
|
discovery_followers.run()
|
||||||
@@ -140,10 +144,12 @@ def playground():
|
|||||||
"db_name": "db/nostr_recent_notes.db",
|
"db_name": "db/nostr_recent_notes.db",
|
||||||
"db_since": 60 * 60, # 1h since gmt,
|
"db_since": 60 * 60, # 1h since gmt,
|
||||||
}
|
}
|
||||||
|
cost = 0
|
||||||
discovery_global = content_discovery_currently_popular.build_example("Currently Popular Notes DVM",
|
discovery_global = content_discovery_currently_popular.build_example("Currently Popular Notes DVM",
|
||||||
"discovery_content_test",
|
"discovery_content_test",
|
||||||
admin_config=admin_config_global_popular,
|
admin_config=admin_config_global_popular,
|
||||||
options=options_global_popular,
|
options=options_global_popular,
|
||||||
|
cost=cost,
|
||||||
processing_msg=custom_processing_msg,
|
processing_msg=custom_processing_msg,
|
||||||
update_db=update_db)
|
update_db=update_db)
|
||||||
discovery_global.run()
|
discovery_global.run()
|
||||||
|
Reference in New Issue
Block a user