def maybe_market_tip_to_github(tip): if not settings.GITHUB_CLIENT_ID: return False if not tip.github_url: return False if tip.network != settings.ENABLE_NOTIFICATIONS_ON_NETWORK: return False # prepare message username = tip.username if '@' in tip.username else str('@' + tip.username) _from = " from {}".format(tip.from_name) if tip.from_name else "" warning = tip.network if tip.network != 'mainnet' else "" msg = "⚡️ A tip worth {} {} {} has been granted to {} for this issue{}. ⚡️ \n\nNice work {}, check your email for further instructions. | <a href='https://gitcoin.co/tip'>Send a Tip</a>".format( round(tip.amount, 3), warning, tip.tokenName, username, _from, username) # actually post url = tip.github_url uri = urlparse(url).path uri_array = uri.split('/') try: username = uri_array[1] repo = uri_array[2] issue_num = uri_array[4] post_issue_comment(username, repo, issue_num, msg) except Exception as e: print(e) return False return True
def maybe_market_tip_to_github(tip): if not settings.GITHUB_CLIENT_ID: return False if not tip.github_url: return False if tip.network != settings.ENABLE_NOTIFICATIONS_ON_NETWORK: return False # prepare message username = tip.username if '@' in tip.username else str('@' + tip.username) _from = " from {}".format(tip.from_name) if tip.from_name else "" warning = tip.network if tip.network != 'mainnet' else "" msg = "⚡️ A tip worth {} {} {} {} has been granted to {} for this issue{}. ⚡️ \n\nNice work {}, check your email for further instructions. \n\n * ${} in Funded OSS Work Available at: https://gitcoin.co/explorer\n * Incentivize contributions to your repo: <a href='https://gitcoin.co/tip'>Send a Tip</a> or <a href='https://gitcoin.co/funding/new'>Fund a PR</a>\n * No Email? Get help on the <a href='https://gitcoin.co/slack'>Gitcoin Slack</a>" msg = msg.format( round(tip.amount, 3), warning, tip.tokenName, "(${})".format(tip.value_in_usdt) if tip.value_in_usdt else "", username, _from, username, amount_usdt_open_work()) # actually post url = tip.github_url uri = urlparse(url).path uri_array = uri.split('/') try: username = uri_array[1] repo = uri_array[2] issue_num = uri_array[4] post_issue_comment(username, repo, issue_num, msg) except Exception as e: print(e) return False return True
def maybe_market_to_github(bounty, event_name, txid): if not settings.GITHUB_CLIENT_ID: return False if bounty.get_natural_value() < 0.0001: return False if bounty.network != settings.ENABLE_NOTIFICATIONS_ON_NETWORK: return False # prepare message msg = '' if event_name == 'new_bounty': usdt_value = "(" + str(round(bounty.value_in_usdt, 2)) + " USD)" if bounty.value_in_usdt else "" msg = "__This issue now has a funding of {} {} {} attached to it.__\n\n * If you would like to work on this issue you can claim it [here]({}).\n * If you've completed this issue and want to claim the bounty you can do so [here]({})\n".format(round(bounty.get_natural_value(), 4), bounty.token_name, usdt_value, bounty.get_absolute_url(), bounty.get_absolute_url()) elif event_name == 'approved_claim': msg = "__The funding of {} {} attached to this issue has been approved & issued.__ \n\nLearn more at: {}".format(round(bounty.get_natural_value(), 4), bounty.token_name, bounty.get_absolute_url()) else: return False # actually post url = bounty.github_url uri = urlparse(url).path uri_array = uri.split('/') try: username = uri_array[1] repo = uri_array[2] issue_num = uri_array[4] post_issue_comment(username, repo, issue_num, msg) except Exception as e: print(e) return False return True
def maybe_market_to_github(bounty, event_name, txid): if not settings.GITHUB_CLIENT_ID: return False if bounty.get_natural_value() < 0.0001: return False # prepare message msg = '' if event_name == 'new_bounty': usdt_value = "(" + str(round(bounty.value_in_usdt, 2) ) + " USDT)" if bounty.value_in_usdt else "" msg = "__This issue now has a bounty of {} {} {} attached to it.__ To view or claim this bounty, [click here]({}).".format( round(bounty.get_natural_value(), 4), bounty.token_name, usdt_value, bounty.get_absolute_url()) elif event_name == 'approved_claim': msg = "__The bounty of {} {} attached to this issue has been approved & issue.d__ \n\nLearn more at: {}".format( round(bounty.get_natural_value(), 4), bounty.token_name, bounty.get_absolute_url()) else: return False # actually post url = bounty.github_url uri = urlparse(url).path uri_array = uri.split('/') try: username = uri_array[1] repo = uri_array[2] issue_num = uri_array[4] post_issue_comment(username, repo, issue_num, msg) except Exception as e: print(e) return False return True
def maybe_market_to_github(bounty, event_name, txid): if not settings.GITHUB_CLIENT_ID: return False if bounty.get_natural_value() < 0.0001: return False if bounty.network != settings.ENABLE_NOTIFICATIONS_ON_NETWORK: return False # prepare message msg = '' usdt_value = "(" + str(round(bounty.value_in_usdt, 2)) + " USD)" if bounty.value_in_usdt else "" if event_name == 'new_bounty': msg = "__This issue now has a funding of {} {} {} attached to it.__\n\n * If you would like to work on this issue you can claim it [here]({}).\n * If you've completed this issue and want to claim the bounty you can do so [here]({})\n * Questions? Get help on the <a href='https://gitcoin.co/slack'>Gitcoin Slack</a>\n * ${} more Funded OSS Work Available at: https://gitcoin.co/explorer\n" msg = msg.format( round(bounty.get_natural_value(), 4), bounty.token_name, usdt_value, bounty.get_absolute_url(), bounty.get_absolute_url(), amount_usdt_open_work(), ) elif event_name == 'rejected_claim': msg = "__This claim for the funding of {} {} {} attached to this issue has been **rejected** and can now be claimed by someone else.__\n\n * If you would like to work on this issue you can claim it [here]({}).\n * If you've completed this issue and want to claim the bounty you can do so [here]({})\n * Questions? Get help on the <a href='https://gitcoin.co/slack'>Gitcoin Slack</a>\n * ${} more Funded OSS Work Available at: https://gitcoin.co/explorer\n" msg = msg.format( round(bounty.get_natural_value(), 4), bounty.token_name, usdt_value, bounty.get_absolute_url(), bounty.get_absolute_url(), amount_usdt_open_work(), ) elif event_name == 'new_claim': msg = "__The funding of {} {} {} attached has been claimed {}.__ {} \n\n * Learn more [on the gitcoin issue page]({})\n * Questions? Get help on the <a href='https://gitcoin.co/slack'>Gitcoin Slack</a>\n * ${} more Funded OSS Work Available at: https://gitcoin.co/explorer\n" msg = msg.format( round(bounty.get_natural_value(), 4), bounty.token_name, usdt_value, "by @{}".format(bounty.claimee_github_username) if bounty.claimee_github_username else "", "\n\n {}, please leave a comment to let the funder {} and the other parties involved your implementation plan. If you don't leave a comment, the funder may expire your claim at their discretion." .format( "@{}".format(bounty.claimee_github_username) if bounty.claimee_github_username else "If you are the claimee", "(@{})".format(bounty.bounty_owner_github_username) if bounty.bounty_owner_github_username else "", ), bounty.get_absolute_url(), amount_usdt_open_work(), ) elif event_name == 'approved_claim': msg = "__The funding of {} {} {} attached to this issue has been approved & issued {}.__ \n\n * Learn more at [on the gitcoin issue page]({})\n * Questions? Get help on the <a href='https://gitcoin.co/slack'>Gitcoin Slack</a>\n * ${} more Funded OSS Work Available at: https://gitcoin.co/explorer\n" msg = msg.format( round(bounty.get_natural_value(), 4), bounty.token_name, usdt_value, "to @{}".format(bounty.claimee_github_username) if bounty.claimee_github_username else "", bounty.get_absolute_url(), amount_usdt_open_work(), ) else: return False # actually post url = bounty.github_url uri = urlparse(url).path uri_array = uri.split('/') try: username = uri_array[1] repo = uri_array[2] issue_num = uri_array[4] post_issue_comment(username, repo, issue_num, msg) except Exception as e: print(e) return False return True