Не известная мне ошибка. Помогите кто может! Дело в том что любая команда которую пишу не работает не считая тех что для криптовалюты.. вот код:
import discord
import os
import cryptocompare
from datetime import datetime
from discord.ext import commands
import random
bot = discord.ext.commands.Bot(command_prefix = "|");
bot.run("ТОКЕН")
client = discord.Client()
base_command = '|кв'
def default_message():
embed = discord.Embed(
title=":money_with_wings: | Крипто бот",
description="Этот простой бот отслеживает несколько криптовалют, и я уверен, что он поможет вам!",
url="https://new.donatepay.ru/@fom",
color=0x025F896,
)
embed.add_field(name=":dollar: Проверить цены", value="``|кв BTC USD``")
embed.add_field(
name=":chart_with_upwards_trend: Проверить цены раньше",
value="``|кв назад ETH EUR 2018,5,20``",
)
embed.add_field(name=":coin: Список криптовалют", value="``|кв лист``")
embed.set_footer(text="[❗] Минимальная дата: 2017.03.20")
return embed
# Price History Command
def price_history(
command, error_message=None, coin=None, currency=None, timestamp=None
):
try:
coin = command[2]
currency = command[3]
date = [int(x) for x in command[4].split(",")]
timestamp = datetime(date[0], date[1], date[2])
present = datetime.now()
if timestamp > present:
timestamp = present
# Set the minimum date if older than the minimum date
elif timestamp < datetime(2017, 3, 20):
timestamp = datetime(2017, 3, 20)
return coin, currency, timestamp, error_message
except IndexError:
error_message = "**ОШИБКА** Недопустимое количество параметров."
return coin, currency, timestamp, error_message
except ValueError:
error_message = "**ОШИБКА** Недопустимые параметры."
return coin, currency, timestamp, error_message
# Current Price Command
def current_price(command, coin=None, currency=None, error_message=None):
try:
coin = command[1]
currency = command[2]
return coin, currency, error_message
except KeyError:
error_message = "**ОШИБКА** Недопустимые параметры."
return coin, currency, error_message
@client.event
async def on_ready():
print(f"Подключено как {client.user}")
await client.change_presence(activity=discord.Game(name="|help ║ hellik#9999"))
@client.event
async def on_message(message):
if message.author == client.user:
return
try:
if message.content == base_command:
embed = default_message()
await message.channel.send(embed=embed)
else:
command = message.content.split(" ")
# Price History Command
if command[1] == "назад":
coin, currency, timestamp, error_message = price_history(command)
if error_message:
await message.channel.send(error_message)
try:
await message.channel.send(
f"{coin} Цена @ {timestamp.date()}: **{cryptocompare.get_historical_price(coin, currency, timestamp=timestamp)[coin][currency]} {currency}**"
)
except KeyError:
await message.channel.send("**ОШИБКА** Недопустимые параметры.")
# Coin List Command
elif command[1] == "лист":
embed = discord.Embed(
title=":coin: Список Крипты",
url="https://www.cryptocompare.com/coins/list/all/USD/1",
description="Это список допустимых криптовалют, которые вы можете использовать с ботом.",
color=0x025F896,
)
embed.set_thumbnail(
url="https://www.cryptocompare.com/media/20567/cc-logo-vert.png"
)
await message.channel.send(embed=embed)
elif command[1] in cryptocompare.get_coin_list(format=True):
# Current Price Command
coin, currency, error_message = current_price(command)
if error_message:
await message.channel.send(error_message)
try:
await message.channel.send(
f"Сейчас {coin} стоит: **{cryptocompare.get_price(coin, currency)[coin][currency]} {currency}**"
)
except (TypeError, KeyError):
await message.channel.send("**ОШИБКА** Недопустимые параметры.")
# Commands sent in DM
except AttributeError:
if isinstance(message.channel, discord.channel.DMChannel):
pass
HUG = ["https://tenor.com/view/hug-friends-friends-forever-anime-cartoon-gif-4874598",
"https://tenor.com/view/mochi-peachcat-mochi-peachcat-hug-pat-gif-19092449",
"https://tenor.com/view/cuddle-hug-anime-bunny-costumes-happy-gif-17956092",
"https://tenor.com/view/anime-hug-sweet-love-gif-14246498"]
@client.command()
async def hug(ctx, member: discord.Member):
embed = discord.Embed(title="объятия!", description="**{1}** обнял **{0}**!".format(member.name, ctx.message.author.name), color = discord.Color.purple())
embed.set_image(url = random.choice(HUG))
await ctx.send(embed=embed)
if __name__ == "__main__":
client.run('ТОКЕН')
А ВОТ ОШИБКА С ЛЮБОЙ КОМАНДОЙ:
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "hug" is not found