Хочу сделать код для дискорд бота на моём проекте. Сделал всё правильно но выдается ошибка Tab Error:inconsistent use of tabs and spaces in indentation
Вот мой код: P.S Я не ввел токен специально
import random
import discord
from discord.ext import commands
move = ['!move']
cake = ['!cake']
client = commands.Bot(command_prefix='!')
@client.event
async def on_message(message):
msg = message.content.lower()
rand = random.randrange(3, 13)
if msg in move:
work_timer = {}
if message.content.startswith('!move'):
try:
work_time = work_timer[message.author.id]
work_timer[message.author.id] = time.time()
if work_timer[message.author.id] - work_time <= 60:
await client.send_message(message.channel, "Ты сможешь использовать эту команду через 1 минуту")
return
else:
if rand == 3:
await message.channel.send('Вы смогли переместиться на' + ' ' + str(rand) + ' ' + 'клеток вперёд! Но вы потеряли 9 единиц голода.')
if rand == 4:
await message.channel.send('Вы смогли переместиться на' + ' ' + str(rand) + ' ' + 'клеток вперёд! Но вы потеряли 12 единиц голода.')
if rand == 5:
await message.channel.send('Вы смогли переместиться на' + ' ' + str(rand) + ' ' + 'клеток вперёд! Но вы потеряли 15 единиц голода.')
if rand == 6:
await message.channel.send('Вы смогли переместиться на' + ' ' + str(rand) + ' ' + 'клеток вперёд! Но вы потеряли 18 единиц голода.')
if rand == 7:
await message.channel.send('Вы смогли переместиться на' + ' ' + str(rand) + ' ' + 'клеток вперёд! Но вы потеряли 21 единиц голода.')
if rand == 8:
await message.channel.send('Вы смогли переместиться на' + ' ' + str(rand) + ' ' + 'клеток вперёд! Но вы потеряли 24 единиц голода.')
if rand == 9:
await message.channel.send('Вы смогли переместиться на' + ' ' + str(rand) + ' ' + 'клеток вперёд! Но вы потеряли 27 единиц голода.')
if rand == 10:
await message.channel.send('Вы смогли переместиться на' + ' ' + str(rand) + ' ' + 'клеток вперёд! Но вы потеряли 30 единиц голода.')
if rand == 11:
await message.channel.send('Вы смогли переместиться на' + ' ' + str(rand) + ' ' + 'клеток вперёд! Но вы потеряли 33 единиц голода.')
if rand == 12:
await message.channel.send('Вы смогли переместиться на' + ' ' + str(rand) + ' ' + 'клеток вперёд! Но вы потеряли 36 единиц голода.')
if rand == 13:
await message.channel.send('Вы смогли переместиться на' + ' ' + str(rand) + ' ' + 'клеток вперёд! Но вы потеряли 39 единиц голода.')
@client.event
async def on_message2(message):
msg = message.content.lower()
if msg in cake:
await message.channel.send('С днём рождения Шниленд! Вам выдан бесплатный приз в виде 10 единиц Голода')```
Ошибка:
C:\Users\77715>"C:\Users\77715\Desktop\Discord Bot\bot.py"
File "C:\Users\77715\Desktop\Discord Bot\bot.py", line 19
try:
^
TabError: inconsistent use of tabs and spaces in indentation
except:
соответствующийtry:
? – CrazyElf 26 июн '20 в 18:40