-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbot.py
33 lines (28 loc) · 1.24 KB
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import disnake, re, env
from disnake.ext import commands
from colorama import init, Style, Fore
from datetime import datetime
init()
intents = disnake.Intents.default()
intents.message_content = True
bot = commands.InteractionBot(intents=intents)
@bot.event
async def on_ready():
game = disnake.Game("кубы 🧊")
await bot.change_presence(activity=game)
print(f'{Fore.LIGHTBLUE_EX}[{datetime.now()}] [LAUNCH] - Loaded as {bot.user}{Style.RESET_ALL}')
@bot.slash_command(description="Проверить пинг бота")
async def ping(inter):
await inter.response.send_message(f'Pong! Ping: `{round(bot.latency*1000)} ms`')
@bot.event
async def on_message(ctx):
if ctx.author != bot.user:
for word in env.BANWORDS:
regex = r'\b('+word+r')\b' # прикол
match = re.search(regex, ctx.content, re.IGNORECASE)
if match:
image = disnake.File('./nope.png','nope.png')
await ctx.delete()
await ctx.channel.send(f'<@{ctx.author.id}>, я запрещаю вам говорить `{word}`', file=image)
print(f'{Fore.LIGHTCYAN_EX}[{datetime.now()}] [BLOCKD] - Blocked word "{word}" from {ctx.author}{Style.RESET_ALL}')
bot.run(env.TOKEN)