Skip to content

The SatoshiPriceBot is a Telegram bot to get some information and conversion based on Bitcoin.

License

Notifications You must be signed in to change notification settings

GaloisField2718/SatoshiPriceBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SatoshiPriceBot 🤖

This repository contains the code for the telegram Bot : SatoshiPriceBot.

Installation

For Telegram usage please find two major references behind :

⚠️ Features

Due to the oshi's feature which is fetching data from selenium you will be required to have Google chrome installed on your computer. No worries, you can download as in ubuntu server, google_chrome [Wiki ubuntu-fr] and for other OS you can download from Official link.

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - 
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install google-chrome-stable

Verify : google-chrome --version

Initialisation

git clone https://github.com/GaloisField2718/SatoshiPriceBot.git && cd SatoshiPriceBot

Python env

I created this repo with pipenv as Package Manager Pipenv: A Guide to the New Python Packaging Tool – Real Python.

To run a Python environnement with pipenv :

pipenv shell

After this, like npm run :

pipenv install --ignore-pipfile

It will install every required dependancies.

Bot token

After creating your bot with BotFather, take its token numbers:Letters, create a file .env and insert :

KEY=numbers:Letters

Run

After installation, you can run your bot with :

cd src && python3 bot_v6.1.py

Warning be sure to run pipenv shell if you are using a new terminal session.

Add new commands

To add new commands you should

  1. create a new function :
async def your_function(update: Update, context: ContextTypes.DEFAULT_TYPE) : 
    #Some actions
  1. I recommend you to add your new function in helper function. a) add message_your_function = "/your_function : What my incredible function do. Example : \n " b) add it in the global helper message message_help += message_your_function

  2. Create a handler for your function

your_function_handler = CommandHandler('your_function', your_function) # You can name differently the command for the user and your function itself

application.add_handler(your_function_handler)

And... That's it. You created your first new command in this bot.

Updates

Information about Runes from Unisat runes market. Floor selling order and marketcap based on current floor price on Unisat.

Be free to update this repo and chat with me about improvement proposals. It's a small compilation of diverse code that I did over the time in my coding journey. It's a pleasure to think about possible improvements.

Next goal should be to handle errors which can occurs due to multiple browser and get calls. Display information on user side.

TODO

  • Important: Handle errors during browser and requests calls. Provide a feedback to the user about the error. Provide tracking into loggin to be able to help the user if there is a problem in transportation or server side.

  • Use get_xpath into fetch_runes.fetch rather than full xpath.

  • Fetch prices from Atomical marketplace like BRC-20.

    • I tried to copy paste the code for Unisat but it's not working like this.
    • It should be quite easy !
  • Use API of unisat instead of scrapping their website.

  • Improve UX with :

    • making recommandations of available commands ;
    • if someone type a conversion command without amount : /sats2eur send a message to say : 'Enter the amount to convert' and after then make the conversion ;
  • Improve HTML treatment which is not good for /btcInfo for example ;

  • Make a containerisation of this code with Docker.

Contact

🐣 Galois Field

📩 mail

🤖 The Bot

About

The SatoshiPriceBot is a Telegram bot to get some information and conversion based on Bitcoin.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages