import discord
from discord.ext import commands
from discord.ext import tasks
import random
import time
import asyncio
#connect+token
TOKEN = 'ODM0Njg5NDc1NjYwNzQyNjY2.YIEjJg.6yd7H73U7fmFfwQM-EvvQ47OvSU'
bot = commands.Bot(command_prefix='.')
#prefix !
#идея команд боту
starts=['bot','бот']
answer=['Да, я тут ' , 'Да , я Вас слушаю','паша лох']
#удаление сообщений
@bot.command()
async def clear( ctx , amount=100 ):
print('faza 2')
author=ctx.message.author
await ctx.channel.purge( limit = amount)
await ctx.send(f'я удалил сообщения как вы и просили { author.mention }')
time.sleep(2)
await ctx.channel.purge( limit = 1)
@bot.command()
async def test(ctx):
print('faza 1')
author=ctx.message.author
await ctx.send('Mr '+f'{ author.mention } Рад Вас видеть')
@bot.event
#ответ бота на выражние
async def on_message( message ):
msg=message.content.lower()
if msg in starts :
await message.channel.send(random.choice(answer))
bot.run(TOKEN)