Coder Social home page Coder Social logo

kodycode / coinmarketbot Goto Github PK

View Code? Open in Web Editor NEW
35.0 8.0 24.0 613 KB

[ARCHIVED] A Discord bot that automatically reports updates of crypto from https://coinmarketcap.com/

License: MIT License

Python 100.00%
python3 discord coinmarketcap

coinmarketbot's Introduction

Discord Bots Discord Bots Discord Bots Discord Bots

CoinMarketBot

[4/15/2020] As of this day, the bot will no longer be hosted publically. I'm happy that the bot has reached a point of catering ~780 servers totaling ~258,000 members, but no longer do I have interest or the investment to maintain it. Should anyone have questions or need help with hosting their own bot, feel free to reach out to me. Preferably, I'd look at the v1 code to better understand the bot's original functionality. While it doesn't support Coinmarketcap's v2 API during that time, it's cleaner than some of the workarounds I had to do to accomadate for the API changes.

A Discord bot that sends constant cryptocurrency updates to text-channel subscribers and can create alert notifications.

Created with Python 3.6 and the CoinMarketCap API wrapper.

Click here to add the bot to your server.

Discord Bots

Installation:

  1. Install necessary requirements using pip install -r requirements.txt
  2. Rename config_template.json to config.json
  3. Enter your discord token inside the token variable in config.json
  4. Enter coinmarketcal id and secret in their respective fields
    (You can create and find both from here https://api.coinmarketcal.com/)
  5. Run with python bot.py or python3 bot.py

You're also given the option to change the command prefix as you see fit inside of the config.json.

If you want to use the :small_green_triangle: emoji, I've uploaded it in the emoji folder. To use it for your bot, have a server with the emoji uploaded to it (while also naming it small_green_triangle) and edit the id of the SMALL_GREEN_TRIANGLE variable at the top of coin_market.py to the emoji ID of your emoji.

Commands:

This bot has commands to look up cryptocurrencies, subscribe to live updates, create crypto price alerts for the user, and many more.

See examples of the commands here

See wiki page here or type $help.

Stay tuned for more features.

Donations:

paypal

coinmarketbot's People

Contributors

kodycode avatar thesm2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coinmarketbot's Issues

Actually a suggestion

I love the bot. Its easy to use, and the commands are simple.

1. I would love to see multiline prices, something like this
$s btc eth xrp
so this would be only one post, instead of typing all three separatly

Example

2. also, a nice touch would be special commands for like top 10 coins
$btc
$eth
$xrp
that dont need $s before them

Again, thanks for the great work you do. Have a good one

ERROR:root:Bot failed to run

I'm getting this error while trying to run bot.py :
Starting bot..
ERROR:root:Bot failed to run: timeout() got an unexpected keyword argument 'loop'
timeout() got an unexpected keyword argument 'loop'
INFO:bot_logger:Bot is now offline.
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000014399D3EF28>

Proper Database

Bot needs a database storing all subscriber/alert data. Holding data within JSON files was a short-term solution but it's slowly going to reach a point where JSON storage is inefficient.

Change who receives alerts

I have made a bot with Zapier to post to Discord when I update a row on Google Sheets. I'd like to include an alert with the $addab command referencing cells in the process, but if I post this command with a Zapier bot, will it only alert the Zapier bot and not me? If this is the case, is there a way to change the alert to @everyone or my account instead of the bot?

Adding integration with exchanges to get balance, filtered market data, portfolio in the bot

Hi @kodycode I would like to be able to connect the bot with exchanges like Bittrex and Binance to get filtered market data instead of adding them to subscriber list manually, another features like building your portfolio with live changes on your holding would be great to have. I have built another bot after getting inspired with you work and learning python on the side just to make this bot with the above said features using pandas, exchange API's and discord library.

Bot went haywire, left our Discord

Hey,

yesterday something weird happened. The bot started posting on it's own without being queried by users, and all it would post would be messages like this:

Invalid currency: otcha

It did that a few dozen times with different, unknown coin names. Then all of a sudden the bot leaves our server (and the bot role getting deleted).

Crashing after a few minutes

Once I start it all works ok and commands can be ran.
However after a few minutes it just stops working with this error:

Failed to update market. See error.log.
Task was destroyed but it is pending!
task: <Task pending coro=<CoreFunctionality._continuous_updates_() running at /home/user/CoinMarketDiscordBot/cogs/modules/core_functionality.py:55> wait_for=<Future pending cb=[BaseSelectorEventLoop._sock_connect_done(7)(), Task._wakeup()]>>

error.log

[01/06/2018 10:32:12 PM](core_functionality.py) - ERROR - Exception: Failed to find currency: ``. Check if this currency is valid and also check for spelling errors.
[01/06/2018 10:32:12 PM](core_functionality.py) - ERROR - Exception: Market list was not loaded.
[01/06/2018 10:32:12 PM](subscriber_functionality.py) - ERROR - CurrencyException: Invalid currency: `sumokoin`
[01/06/2018 10:32:12 PM](core_functionality.py) - ERROR - Exception: Destination must be Channel, PrivateChannel, User, or Object. Received NoneType
[01/06/2018 10:32:12 PM](core_functionality.py) - INFO - Bot is online.
[01/06/2018 10:32:12 PM](bot.py) - INFO - Bot is now offline.
[01/06/2018 10:36:59 PM](bot.py) - INFO - Starting bot..
[01/06/2018 10:37:00 PM](core_functionality.py) - INFO - Bot updated.
[01/06/2018 10:37:00 PM](core_functionality.py) - INFO - Bot is online.
[01/06/2018 10:41:49 PM](core_functionality.py) - ERROR - Exception: Failed to find currency: ``. Check if this currency is valid and also check for spelling errors.
[01/06/2018 10:41:49 PM](bot.py) - INFO - Bot is now offline.

Coinmarketcal: daily overview

Hi,

Thanks for fixing our previous issue so quickly.
Would it be possible to have the bot post an overview of todays's, tomorrow's and perhaps weekly events?
This in some kind of dropdown so one doesn't get several pages spammed?

Thanks,

Brando

Using bot

it looks like all user can use the the bot witch i dont like, is there any way that we could make so only admin can use the bot or both if wanted. thanks

Coin names not matching up?

First off, thanks for the admin settings ;)
I tried to create an alert for YOYO but it kept saying that coin wasn't found. I know that if I wanted to create an alert for POET it would find it and recognize it as Po.et. Can the trading names of coins be added to the database?

