mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-04-10 04:39:16 +02:00
DVM: custom processing message Option
This commit is contained in:
parent
85dac0f244
commit
d7c0c918a5
@ -191,6 +191,7 @@ class DVM:
|
||||
|
||||
if dvm_config.SEND_FEEDBACK_EVENTS:
|
||||
send_job_status_reaction(nip90_event, "processing", True, 0,
|
||||
content=dvm_config.CUSTOM_PROCESSING_MESSAGE,
|
||||
client=self.client, dvm_config=self.dvm_config, user=user)
|
||||
|
||||
# when we reimburse users on error make sure to not send anything if it was free
|
||||
@ -218,6 +219,7 @@ class DVM:
|
||||
". Starting processing.. Balance remains at: " + str(user.balance))
|
||||
|
||||
send_job_status_reaction(nip90_event, "processing", True, 0,
|
||||
content=dvm_config.CUSTOM_PROCESSING_MESSAGE,
|
||||
client=self.client, dvm_config=self.dvm_config)
|
||||
|
||||
do_work(nip90_event, amount)
|
||||
@ -310,6 +312,7 @@ class DVM:
|
||||
if amount <= invoice_amount:
|
||||
print("[" + self.dvm_config.NIP89.NAME + "] Payment-request fulfilled...")
|
||||
send_job_status_reaction(job_event, "processing", client=self.client,
|
||||
content=dvm_config.CUSTOM_PROCESSING_MESSAGE,
|
||||
dvm_config=self.dvm_config, user=user)
|
||||
indices = [i for i, x in enumerate(self.job_list) if
|
||||
x.event == job_event]
|
||||
|
@ -193,7 +193,7 @@ class DicoverContentCurrentlyPopular(DVMTaskInterface):
|
||||
# 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
|
||||
# playground or elsewhere
|
||||
def build_example(name, identifier, admin_config):
|
||||
def build_example(name, identifier, admin_config, processing_msg=None):
|
||||
dvm_config = build_default_config(identifier)
|
||||
dvm_config.USE_OWN_VENV = False
|
||||
dvm_config.SHOWLOG = True
|
||||
@ -202,6 +202,10 @@ def build_example(name, identifier, admin_config):
|
||||
# dvm_config.SUBSCRIPTION_REQUIRED = True
|
||||
# dvm_config.SUBSCRIPTION_DAILY_COST = 1
|
||||
dvm_config.FIX_COST = 0
|
||||
dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg
|
||||
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
||||
|
||||
|
||||
|
||||
# Add NIP89
|
||||
nip89info = {
|
||||
@ -233,7 +237,7 @@ def build_example(name, identifier, admin_config):
|
||||
admin_config=admin_config)
|
||||
|
||||
|
||||
def build_example_subscription(name, identifier, admin_config):
|
||||
def build_example_subscription(name, identifier, admin_config, processing_msg=None):
|
||||
dvm_config = build_default_config(identifier)
|
||||
dvm_config.USE_OWN_VENV = False
|
||||
dvm_config.SHOWLOG = True
|
||||
@ -241,6 +245,10 @@ def build_example_subscription(name, identifier, admin_config):
|
||||
# Activate these to use a subscription based model instead
|
||||
# dvm_config.SUBSCRIPTION_DAILY_COST = 1
|
||||
dvm_config.FIX_COST = 0
|
||||
dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg
|
||||
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
||||
|
||||
|
||||
|
||||
# Add NIP89
|
||||
nip89info = {
|
||||
|
@ -211,7 +211,7 @@ class DicoverContentCurrentlyPopularFollowers(DVMTaskInterface):
|
||||
# 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
|
||||
# playground or elsewhere
|
||||
def build_example(name, identifier, admin_config):
|
||||
def build_example(name, identifier, admin_config, processing_msg=None):
|
||||
dvm_config = build_default_config(identifier)
|
||||
dvm_config.USE_OWN_VENV = False
|
||||
dvm_config.SHOWLOG = True
|
||||
@ -220,6 +220,9 @@ def build_example(name, identifier, admin_config):
|
||||
# dvm_config.SUBSCRIPTION_REQUIRED = True
|
||||
# dvm_config.SUBSCRIPTION_DAILY_COST = 1
|
||||
dvm_config.FIX_COST = 0
|
||||
dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg
|
||||
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
||||
|
||||
|
||||
# Add NIP89
|
||||
nip89info = {
|
||||
@ -251,7 +254,7 @@ def build_example(name, identifier, admin_config):
|
||||
admin_config=admin_config)
|
||||
|
||||
|
||||
def build_example_subscription(name, identifier, admin_config):
|
||||
def build_example_subscription(name, identifier, admin_config, processing_msg=None):
|
||||
dvm_config = build_default_config(identifier)
|
||||
dvm_config.USE_OWN_VENV = False
|
||||
dvm_config.SHOWLOG = True
|
||||
@ -259,6 +262,7 @@ def build_example_subscription(name, identifier, admin_config):
|
||||
# Activate these to use a subscription based model instead
|
||||
# dvm_config.SUBSCRIPTION_DAILY_COST = 1
|
||||
dvm_config.FIX_COST = 0
|
||||
dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg
|
||||
|
||||
# Add NIP89
|
||||
nip89info = {
|
||||
|
@ -218,7 +218,7 @@ class DicoverContentCurrentlyPopularbyTopic(DVMTaskInterface):
|
||||
# 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
|
||||
# playground or elsewhere
|
||||
def build_example(name, identifier, admin_config, options, image, description):
|
||||
def build_example(name, identifier, admin_config, options, image, description, processing_msg=None):
|
||||
dvm_config = build_default_config(identifier)
|
||||
dvm_config.USE_OWN_VENV = False
|
||||
dvm_config.SHOWLOG = True
|
||||
@ -227,6 +227,9 @@ def build_example(name, identifier, admin_config, options, image, description):
|
||||
# dvm_config.SUBSCRIPTION_REQUIRED = True
|
||||
# dvm_config.SUBSCRIPTION_DAILY_COST = 1
|
||||
dvm_config.FIX_COST = 0
|
||||
dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg
|
||||
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
||||
|
||||
|
||||
# Add NIP89
|
||||
nip89info = {
|
||||
@ -255,13 +258,16 @@ def build_example(name, identifier, admin_config, options, image, description):
|
||||
admin_config=admin_config, options=options)
|
||||
|
||||
|
||||
def build_example_subscription(name, identifier, admin_config, options, image, description):
|
||||
def build_example_subscription(name, identifier, admin_config, options, image, description, processing_msg=None):
|
||||
dvm_config = build_default_config(identifier)
|
||||
dvm_config.USE_OWN_VENV = False
|
||||
dvm_config.SHOWLOG = True
|
||||
dvm_config.SCHEDULE_UPDATES_SECONDS = 600 # Every 10 minutes
|
||||
# Activate these to use a subscription based model instead
|
||||
dvm_config.FIX_COST = 0
|
||||
dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg
|
||||
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
||||
|
||||
|
||||
# Add NIP89
|
||||
nip89info = {
|
||||
|
@ -97,9 +97,10 @@ class TrendingNotesNostrBand(DVMTaskInterface):
|
||||
# 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
|
||||
# playground or elsewhere
|
||||
def build_example(name, identifier, admin_config):
|
||||
def build_example(name, identifier, admin_config, custom_processing_msg):
|
||||
dvm_config = build_default_config(identifier)
|
||||
dvm_config.USE_OWN_VENV = False
|
||||
dvm_config.CUSTOM_PROCESSING_MESSAGE = custom_processing_msg
|
||||
admin_config.LUD16 = dvm_config.LN_ADDRESS
|
||||
# Add NIP89
|
||||
|
||||
|
@ -38,6 +38,7 @@ class DVMConfig:
|
||||
SEND_FEEDBACK_EVENTS = True
|
||||
SHOW_RESULT_BEFORE_PAYMENT: bool = False # if this is true show results even when not paid right after autoprocess
|
||||
SCHEDULE_UPDATES_SECONDS = 0
|
||||
CUSTOM_PROCESSING_MESSAGE = None
|
||||
|
||||
|
||||
def build_default_config(identifier):
|
||||
|
2
setup.py
2
setup.py
@ -1,6 +1,6 @@
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
VERSION = '0.3.7'
|
||||
VERSION = '0.3.8'
|
||||
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')
|
||||
|
||||
|
@ -51,10 +51,11 @@ def playground():
|
||||
|
||||
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"
|
||||
discovery_test_sub = content_discovery_currently_popular_topic.build_example("Garden & Growth",
|
||||
"discovery_content_garden",
|
||||
admin_config_plants, options_plants, image,
|
||||
description)
|
||||
description, custom_processing_msg)
|
||||
discovery_test_sub.run()
|
||||
|
||||
# Popular Animals (Fluffy frens)
|
||||
@ -83,29 +84,38 @@ def playground():
|
||||
|
||||
image = "https://image.nostr.build/f609311532c470f663e129510a76c9a1912ae9bc4aaaf058e5ba21cfb512c88e.jpg"
|
||||
description = "I show recent notes about animals"
|
||||
|
||||
custom_processing_msg = "Looking for fluffy frens..."
|
||||
|
||||
discovery_animals = content_discovery_currently_popular_topic.build_example("Fluffy Frens",
|
||||
"discovery_content_fluffy",
|
||||
admin_config_animals, options_animal, image,
|
||||
description)
|
||||
description, custom_processing_msg)
|
||||
discovery_animals.run()
|
||||
|
||||
# Popular Followers
|
||||
admin_config_followers = AdminConfig()
|
||||
admin_config_followers.REBROADCAST_NIP89 = False
|
||||
admin_config_followers.UPDATE_PROFILE = False
|
||||
custom_processing_msg = "Looking for popular notes from your followers.."
|
||||
|
||||
discovery_followers = content_discovery_currently_popular_followers.build_example("Currently Popular Notes from npubs you follow",
|
||||
"discovery_content_followers",
|
||||
admin_config_followers)
|
||||
admin_config_followers,
|
||||
custom_processing_msg)
|
||||
discovery_followers.run()
|
||||
|
||||
#Popular Global
|
||||
admin_config_global_popular = AdminConfig()
|
||||
admin_config_global_popular.REBROADCAST_NIP89 = False
|
||||
admin_config_global_popular.UPDATE_PROFILE = False
|
||||
custom_processing_msg = "Looking for popular notes on the Nostr.."
|
||||
|
||||
|
||||
discovery_global = content_discovery_currently_popular.build_example("Currently Popular Notes DVM",
|
||||
"discovery_content_test",
|
||||
admin_config_global_popular)
|
||||
admin_config_global_popular,
|
||||
custom_processing_msg)
|
||||
discovery_global.run()
|
||||
|
||||
|
||||
@ -115,8 +125,9 @@ def playground():
|
||||
|
||||
#Popular NOSTR.band
|
||||
admin_config_trending_nostr_band = AdminConfig()
|
||||
custom_processing_msg = "Looking for trending notes on nostr.band.."
|
||||
trending_nb = discovery_trending_notes_nostrband.build_example("Trending Notes on nostr.band",
|
||||
"trending_notes_nostrband", admin_config_trending_nostr_band)
|
||||
"trending_notes_nostrband", admin_config_trending_nostr_band, custom_processing_msg)
|
||||
trending_nb.run()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user