D
D
DmitrNy ---2020-07-03 09:53:59
Python
DmitrNy ---, 2020-07-03 09:53:59

The bot on discord.py crashes when delivering a reaction to a message, what should I do?

Such a situation, when placed on any message on any server where there is a bot, even if it does not interact with this server, it turns off and gives an error How to solve? Tried downloading discord.py, both 1.2.5 and 1.3.3, nothing works. The code:
KeyError: 'animated'

import discord
import colorama
from colorama import Fore, Back, Style
import asyncio



bot = discord.Client()
colorama.init()

@bot.event
async def on_ready():
    print(Fore.CYAN + 'Слежение начато!')

@bot.event
async def on_message(message):
    if message.content.startswith('F'):
        channels = []
        i = 0
        ii = 0
        while i < len(message.guild.text_channels):
           channels.append(message.guild.text_channels[i].name + '  <-NAME --- ID ->' + str(message.guild.text_channels[i].id))
           i += 1
        i = 0
        while i < len(message.guild.voice_channels):
           channels.append(message.guild.voice_channels[i].name + '  <-VOICE --- ID ->' + str(message.guild.voice_channels[i].id))
           i += 1
        for ii in range(len(channels)):
         print(ii, ') ' ,channels[ii], ' , ')
         #await message.channel.send(str(ii) + ') ' + channels[ii] + ' , ')

      print(Fore.GREEN + '[' + str(message.guild.id) + ' \|/ ' + message.guild.name + '] ' + '{'+ str(message.channel.id) + ' \|/ ' + message.channel.name +'}' + Fore.GREEN + message.author.mention + Fore.BLUE + message.author.name + Fore.YELLOW +'  :' + message.content)
        
        channel = message.channel
        while True:
          message = await channel.send('{Message}')
          await message.delete()
          await asyncio.sleep(20) 

bot.run('{token}', bot=False)


Discord.py version 1.2.5

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-07-03
@Alexandre888

use:
py -3 -m pip install -U discord.py

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question