Giter Site home page Giter Site logo

coinbot's Introduction

Coinbot 🤖🪙

GitHub last commit GitHub issues Python version

I am building one of the largest collection of different euro coins collected from free currency circulation. Each euro coin has:

  • a value (1 cent to 2 euro)
  • a country (currently 20)
  • a year (1999 until today)
  • (German coin mints additionally have a single character denoting the minting location)

As of mid 2024, there are 2801 coins, from which i have collected almost 1400 (~50%). This Telegram coinbot helps me (and enthusiastic fellows) to identify and catalog new coins. It's perfect for numismatics enthusiasts and casual collectors alike!

Text the Telegram coinbot with @coincollectionbot

QR Code

Screenshots 📸

Request Status
Request Status

Development Setup 🛠️

Installation

git clone https://github.com/jannisborn/coinbot.git
cd coinbot
poetry install
poetry shell

Local deployment

NOTE: You will need the secrets.json file with the tokens for Telegram and Anyscale (LLMs) and the public link to the source file. Open an issue if you need help

Then run:

python app.py

Production 🌐

On Linux, place the file coinbot.service into your /etc/systemd/system/. Then run:

sudo systemctl daemon-reload # Reload daemon
# start on boot
sudo systemctl enable coinbot.service 
sudo systemctl start coinbot.service

Some useful commands:

# Check service is up
sudo systemctl status coinbot.service

# Restart service
sudo systemctl restart coinbot.service

# Fetch logs
journalctl -u coinbot.service -f

# Remove logs
sudo journalctl --vacuum-time=1s

coinbot's People

Contributors

adri1mart1 avatar jannisborn avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

adri1mart1

coinbot's Issues

Bug in report series when some fields have unknown quantities

May 13 19:10:20 v2202105147787154204 poetry[29931]:   File "/root/.cache/pypoetry/virtualenvs/coinbot-jobTb64O-py3.9/lib/python3.9/site-pack
May 13 19:10:20 v2202105147787154204 poetry[29931]:     handler.handle_update(update, self, check, context)
May 13 19:10:20 v2202105147787154204 poetry[29931]:   File "/root/.cache/pypoetry/virtualenvs/coinbot-jobTb64O-py3.9/lib/python3.9/site-pack
May 13 19:10:20 v2202105147787154204 poetry[29931]:     return self.callback(update, context)
May 13 19:10:20 v2202105147787154204 poetry[29931]:   File "/root/coinbot/coinbot/core.py", line 320, in handle_text_message
May 13 19:10:20 v2202105147787154204 poetry[29931]:     self.extract_and_report_series(update, msg)
May 13 19:10:20 v2202105147787154204 poetry[29931]:   File "/root/coinbot/coinbot/core.py", line 353, in extract_and_report_series
May 13 19:10:20 v2202105147787154204 poetry[29931]:     self.report_series(update, coin_df)
May 13 19:10:20 v2202105147787154204 poetry[29931]:   File "/root/coinbot/coinbot/core.py", line 375, in report_series
May 13 19:10:20 v2202105147787154204 poetry[29931]:     amount = large_int_to_readable(row["Amount"] * 1000)
May 13 19:10:20 v2202105147787154204 poetry[29931]:   File "/root/coinbot/coinbot/utils.py", line 47, in large_int_to_readable
May 13 19:10:20 v2202105147787154204 poetry[29931]:     return readable
May 13 19:10:20 v2202105147787154204 poetry[29931]: UnboundLocalError: local variable 'readable' referenced before assignment

Coinbot fails to read translation file

Hello,

I just discovered your project and it seems very interesting.

I ran into an error when starting the program with the translation file:

[...]
File "C:\Users\AdrienMartin\Documents\99-Perso\TelegramCoinbot\coinbot\coinbot\__init__.py", line 4, in <module>
    from .core import CoinBot
  File "C:\Users\AdrienMartin\Documents\99-Perso\TelegramCoinbot\coinbot\coinbot\db.py", line 11, in <module>
    from coinbot.metadata import coin_values, colors, countries
  File "C:\Users\AdrienMartin\Documents\99-Perso\TelegramCoinbot\coinbot\coinbot\metadata.py", line 86, in <module>
    country_to_translations = json.load(f)
  File "C:\Python311\Lib\encodings\cp1252.py", line 23, in decode
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 61: character maps to <undefined>

What do we need in secrets.json file ?

As stated in the README, this part is not so straighforward.

Based on the code I've seen, I've started to create a json file like so:

{
    "telegram-token": "xx",
    "anyscale": "xx",
    "file_link": "xx",
    "slack": "xx"
}

An easy solution would be to create a secrets.json.template file with the expected structure.
In addition, it would be great to have a small explanation in the README on each field to indicate what's expected, at the moment, I only know how to get the telegram-token.

Could you clarify what should I use to make it work please ?

I'm looking forward to try this bot :)

Support staging of collections

  • show a yes/no button once a new coin was found, asking whether it should be staged or not (show before the updated stats are shown)
  • whole DB should have a boolean column staged that is taken into account to compute the stats
  • updated stats should show the delta between current DB and current DB + all staged collections, not just current DB + just-collected-coin
  • column Creator contains the username of the collector
  • after every staging, the current state of the DB is saved to disk and overwrites the previous version

When a new file is loaded from Dropbox

  • if a staged coin was now added, we can copy the Creator value to the new DB.
  • staged coins have to be reset

README

Create README on how to use the bot including QR code for Telegram

Request stats delta to previous version

The idea is to create a historic record of how the DB has been evolving.

Step 1: To avoid saving tons of old copies. Add a column called added_date for the entire DB. Everything that was collected before I started tracking this gets the same date. Save the current DB as csv. When new coins were collected in the xlsm, compare the current-DB (csv) with the new db (extracted from xlsm) and updated teh added-date for the new coins. Re-save the current DB as csv.

Step 1b: Add a field "Created", i.e. when a certain cell was added. Add this to the existing csv with 01.01.2024 and when comparing the DFs, make sure that every not-covered row is added with TODAY as creation date

Step 2:
Then user could request status for a specific time like:
Status 07.04.2023 and user could request a status delta like Status Diff now 07.04.2023. We sub-index the DF s.t. only coins created before the given date are included. Then we measure the stats for both DFs and display the delta

Slack bot if coin was found

Add a slackbot that sends a message whenever a coin was found

  • Ask user for their name in beginning of chat and store as class variable
  • Ask user to confirm that the collection is sent out

Also: Remove data logging messages and df applymap:
FutureWarning: DataFrame.applymap has been deprecated. Use DataFrame.map instead.
self.df = self.df.applymap(lambda x: x.lower() if isinstance(x, str) else x)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.