super edit thay mama

This commit is contained in:
Alex D
2023-04-24 17:55:03 +03:00
parent 4731006753
commit cb8fb7d359
13 changed files with 51 additions and 47 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ class AboutCommand(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command()
@commands.slash_command(name="about")
async def about(self, ctx: disnake.AppCommandInteraction):
embed = disnake.Embed(title='О боте', description='Многофункциональный бот.', color=0x00ff00)
embed.set_author(name='Hyper Tech')
+1 -1
View File
@@ -6,7 +6,7 @@ class AvatarCommand(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command()
@commands.slash_command(name="avatar")
async def avatar(self, ctx: disnake.AppCommandInteraction, member: disnake.Member = None):
if not member:
member = ctx.author
+3 -3
View File
@@ -6,7 +6,7 @@ class BanCommands(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(description="Изгоняет указанного участника с сервера навсегда.")
@commands.slash_command(name="ban", description="Изгоняет указанного участника с сервера навсегда.")
async def ban(self, ctx: disnake.AppCommandInteraction, member: disnake.Member, *, reason=None):
if disnake.utils.get(ctx.author.roles, id=1060542125621649458):
await member.ban(reason=reason)
@@ -15,8 +15,8 @@ class BanCommands(commands.Cog):
await ctx.send(f'{ctx.author.mention}, у вас нет роли <@&1060542125621649458>.')
@commands.has_any_role(1060542125621649458)
@commands.slash_command()
async def unban(ctx: disnake.AppCommandInteraction, *, user: disnake.User):
@commands.slash_command(name="unban")
async def unban(self, ctx: disnake.AppCommandInteraction, *, user: disnake.User):
if disnake.utils.get(ctx.author.roles, id=1060542125621649458):
await ctx.guild.unban(user)
if (user.name, user.discriminator) == (user.name, user.discriminator):
+1 -1
View File
@@ -8,7 +8,7 @@ class CoinsCommand(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command()
@commands.slash_command(name="coins")
async def coins(self, ctx: disnake.AppCommandInteraction):
coin = ["Орел", "Решка"]
result = random.choice(coin)
+1 -1
View File
@@ -6,7 +6,7 @@ class HelpCommand(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command()
@commands.slash_command(name="commands")
async def commands(self, ctx: disnake.AppCommandInteraction):
embed = disnake.Embed(title="Помощь по командам", description="Вот список всех моих команд и их описания:")
embed.add_field(name="/help", value="Показывает список всех доступных команд.")
+1 -1
View File
@@ -7,7 +7,7 @@ class DogCommands(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command()
@commands.slash_command(name="dog")
async def dog(self, ctx: disnake.AppCommandInteraction):
response = requests.get('https://dog.ceo/api/breeds/image/random')
img_url = response.json()['message']
+1 -1
View File
@@ -7,7 +7,7 @@ class MagicBallCommand(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(description="Даёт верные ответы на все ваши вопросы.")
@commands.slash_command(name="ball", description="Даёт верные ответы на все ваши вопросы.")
async def ball(self, ctx: disnake.AppCommandInteraction, *, question):
answers = [
"Я не знаю.",
+1 -1
View File
@@ -6,7 +6,7 @@ class MathCommands(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command()
@commands.slash_command(name="math")
async def math(self, ctx: disnake.AppCommandInteraction, *, equation):
try:
result = eval(equation)
+1 -1
View File
@@ -7,7 +7,7 @@ class PingCommands(commands.Cog):
self.bot = bot
@commands.has_any_role(1091637465858715648)
@commands.slash_command()
@commands.slash_command(name="ping")
async def ping(self, ctx: disnake.AppCommandInteraction):
if disnake.utils.get(ctx.author.roles, id=1091637465858715648):
if ctx.channel.id == 1060544039767789639:
+11 -11
View File
@@ -8,39 +8,39 @@ class MuteCommands(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(description="Заглушает по всему серверу на указанное время.")
@commands.slash_command(name="mute", description="Заглушает по всему серверу на указанное время.")
@commands.has_permissions(manage_roles=True)
async def mute(self, ctx: disnake.AppCommandInteraction, member: disnake.Member, time: int, *, reason=None):
if disnake.utils.get(ctx.author.roles, id=1060541642450411560):
guild = ctx.guild
mutedRole = disnake.utils.get(guild.roles, name="Muted")
muted_role = disnake.utils.get(guild.roles, name="Muted")
if not mutedRole:
mutedRole = await guild.create_role(name="Muted")
if not muted_role:
muted_role = await guild.create_role(name="Muted")
# Проверка роли на каждый чат
for channel in guild.channels:
await channel.set_permissions(mutedRole, speak=False, send_messages=False)
await channel.set_permissions(muted_role, speak=False, send_messages=False)
await member.add_roles(mutedRole, reason=reason)
await member.add_roles(muted_role, reason=reason)
await ctx.send(f"{member.mention} был замучен на {time} секунд. Причина: {reason}.")
await asyncio.sleep(time)
await member.remove_roles(mutedRole)
await member.remove_roles(muted_role)
await ctx.send(f"{member.mention} больше не замучен.")
else:
await ctx.send(f'{ctx.author.mention}, у вас нет роли <@&1060541642450411560>.')
@commands.slash_command(description="Снимает мут с указанного пользователя.")
@commands.slash_command(name="unmute", description="Снимает мут с указанного пользователя.")
@commands.has_permissions(manage_roles=True)
async def unmute(self, ctx: disnake.AppCommandInteraction, member: disnake.Member):
if disnake.utils.get(ctx.author.roles, id=1060541642450411560):
mutedRole = disnake.utils.get(ctx.guild.roles, name="Muted")
muted_role = disnake.utils.get(ctx.guild.roles, name="Muted")
if mutedRole not in member.roles:
if muted_role not in member.roles:
await ctx.send(f"{member.mention} не замучен.")
return
await member.remove_roles(mutedRole)
await member.remove_roles(muted_role)
await ctx.send(f"{member.mention} больше не замучен.")
else:
await ctx.send(f'{ctx.author.mention}, у вас нет роли <@&1060541642450411560>.')
+2 -2
View File
@@ -8,7 +8,7 @@ class TicketsCommand(commands.Cog):
ticket_channel = None
@commands.slash_command()
@commands.slash_command(name="ticket")
@commands.has_permissions(manage_channels=True)
async def ticket(self, ctx: disnake.AppCommandInteraction):
global ticket_channel
@@ -24,7 +24,7 @@ class TicketsCommand(commands.Cog):
except:
await ctx.send('Ошибка при создании канала. Пожалуйста, попробуйте позже.')
@commands.slash_command()
@commands.slash_command(name="close_ticket")
@commands.has_permissions(manage_channels=True)
async def close_ticket(self, ctx: disnake.AppCommandInteraction):
global ticket_channel
+26 -23
View File
@@ -8,18 +8,33 @@ intents = disnake.Intents.all()
bot = commands.Bot(command_prefix="$", intents=intents)
# Функция сохранения данных пользователя в JSON
def save_data(user, data):
with open(f'./users/{user.id}.json', 'w') as file:
json.dump(data, file)
# Функция загрузки данных пользователя из файла JSON
def load_data(user):
try:
with open(f'./users/{user.id}.json', 'r') as file:
return json.load(file)
except FileNotFoundError:
return None
@bot.event
async def on_ready():
print("Bot is ready")
@bot.command()
@bot.command(name="super_secret_command")
async def secret(ctx):
await ctx.message.delete()
await ctx.send(f'Привет, {ctx.author.mention}. Это тайное сообщение!')
@bot.command()
@bot.command(name="news")
async def news(ctx):
# Ваш код для получения новостей
page_news = [
@@ -43,42 +58,30 @@ async def news(ctx):
await ctx.send(embed=embed)
@bot.command()
@bot.command(name="setmoderator")
@commands.has_guild_permissions(administrator=True)
async def set_moderator(ctx: disnake.AppCommandInteraction, member: disnake.Member):
member = member or ctx.message.author
guild = bot.get_guild(1060537877982887957)
role = guild.get_role(1060541642450411560)
await member.add_roles(role)
await ctx.send(f"Пользователю {member.mention} была выдана роль {role.mention}")
@bot.command()
@bot.command(name="deletemoderator")
@commands.has_guild_permissions(administrator=True)
async def dellmoderator(ctx: disnake.AppCommandInteraction, member: disnake.Member):
async def delete_moderator(ctx: disnake.AppCommandInteraction, member: disnake.Member):
member = member or ctx.message.author
guild = bot.get_guild(1060537877982887957)
role = guild.get_role(1060541642450411560)
await member.remove_roles(role)
await ctx.send(f"Пользователю {member.mention} была снята роль {role.mention}")
def save_data(user, data):
with open(f'./users/{user.id}.json', 'w') as file:
json.dump(data, file)
# Функция загрузки данных пользователя из файла JSON
def load_data(user):
try:
with open(f'./users/{user.id}.json', 'r') as file:
return json.load(file)
except FileNotFoundError:
return None
# Создание команды регистрации
@bot.command()
@bot.command(name="register")
async def register(ctx: disnake.AppCommandInteraction, name):
# Проверка, был ли пользователь уже зарегистрирован
data = load_data(ctx.author)
@@ -94,7 +97,7 @@ async def register(ctx: disnake.AppCommandInteraction, name):
# Создание команды для просмотра баланса
@bot.command()
@bot.command(name="balance")
async def balance(ctx):
# Загрузка данных пользователя из файла JSON
data = load_data(ctx.author)
@@ -107,7 +110,7 @@ async def balance(ctx):
await ctx.send(f'{ctx.author.mention}, ваш текущий баланс: {data["coins"]}')
@bot.command()
@bot.command(name="pay")
async def pay(ctx: disnake.AppCommandInteraction, recipient: disnake.User, amount: int):
# Загрузка данных отправителя из файла JSON
sender_data = load_data(ctx.author)
@@ -145,4 +148,4 @@ for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
bot.load_extension(f"cogs.{filename[:-3]}")
bot.run("MTA5ODk5MzExMjI5NjE5NDA3MA.GUj8WN.16iwjYtaouRXbsfJhCi1U7fa75ehLFb7YRbEnU")
bot.run(settings.DISCORD_TOKEN)
+1
View File
@@ -0,0 +1 @@
DISCORD_TOKEN = "MTA5ODk5MzExMjI5NjE5NDA3MA.GUj8WN.16iwjYtaouRXbsfJhCi1U7fa75ehLFb7YRbEnU"