suggestion for alerts

Just wondering if it would be possible to have alerts price set to BTC instead of fiat?
would be wonderful!

great work so far, cheers!

Rare occurrence where subscriber list gets wiped

On a rare occurrence, the bot will wipe many channels from the subscriber list. I'm not quite aware of the factors that cause this since it could be many things, though I presume it may be the bot's failure to identify channels during a time where discord servers go down or when the bot somehow disconnects while trying to publish live data.

In any case, I've temporarily disabled auto-deletion when publishing live data until I create a better solution to prevent this from happening again.

Wrong event date for coinmarketcal events

Hi there,

We're a big fan of your bot but encounter one small issue: when using the cal utility the coinmarketcal events are returned with an incorrect date (one month ahead).
See screenshot:
screen shot 2018-06-26 at 23 10 38

Best regards,

Brando

Building on Mac

Hello,

could you please help me with building CoinMarketDiscordBot on Mac.
I have installed python3. What is needed steps now? Please describe it for absolute noob in python.
I tried to run command pip install -r requirements.txt but it's not working and also modules missing.
like:

  1. open terminal
  2. type ..... to select folder with build
  3. download coinmarketapi and store them ..
  4. install coinmarket api by command ..

Thank you very much

Unlimited alerts? Multiple alerts w/ same command

I got a notification that I maxed out my alerts (10 max). Can this be increased?

And a follow up request, it would save me alerts for the same coin to separate each price with a comma. Could you make it like this?: $addab xlm > 0.003,0.0033,0.0038 with a max of three prices in the same alert?

Coin Ranking

It would be nice to have CMC ranking right in the bot. For example:

$top 10 - display top 10 coins by market cap
$top 5 gain - display top 5 gainers by price increase
$top 5 loser - display top 5 losers by price decrease

In addition to that, the coin's rank could be displayed in the Discord embed when pulling data for the coin, like so:

price-check - discord 2018-05-13 15-58-14

Feature Request: Option to change command prefix

Hi,

