2.1
This commit is contained in:
parent
888753f53a
commit
a4f03f180e
3 changed files with 51 additions and 14 deletions
46
cogs/logs.py
Normal file
46
cogs/logs.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
|
||||
|
||||
class Logs(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_member_join(self, member):
|
||||
msg = f"{member.name} зашёл на сервер."
|
||||
await self.bot.get_channel(901001501202317322).send(msg)
|
||||
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_member_remove(self, member):
|
||||
msg = f"{member.name} вышел с сервера."
|
||||
await self.bot.get_channel(901001501202317322).send(msg)
|
||||
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_message_edit(self, before, after):
|
||||
msg = f"Сообщение от до изменений {before.content}\n" \
|
||||
f"Сообщение после изменений {after.content}"
|
||||
await self.bot.get_channel(901001501202317322).send(msg)
|
||||
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_message_delete(self, message):
|
||||
msg = f"Удалённое сообщение от: {message.content}\n"
|
||||
await self.bot.get_channel(901001501202317322).send(msg)
|
||||
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_voice_state_update(self, member: nextcord.Member, before: nextcord.VoiceState, after: nextcord.VoiceState):
|
||||
if before.channel is None:
|
||||
msg = f"{member.display_name} зашел в канал {after.channel.mention}"
|
||||
elif after.channel is None:
|
||||
msg = f"{member.display_name} покинул канап {before.channel.mention}"
|
||||
elif before.channel != after.channel:
|
||||
msg = f"{member.display_name} перешел из канала {before. channel.mention} в канал {after.channel.mention}"
|
||||
await self.bot.get_channel (901001501202317322).send(msg)
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Logs(bot))
|
|
@ -5,6 +5,7 @@ import youtube_dl
|
|||
|
||||
from nextcord.ext import commands
|
||||
|
||||
|
||||
# Suppress noise about console usage from errors
|
||||
youtube_dl.utils.bug_reports_message = lambda: ''
|
||||
|
||||
|
|
18
main.py
18
main.py
|
@ -2,7 +2,6 @@ from webserver import keep_alive
|
|||
import os
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
import time
|
||||
import json
|
||||
import requests
|
||||
import random
|
||||
|
@ -15,14 +14,12 @@ PREFIX = "$"
|
|||
bot = commands.Bot(command_prefix=PREFIX, description="Hi")
|
||||
bot.remove_command("help")
|
||||
|
||||
version = "Bot v2.0"
|
||||
ctime = time.strftime("Today is %X %x", time.localtime())
|
||||
|
||||
version = "Bot v2.1"
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
print(f"Bot logged as {bot.user} | {version}")
|
||||
print(f"{ctime}")
|
||||
await bot.change_presence(status=nextcord.Status.online,activity=nextcord.Game("$help"))
|
||||
|
||||
|
||||
|
@ -99,12 +96,6 @@ async def ver(ctx):
|
|||
print(f"[Logs:utils] Информация о боте была выведена | {PREFIX}ver")
|
||||
|
||||
|
||||
@bot.command()
|
||||
async def clear(ctx, amount=5):
|
||||
await ctx.channel.purge(limit=amount + 1)
|
||||
print(f"[Logs:utils] {amount} сообщений удалено| {PREFIX}purge")
|
||||
|
||||
|
||||
@bot.command()
|
||||
async def say(ctx, *, text):
|
||||
await ctx.message.delete()
|
||||
|
@ -162,9 +153,9 @@ async def userinfo(ctx, user: nextcord.User):
|
|||
)
|
||||
|
||||
|
||||
@bot.command()
|
||||
@bot.command(aliases = ['clear', 'purge'])
|
||||
async def clean(ctx, amount=None):
|
||||
await ctx.channel.purge(limit=int(amount))
|
||||
await ctx.channel.purge(limit=int(amount) + 1)
|
||||
print(f"[Logs:utils] {amount} сообщений удалено | {PREFIX}clean")
|
||||
|
||||
|
||||
|
@ -253,9 +244,8 @@ async def google(ctx, *, query: str):
|
|||
async def yandex(ctx, *, query: str):
|
||||
await ctx.reply(f'Результаты запроса `{query}`', view=Yandex(query))
|
||||
|
||||
#MUSIC
|
||||
|
||||
#MUSIC END
|
||||
#COGS
|
||||
|
||||
|
||||
@bot.command() ## Стандартное объявление комманды
|
||||
|
|
Loading…
Reference in a new issue