Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/sunagent-app/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "sunagent-app"
version = "0.0.27b5"
version = "0.0.27b6"
license = {file = "LICENSE-CODE"}
description = "sunagent app"
readme = "README.md"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@ class SteemContextBuilder(object):
def __init__(
self,
node: str = "https://api.steemit.com",
host: str = "https://steemit.com",
post_key: str = "",
account_name: str = "",
cache: Optional[CacheStore[str]] = None,
):
self.steem = Steem(node=node, keys=[post_key])
self.post_key = post_key
self.host = host
self.account_name = account_name
self.account = Account(self.account_name, blockchain_instance=self.steem)
self.cache = cache

def _new_post(self, title: str, body: str, tags: List[str], self_vote: bool = False) -> str:
def _new_post(self, title: str, body: str, tags: List[str], self_vote: bool = False) -> tuple[bool, str]:
"""
create new post on steemit
:param title:
Expand All @@ -53,13 +55,14 @@ def _new_post(self, title: str, body: str, tags: List[str], self_vote: bool = Fa
title=title, body=body, author=self.account_name, tags=tags, self_vote=self_vote, permlink=permlink
)
logger.info(f"New post {title} success body: {body} result {res}")
url = f"{self.host}/{tags[0]}/@{self.account_name}/{permlink}"
post_steem_success_count.inc()
return f"post comment success title : {title}"
return True, url
except Exception as e:
logger.error(f"New post {title} failed e : {str(e)}")
logger.error(traceback.format_exc())
post_steem_failure_count.inc()
return f"New post {title} failed e : {str(e)}"
return False, f"New post {title} failed e : {str(e)}"

def _reply_comment(self, authorperm: str, body: str) -> str:
"""
Expand Down
Loading