[암호화폐] 그것이 알고 싶다!! 오늘 air drop된 토큰이 있을까? 그리고 텔레그램 봇 알람

in #sct5 years ago

scot에서 신규로 발행되는 토큰이 정말 많습니다. 조건에 맞으면 air drop으로 제 구좌에 들어옵니다. 그런데 언제 무엇이 왔는지 알 방법이 별로 없습니다.

그래서 우선 air drop된 토큰이 있는지 확인하는 파이썬 프로그램을 만들었습니다. air drop 여부를 판단하는 방법은 최근에 tokens에서 이체된 토큰과 현재 토큰 잔고와 같으면 air drop으로 간주합니다. 좀 더 정확하게 파악하려면 기존 보유 토큰 정보를 유지하고 있으면 됩니다.


아래 링크에서 air-drop된 토큰을 출력을 해 주는 파이썬 프로그램이 돌려볼 수 있습니다.
https://repl.it/@zonemultiwhs/finding-air-drop-tokens

사용법은 찾고자 하는 계정 리스트와 최근 일자를 변경한 후 위에 있는 run 버튼을 누르면 됩니다.

# interesting accounts
accounts =[ "tradingideas", "tradingideas.spt"]
# 계산하고 싶은 최근 일자
MAX_DAYS = 7

그 결과는 아래와 같습니다.

GG 토큰이 air-drop 되었다고 나오는데, 이전에 받은 토큰을 모두 이체를 해서 0인 상태에서 채굴이 되다 보니 air-drop으로 인지를 했습니다. 아는 토큰인 경우에는 무시하면 될 것 같습니다. 신규로 토큰 두 개가 air-drop 되었군요.


air-drop된 토큰을 찾는 프로그램을 돌려보는 것도 일입니다. 그래서 일전에 만든 텔레그램 봇에 air-drop된 토큰이 있는지 주기적으로 확인하는 기능을 넣었습니다.

텔레그램 봇은 사용자의 명령어에 응대하는 방식입니다. 하지만 알람 기능은 사용자의 입력과 상관없이 동작을 하여야 합니다.

어떻게 하는 궁금하여 구글링을 해보았습니다. 제가 필요한 정확한 답을 찾았습니다.
https://stackoverflow.com/questions/47138143/how-to-write-the-callback-function-of-a-telegram-bot-for-the-job-queue?rq=1

방법은 timer handler를 등록시키고, 사용자가 해당 명령어를 입력하면, 원하는 주기로 특정 함수가 call 되도록 등록을 하는 방식입니다. air-drop 토큰은 자주 확인할 필요가 없으므로 하루에 한 번만 확인하도록 하였습니다.

air_drop_checked = 0
def callback_alarm(bot, job):
    global air_drop_checked
    if (air_drop_checked == 0) :
        print("check air drop")
        print_airdroped_tokens(bot, job.context)
        air_drop_checked += 1
    else :
        air_drop_checked += 1  # every 10 sec
        if (air_drop_checked  >  8640 ) : # 24 hour
            air_drop_checked = 0

def callback_timer(bot, update, job_queue):
    bot.send_message(chat_id=update.message.chat_id,
                     text='Setting a timer for 60 minute!')

    job_queue.run_repeating(callback_alarm, 10, context=update.message.chat_id)  # callback callback_alarm every 10 secs

dp.add_handler(CommandHandler('timer', callback_timer, pass_job_queue=True))

텔레그램 봇에 뜬 air-drop 알람입니다.

앞으로 이 함수에서 주기적으로 처리해야 할 일들을 하면 될 것 같습니다. 예를 들어 토큰 claim, staking, 가격이 급등하는 토큰 등등 다양한 알람을 처리할 수 있을 것 같습니다.

텔레그램 봇의 용처가 참 다양할 것 같습니다.

Sort:  

jcar토큰,
8월 구독 보팅입니다.
행복한 8월 되세요. ^^

오~ 나중에 지금까지 하신 코딩들만 모아서 페이지 만드셔도 수요가 있을것 같아요!! ^^

SCT천사의 오늘의 미션! (8월 14일)
https://www.steemcoinpan.com/sct/@sct1004/sct-8-14
참여 감사드립니다.(풀봇 드립니다.)

Hi @tradingideas!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 4.401 which ranks you at #2448 across all Steem accounts.
Your rank has not changed in the last three days.

In our last Algorithmic Curation Round, consisting of 157 contributions, your post is ranked at #106.

Evaluation of your UA score:
  • Some people are already following you, keep going!
  • The readers like your work!
  • Try to improve on your user engagement! The more interesting interaction in the comments of your post, the better!

Feel free to join our @steem-ua Discord server

Thank you for your continued support towards JJM. For each 1000 JJM you are holding, you can get an additional 1% of upvote. 10,000JJM would give you a 11% daily voting from the 700K SP virus707 account.

팔로우하고갑니다. 좋은 정보 잘 읽고갑니다. 좋은 하루보내세요^^

scot 신규토큰들도 너무 많아져서 어떤토큰인지도 모르고 스팀엔진에 들어 왔을때는 그냥 팔아버리네요.

어떤 토큰인지 알아보는 것 자체가 에너지 소비가 크죠. 어쩔 수 없는 것 같아요.

Posted using Partiko Android

Coin Marketplace

STEEM 0.32
TRX 0.12
JST 0.034
BTC 64664.11
ETH 3166.18
USDT 1.00
SBD 4.11