thanks for this awesome bot. I would like to request a feature: Let me change the command prefix from $ to anything else. Often different bots use the same command prefix, which leads to problems (both responding).

Output cache to file for loading after crash

To prevent Bot from pulling new data if it crashes within the hour of just pulling new data in. Useful for preventing the Bot from hitting its API limit and causing deletion of alerts.

Unclosed client session

getting this error on one of my windows 10 machine whereas it runs on the other machine with an issue.

C:\Users\DeathStar\Desktop\Crypto Bots\CoinMarketCap Discord Bot>python bot.py
Starting bot..
ERROR:root:Bot failed to run: [Errno 10053] Cannot connect to host discordapp.com:443 ssl:True [Can not connect to discordapp.com:443 [Connect call failed ('64:ff9b::6810:3b05', 443)]]
[Errno 10053] Cannot connect to host discordapp.com:443 ssl:True [Can not connect to discordapp.com:443 [Connect call failed ('64:ff9b::6810:3b05', 443)]]
INFO:bot_logger:Bot is now offline.
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x043F1050>

Link back to CMC website

It would be nice if the Discord embed had a link back to CMC, so that when you click on the link in the embed, a web browser opens and goes to the coin's/token's page on CMC.

Change alert number to plain text?

img_3561
I got a pushed alert from Discord, which is great, except the formatting is a bit messy, but formatting isn't my main issue. On Discord it looks formatted for Discord with markdown, but the number is formatted to a mathematical number instead of a plain text number, or the way it was entered in, e.g., $addab yoyow > .000012. Is there a way to keep the number formatted in the way it was entered?

And piggybacking on the pushed alerts, is there a way to change the format of the alert for push notifications? It's not a big of deal as the number formatting, so if it needs to stay the same, then that's fine.

API error

01/22/2019 04:32:01 PM - INFO - Starting bot..
01/22/2019 04:32:04 PM - ERROR - Failed to retrieve data - Connection error: Invalid URL 'f8cdf0aa-d298-41aa-a1d9-950d81e2e5cbglobal/': No schema supplied. Perhaps you meant http://f8cdf0aa-d298-41aa-a1d9-950d81e2e5cbglobal/?
01/22/2019 04:32:04 PM - ERROR - Exception: Failed to fetch all cryptocurrencies: 'Market' object has no attribute 'listings'
01/22/2019 04:32:04 PM - ERROR - Exception: Market list was not loaded.
01/22/2019 04:32:04 PM - INFO - Bot is online.

can't install the bot

Hi, i can install the bot with pip.

i have this response when i enter pip install -r requirements.txt :

Traceback (most recent call last): File "/usr/bin/pip", line 9, in <module> from pip import main ImportError: cannot import name main

Crashing every few mins

Bot runs for about 10 mins and crashes, running on Raspberry Pi 3 with latest NOOBS.

Starting bot..
Failed to load cryptocurrency acronyms. See error.log.
CoinMarketDiscordBot is online.
Task was destroyed but it is pending!
task: <Task pending coro=<CoreFunctionality._continuous_updates() running at /home/pi/CoinMarketDiscordBot-master/cogs/modules/core_functionality.py:53> wait_for=<Future pending cb=[BaseSelectorEventLoop._sock_connect_done(11)(), <TaskWakeupMethWrapper object at 0x76b649f0>()]>>

Task was destroyed but it is pending

Get the following error when running bot:

python3 bot.py 
Starting bot..
CoinMarketDiscordBot is online.
Task was destroyed but it is pending!
task: <Task pending coro=<CoreFunctionality._continuous_updates() running at /[redacted]/cogs/modules/core_functionality.py:63> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x10609df18>()]>>

Reverting back to d56ade7 bot works fine. Could possibly be related to 27bd708.

ETH Price

Hello, hope you're doing great in the crypto market, and thanks for your updates so far. I wish I could help develop this with you.

Do you think it would it be possible to look at the ETH price of tokens since for tokens that's what we mostly get used to looking at?

Display coin icon in the Discord embed

Hi,

I would love to see an enhancement to the bot that would display the coin/token icon in the Discord embed when pulling CMC data. Like so:

price-check - discord 2018-05-13 15-58-14

(this is from a different bot)

It would look much nicer. Asthetics count :)

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.