Рознь криптовалюты бот - последующие


Я обновил мой раздрай бот, код здесь:

Мой бот может сделать следующее:

  1. Цена
  2. Звание
  3. За 24 ч объем
  4. 1 смена кадровой процентов
  5. 24 изменение кадровой процентов
  6. 7Д процентное изменение
  7. Символ
  8. Общее предложение
  9. (Для некоторых) есть упоминание о Творце (или творцах) для вас, чтобы читать

Все это, в 1 короткую команду!

Наслаждайтесь! Если у вас есть какие-либо вопросы или пожелания, дайте мне знать!

import random
import asyncio
import requests
from discord import Game
from discord.ext.commands import Bot
import aiohttp
import discord
BOT_PREFIX = ("?", "!")
TOKEN = ""

client = Bot(command_prefix=BOT_PREFIX)


async def on_ready(self):
    await client.say("I am online!")


@client.command()
async def btc():
    url = 'https://api.coinmarketcap.com/v1/ticker/bitcoin/'
    response = requests.get(url)
    value = response.json()[0]["price_usd"]
    rank = response.json()[0]["rank"]
    supply = response.json()[0]["total_supply"]
    change1 = response.json()[0]["percent_change_1h"]
    change24 = response.json()[0]["percent_change_24h"]
    change72 = response.json()[0]["percent_change_7d"]
    vol24 = response.json()[0]["24h_volume_usd"]
    sym = response.json()[0]["symbol"]
    await client.say("Bitcoins price is: $" + value)
    await client.say("Bitcoins rank is: " + rank)
    await client.say("Bitcoins total supply is: " + supply)
    await client.say("Bitcoins percent change in the past hour is: " +change1)
    await client.say("Bitcoins percent change in the past 24 hours is:" + change24)
    await client.say("Bitcoins percent change in the past 7 days is: " + change72)
    await client.say("Bitcoins 24 hour volume is: " + vol24)
    await client.say("Bitcoins symbol is: " + sym)
    await client.say("_________________________________________________")
    await client.say("""In 2008, an unknown developer (or developer group) invented bitcoin as a new way to send value over the internet.
all we know about this person or persons, is that there pseudonym, or perhaps real name is Satoshi Nakamoto.""")
########################################################################done
@client.command()
async def eth():
    url = 'https://api.coinmarketcap.com/v1/ticker/ethereum/'
    response = requests.get(url)
    value = response.json()[0]["price_usd"]
    rank = response.json()[0]["rank"]
    supply = response.json()[0]["total_supply"]
    change1 = response.json()[0]["percent_change_1h"]
    change24 = response.json()[0]["percent_change_24h"]
    change72 = response.json()[0]["percent_change_7d"]
    vol24 = response.json()[0]["24h_volume_usd"]
    sym = response.json()[0]["symbol"]
    await client.say("Ethereum price is: $" + value)
    await client.say("Ethereums rank is: " + rank)
    await client.say("Ethereums total supply is: " + supply)
    await client.say("Ethereums percent change in the past hour is: " +change1)
    await client.say("Ethereums percent change in the past 24 hours is:" + change24)
    await client.say("Ethereums percent change in the past 7 days is: " + change72)
    await client.say("Ethereums 24 hour volume is: " + vol24)
    await client.say("Ethereums symbol is: " + sym)
    await client.say("_________________________________________________")
    await client.say("""In 2008, an unknown developer (or developer group) invented bitcoin as a new way to send value over the internet.
Four years later, a 19-year-old dreamed up a new platform based off of this innovation in an effort to transform the internet entirely.
This 19 year old, Vitalik Buterin later invented Ethereum, raising more then 18 million dollars.""")
###################################done
@client.command()
async def ripple():
    url = 'https://api.coinmarketcap.com/v1/ticker/ripple/'
    response = requests.get(url)
    value = response.json()[0]["price_usd"]
    rank = response.json()[0]["rank"]
    supply = response.json()[0]["total_supply"]
    change1 = response.json()[0]["percent_change_1h"]
    change24 = response.json()[0]["percent_change_24h"]
    change72 = response.json()[0]["percent_change_7d"]
    vol24 = response.json()[0]["24h_volume_usd"]
    sym = response.json()[0]["symbol"]
    await client.say("Ripples price is: $" + value)
    await client.say("Ripples rank is: " + rank)
    await client.say("Ripples total supply is: " + supply)
    await client.say("Ripples percent change in the past hour is: " +change1)
    await client.say("Ripples percent change in the past 24 hours is:" + change24)
    await client.say("Ripples percent change in the past 7 days is:" + change72)
    await client.say("Ripples 24 hour volume is:" + vol24)
    await client.say("Ripples symbol is: " + sym)
    await client.say("""The founders of the cryptocurrency Ripple are:
Chris Larsen, Jed McCaleb. They founded Ripple Labs, Inc. in 2012.""")
###########done
@client.command()
async def litecoin():
    url = 'https://api.coinmarketcap.com/v1/ticker/litecoin/'
    response = requests.get(url)
    value = response.json()[0]["price_usd"]
    rank = response.json()[0]["rank"]
    supply = response.json()[0]["total_supply"]
    change1 = response.json()[0]["percent_change_1h"]
    change24 = response.json()[0]["percent_change_24h"]
    change72 = response.json()[0]["percent_change_7d"]
    vol24 = response.json()[0]["24h_volume_usd"]
    sym = response.json()[0]["symbol"]
    await client.say("Litecoins price is: $" + value)
    await client.say("Litecoins rank is: " + rank)
    await client.say("Litecoins total supply is: " + supply)
    await client.say("Litecoins percent change in the past hour is: " +change1)
    await client.say("Litecoins percent change in the past 24 hours is:" + change24)
    await client.say("Litecoins percent change in the past 7 days is:" + change72)
    await client.say("Litecoins 24 hour volume is:" + vol24)
    await client.say("Litecoins symbol is: " + sym)
    await client.say("_________________________________________________")
    await client.say("""The original author of Litecoin is: Charlie Lee.
Litecoins inital release was in October of 2011.
Like Bitcoin, litecoin is a peer to peer cryptocurrency and a open source software project realesed under the MIT/X11 license.""")

