Replies: 1 comment 2 replies
-
Hi, thanks, Ill use the telegram one. You seem like a dev so Ill ask: I was looking at the current code and I could not find where to setup the gas Price, I just found a call to an event
Do you know where i can find it? from what you have seen in the code. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
To avoid checking the console every 5 minutes to see the earnings, I decided to create this script with the help of artificial intelligence. The script, which runs in Python, is designed to send notifications on Telegram hourly with the results provided by the bot. To install and run it, you need Python installed on your system. I believe these scripts can be integrated into the bot, allowing the automation of checking and transferring funds, making the process more efficient and saving time.
import json
import time
import requests
import schedule
import os
TOKEN = os.getenv('TELEGRAM_BOT_TOKEN')
CHAT_ID = os.getenv('TELEGRAM_CHAT_ID')
if not TOKEN or not CHAT_ID:
print("Ensure that the environment variables 'TELEGRAM_BOT_TOKEN' and 'TELEGRAM_CHAT_ID' are set correctly.")
exit()
def send_message_to_telegram(text):
try:
url = f"https://api.telegram.org/bot{TOKEN}/sendMessage"
params = {'chat_id': CHAT_ID, 'text': text} # Here we use params instead of data
response = requests.get(url, params=params) # And we use the GET method instead of POST
response.raise_for_status()
def send_statistics():
try:
# Replace here with the full or relative path to your file
file_path = '/root/................................'
with open(file_path, 'r') as file:
data = json.load(file)
Profit USD: {data['profit_usd']}
Profit Crypto: {data['profit_crypto']}
Percentage: {data['percentage']}%
Win: {data['win']}
Loss: {data['loss']}
Bet Errors: {data['betErrors']}
Total Tx Gas Fee: {data['totalTxGasFee']}
Total Tx Gas Fee USD: {data['totalTxGasFeeUsd']}
"""
send_message_to_telegram("This is a test message.")
schedule.every(65).minutes.do(send_statistics)
while True:
schedule.run_pending()
time.sleep(1)
The second script is one that checks my wallet every minute, and if the balance reaches the threshold I have set, of +10%, it automatically transfers it to another wallet as profit. This way, the initial amount with which I started betting remains in the wallet I use on PancakeSwap.
from web3 import Web3
import time
import logging
import os
Logging setup
logging.basicConfig(level=logging.INFO)
Connect to BSC node
w3 = Web3(Web3.HTTPProvider('https://bsc-dataseed1.binance.org:443'))
Recipient wallet address and validation
recipient_wallet_address = os.getenv('RECIPIENT_WALLET_ADDRESS')
if recipient_wallet_address is None or not w3.is_address(recipient_wallet_address):
logging.error("The recipient wallet address is either invalid or not set!")
exit()
Minimum amount and percentage to be transferred
minimum_balance = 0.8 # in BNB
transfer_percentage = 10 # 10% of balance
Time interval (in seconds) for checking the balance
check_interval = 60 # once per minute
def check_and_transfer(wallet_address, private_key):
try:
if wallet_address is None or not w3.is_address(wallet_address):
logging.error(f"The wallet address {wallet_address} is either invalid or not set!")
return
while True:
wallets = {
os.getenv('WALLET_ADDRESS_1'): os.getenv('PRIVATE_KEY_1'),
#os.getenv('WALLET_ADDRESS_2'): os.getenv('PRIVATE_KEY_2'),
}
Beta Was this translation helpful? Give feedback.
All reactions