为什么我不能在python的同一代码中使用命令和事件来创建Discord bot

为什么我不能在python的同一代码中使用命令和事件来创建Discord bot,python,Python,代码中的一些东西是克罗地亚语的laungauge,比如“odgovori”和一些字符串。我不熟悉编码,如果smthing Triiger使您………需要取消登录您的客户端,我很抱歉。请按一层处理命令(消息)。当前仅当消息读取Kako si时才执行该命令。将它放在与当前所在的块相同的缩进级别上,机器人将响应命令。我刚刚意识到,我在寻找代码15分钟,但我没有看到它。泰山。 import discord from discord.ext import commands import random cl

代码中的一些东西是克罗地亚语的laungauge,比如“odgovori”和一些字符串。我不熟悉编码,如果smthing Triiger使您………

需要取消登录您的
客户端,我很抱歉。请按一层处理命令(消息)
。当前仅当消息读取
Kako si
时才执行该命令。将它放在与当前所在的
块相同的缩进级别上,机器人将响应命令。我刚刚意识到,我在寻找代码15分钟,但我没有看到它。泰山。
import discord
from discord.ext import commands
import random

client=commands.Bot(command_prefix=".")

@client.event
async def on_ready():     #tells  me if bot is ready
    print("Bot je spreman")

@client.event
async def on_member_join(member):  #Bot says hi to member in her dm
    await member.create_dm()
    await member.dm_channel.send(f"Bok{member.name}, dobrodošao")

@client.event
async def on_message(message):    # Ignore messages made by the bot
    if message.author == client.user:
        return

    odgovori = ["Dobro sam","Lose sam","OK sam"]

    if message.content == "Kako si":   #Bot responds to message(When i put this block in my code my commands wont work. How do i fix this?)
        odg = random.choice(odgovori)
        await message.channel.send(odg)
        await client.process_commands(message)

@client.command(aliases=["kick"])     #Bot kick people from server
@commands.has_permissions(kick_members = True)
async def k(ctx,member : discord.Member,*,reason= "Bez razloga"):
    await member.send("Izbacen si sa servera, zbog"+reason)
    await member.kick(reason=reason)

@client.command(aliases=["clear"])     #Bot deletes messages
@commands.has_permissions(manage_messages = True)
async def c(ctx,kolicina=2):
    await ctx.channel.purge(limit= kolicina)

@client.command()
async def ping(ctx):            #Bot shows ping
    await ctx.send(f"{round(client.latency * 1000)}ms")



client.run(TOKEN)