Answer the question
In order to leave comments, you need to log in
Please find the error in the python code (discord bot). what did I do wrong?
writes an error on:
import requests
No module named 'requests'
import discord
from discord.ext import commands
from discord.ext.commands import Bot
Bot = commands.Bot(command_prefix= "D_")
@Bot.event
async def on_ready():
print ("Я готов работать!\nЧто делать?")
@Bot.command()
async def hello(ctx):
author = ctx.message.author
await ctx.send(f'Привет, {author.mention}!')
@Bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandNotFound ):
await ctx.send(embed = discord.Embed(description = f'** {ctx.author.name}, данной команды не существует.**', color=0x0c0c0c))
import json
import requests
@Bot.command()
async def fox(ctx):
response = requests.get('https://some-random-api.ml/img/fox')
json_data = json.loads(response.text)
embed = discord.Embed(color = 0xff9900, title = 'Random Fox')
embed.set_image(url = json_data['link'])
await ctx.send(embed = embed)
Bot.run(open('token.txt', 'r').readline())
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question