###########done
async def neo():
    url = 'https://api.coinmarketcap.com/v1/ticker/neo/'
    response = requests.get(url)
    value = response.json()[0]["price_usd"]
    await client.say("NEO price is: $" + value)
@client.command()
async def eos():
    url = 'https://api.coinmarketcap.com/v1/ticker/eos/'
    response = requests.get(url)
    value = response.json()[0]["price_usd"]
    await client.say("EOS price is: $" + value)
@client.command()
async def dash():
    url = 'https://api.coinmarketcap.com/v1/ticker/dash/'
    response = requests.get(url)
    value = response.json()[0]["price_usd"]
    await client.say("DASH price is: $" + value)
@client.command()
async def zcash():
    url = 'https://api.coinmarketcap.com/v1/ticker/zcash/'
    response = requests.get(url)
    value = response.json()[0]["price_usd"]
    await client.say("Zcash price is: $" + value)
@client.command()
async def metal():
    url = 'https://api.coinmarketcap.com/v1/ticker/metal/'
    response = requests.get(url)
    value = response.json()[0]["price_usd"]
    await client.say("METAL coin price is: $" + value)
@client.command()
async def trump():
    url = 'https://api.coinmarketcap.com/v1/ticker/trumpcoin/'
    response = requests.get(url)
    value = response.json()[0]["price_usd"]
    await client.say("Trump Coin price is: $" + value)
@client.command()
async def gas():
    url = 'https://api.coinmarketcap.com/v1/ticker/gas/'
    response = requests.get(url)
    value = response.json()[0]["price_usd"]
    await client.say("GAS coin price is: $" + value)
@client.command()
async def gts():
    url = 'https://api.coinmarketcap.com/v1/ticker/game/'
    response = requests.get(url)
    value = response.json()[0]["price_usd"]
    await client.say("GTS coin price is: $" + value)
@client.command()
async def salus():
    url = 'https://api.coinmarketcap.com/v1/ticker/salus/'
    response = requests.get(url)
    value = response.json()[0]["price_usd"]
    await client.say("Salus coin price is: $" + value)

##########################
















client.run(TOKEN)


121
0
задан 1 апреля 2018 в 05:04 Источник Поделиться
Комментарии